anthropic.tsx 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import { ProviderEnum } from '../declarations'
  2. import type { ProviderConfig } from '../declarations'
  3. import { Anthropic, AnthropicText } from '@/app/components/base/icons/src/public/llm'
  4. import { IS_CE_EDITION } from '@/config'
  5. const config: ProviderConfig = {
  6. selector: {
  7. name: {
  8. 'en': 'Anthropic',
  9. 'zh-Hans': 'Anthropic',
  10. },
  11. icon: <Anthropic className='w-full h-full' />,
  12. },
  13. item: {
  14. key: ProviderEnum.anthropic,
  15. titleIcon: {
  16. 'en': <AnthropicText className='h-5' />,
  17. 'zh-Hans': <AnthropicText className='h-5' />,
  18. },
  19. subTitleIcon: <Anthropic className='h-6' />,
  20. desc: {
  21. 'en': 'Anthropic’s powerful models, such as Claude 2 and Claude Instant.',
  22. 'zh-Hans': 'Anthropic 的强大模型,例如 Claude 2 和 Claude Instant。',
  23. },
  24. bgColor: 'bg-[#F0F0EB]',
  25. },
  26. modal: {
  27. key: ProviderEnum.anthropic,
  28. title: {
  29. 'en': 'Anthropic',
  30. 'zh-Hans': 'Anthropic',
  31. },
  32. icon: <Anthropic className='h-6' />,
  33. link: {
  34. href: 'https://console.anthropic.com/account/keys',
  35. label: {
  36. 'en': 'Get your API key from Anthropic',
  37. 'zh-Hans': '从 Anthropic 获取 API Key',
  38. },
  39. },
  40. validateKeys: ['anthropic_api_key'],
  41. fields: [
  42. {
  43. type: 'text',
  44. key: 'anthropic_api_key',
  45. required: true,
  46. label: {
  47. 'en': 'API Key',
  48. 'zh-Hans': 'API Key',
  49. },
  50. placeholder: {
  51. 'en': 'Enter your API key here',
  52. 'zh-Hans': '在此输入您的 API Key',
  53. },
  54. },
  55. ...(
  56. IS_CE_EDITION
  57. ? [{
  58. type: 'text',
  59. key: 'anthropic_api_url',
  60. required: false,
  61. label: {
  62. 'en': 'Custom API Domain',
  63. 'zh-Hans': '自定义 API 域名',
  64. },
  65. placeholder: {
  66. 'en': 'Enter your API domain, eg: https://example.com/xxx(Optional)',
  67. 'zh-Hans': '在此输入您的 API 域名,如:https://example.com/xxx(选填)',
  68. },
  69. help: {
  70. 'en': 'Configurable custom Anthropic API server url.',
  71. 'zh-Hans': '可配置自定义 Anthropic API 服务器地址。',
  72. },
  73. }]
  74. : []
  75. ),
  76. ],
  77. },
  78. }
  79. export default config