replicate.tsx 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. import { ProviderEnum } from '../declarations'
  2. import type { ProviderConfig } from '../declarations'
  3. import { Replicate, ReplicateText } from '@/app/components/base/icons/src/public/llm'
  4. const config: ProviderConfig = {
  5. selector: {
  6. name: {
  7. 'en': 'Replicate',
  8. 'zh-Hans': 'Replicate',
  9. },
  10. icon: <Replicate className='w-full h-full' />,
  11. },
  12. item: {
  13. key: ProviderEnum.replicate,
  14. titleIcon: {
  15. 'en': <ReplicateText className='h-6' />,
  16. 'zh-Hans': <ReplicateText className='h-6' />,
  17. },
  18. hit: {
  19. 'en': '🐑 Llama 2 Supported',
  20. 'zh-Hans': '🐑 Llama 2 已支持',
  21. },
  22. },
  23. modal: {
  24. key: ProviderEnum.replicate,
  25. title: {
  26. 'en': 'Replicate Model',
  27. 'zh-Hans': 'Replicate Model',
  28. },
  29. icon: <Replicate className='h-6' />,
  30. link: {
  31. href: 'https://replicate.com/account/api-tokens',
  32. label: {
  33. 'en': 'Get your API key from Replicate',
  34. 'zh-Hans': '从 Replicate 获取 API Key',
  35. },
  36. },
  37. defaultValue: {
  38. model_type: 'text-generation',
  39. },
  40. validateKeys: [
  41. 'model_type',
  42. 'replicate_api_token',
  43. 'model_name',
  44. 'model_version',
  45. ],
  46. fields: [
  47. {
  48. type: 'radio',
  49. key: 'model_type',
  50. required: true,
  51. label: {
  52. 'en': 'Model Type',
  53. 'zh-Hans': '模型类型',
  54. },
  55. options: [
  56. {
  57. key: 'text-generation',
  58. label: {
  59. 'en': 'Text Generation',
  60. 'zh-Hans': '文本生成',
  61. },
  62. },
  63. // {
  64. // key: 'chat',
  65. // label: {
  66. // 'en': 'Chat',
  67. // 'zh-Hans': '聊天',
  68. // },
  69. // },
  70. {
  71. key: 'embeddings',
  72. label: {
  73. 'en': 'Embeddings',
  74. 'zh-Hans': 'Embeddings',
  75. },
  76. },
  77. ],
  78. },
  79. {
  80. type: 'text',
  81. key: 'replicate_api_token',
  82. required: true,
  83. label: {
  84. 'en': 'API Key',
  85. 'zh-Hans': 'API Key',
  86. },
  87. placeholder: {
  88. 'en': 'Enter your Replicate API key here',
  89. 'zh-Hans': '在此输入您的 Replicate API Key',
  90. },
  91. },
  92. {
  93. type: 'text',
  94. key: 'model_name',
  95. required: true,
  96. label: {
  97. 'en': 'Model Name',
  98. 'zh-Hans': '模型名称',
  99. },
  100. placeholder: {
  101. 'en': 'Enter your Model Name here',
  102. 'zh-Hans': '在此输入您的模型名称',
  103. },
  104. },
  105. {
  106. type: 'text',
  107. key: 'model_version',
  108. label: {
  109. 'en': 'Model Version',
  110. 'zh-Hans': '模型版本',
  111. },
  112. placeholder: {
  113. 'en': 'Enter your Model Version here',
  114. 'zh-Hans': '在此输入您的模型版本',
  115. },
  116. },
  117. ],
  118. },
  119. }
  120. export default config