replicate.tsx 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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: 'embeddings',
  65. label: {
  66. 'en': 'Embeddings',
  67. 'zh-Hans': 'Embeddings',
  68. },
  69. },
  70. ],
  71. },
  72. {
  73. type: 'text',
  74. key: 'replicate_api_token',
  75. required: true,
  76. label: {
  77. 'en': 'API Key',
  78. 'zh-Hans': 'API Key',
  79. },
  80. placeholder: {
  81. 'en': 'Enter your Replicate API key here',
  82. 'zh-Hans': '在此输入您的 Replicate API Key',
  83. },
  84. },
  85. {
  86. type: 'text',
  87. key: 'model_name',
  88. required: true,
  89. label: {
  90. 'en': 'Model Name',
  91. 'zh-Hans': '模型名称',
  92. },
  93. placeholder: {
  94. 'en': 'Enter your Model Name here',
  95. 'zh-Hans': '在此输入您的模型名称',
  96. },
  97. },
  98. {
  99. type: 'text',
  100. key: 'model_version',
  101. label: {
  102. 'en': 'Model Version',
  103. 'zh-Hans': '模型版本',
  104. },
  105. placeholder: {
  106. 'en': 'Enter your Model Version here',
  107. 'zh-Hans': '在此输入您的模型版本',
  108. },
  109. },
  110. ],
  111. },
  112. }
  113. export default config