xinference.tsx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. import { ProviderEnum } from '../declarations'
  2. import type { ProviderConfig } from '../declarations'
  3. import { XorbitsInference, XorbitsInferenceText } from '@/app/components/base/icons/src/public/llm'
  4. const config: ProviderConfig = {
  5. selector: {
  6. name: {
  7. 'en': 'Xinference',
  8. 'zh-Hans': 'Xinference',
  9. },
  10. icon: <XorbitsInference className='w-full h-full' />,
  11. },
  12. item: {
  13. key: ProviderEnum.xinference,
  14. titleIcon: {
  15. 'en': <XorbitsInferenceText className='h-6' />,
  16. 'zh-Hans': <XorbitsInferenceText className='h-6' />,
  17. },
  18. disable: {
  19. tip: {
  20. 'en': 'Only supports the ',
  21. 'zh-Hans': '仅支持',
  22. },
  23. link: {
  24. href: {
  25. 'en': 'https://docs.dify.ai/getting-started/install-self-hosted',
  26. 'zh-Hans': 'https://docs.dify.ai/v/zh-hans/getting-started/install-self-hosted',
  27. },
  28. label: {
  29. 'en': 'community open-source version',
  30. 'zh-Hans': '社区开源版本',
  31. },
  32. },
  33. },
  34. },
  35. modal: {
  36. key: ProviderEnum.xinference,
  37. title: {
  38. 'en': 'Xinference',
  39. 'zh-Hans': 'Xinference',
  40. },
  41. icon: <XorbitsInference className='h-6' />,
  42. link: {
  43. href: 'https://github.com/xorbitsai/inference',
  44. label: {
  45. 'en': 'How to deploy Xinference',
  46. 'zh-Hans': '如何部署 Xinference',
  47. },
  48. },
  49. defaultValue: {
  50. model_type: 'text-generation',
  51. },
  52. validateKeys: [
  53. 'model_type',
  54. 'model_name',
  55. 'server_url',
  56. 'model_uid',
  57. ],
  58. fields: [
  59. {
  60. type: 'radio',
  61. key: 'model_type',
  62. required: true,
  63. label: {
  64. 'en': 'Model Type',
  65. 'zh-Hans': '模型类型',
  66. },
  67. options: [
  68. {
  69. key: 'text-generation',
  70. label: {
  71. 'en': 'Text Generation',
  72. 'zh-Hans': '文本生成',
  73. },
  74. },
  75. {
  76. key: 'embeddings',
  77. label: {
  78. 'en': 'Embeddings',
  79. 'zh-Hans': 'Embeddings',
  80. },
  81. },
  82. ],
  83. },
  84. {
  85. type: 'text',
  86. key: 'model_name',
  87. required: true,
  88. label: {
  89. 'en': 'Model Name',
  90. 'zh-Hans': '模型名称',
  91. },
  92. placeholder: {
  93. 'en': 'Enter your Model Name here',
  94. 'zh-Hans': '在此输入您的模型名称',
  95. },
  96. },
  97. {
  98. type: 'text',
  99. key: 'server_url',
  100. required: true,
  101. label: {
  102. 'en': 'Server Url',
  103. 'zh-Hans': 'Server Url',
  104. },
  105. placeholder: {
  106. 'en': 'Enter your Server url, eg: https://example.com/xxx',
  107. 'zh-Hans': '在此输入您的 Server url,如:https://example.com/xxx',
  108. },
  109. },
  110. {
  111. type: 'text',
  112. key: 'model_uid',
  113. required: true,
  114. label: {
  115. 'en': 'Model UID',
  116. 'zh-Hans': 'Model UID',
  117. },
  118. placeholder: {
  119. 'en': 'Enter your Model UID',
  120. 'zh-Hans': '在此输入您的 Model UID',
  121. },
  122. },
  123. ],
  124. },
  125. }
  126. export default config