123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- import { ProviderEnum } from '../declarations'
- import type { ProviderConfig } from '../declarations'
- import { AzureOpenaiService, AzureOpenaiServiceText, OpenaiBlue } from '@/app/components/base/icons/src/public/llm'
- const config: ProviderConfig = {
- selector: {
- name: {
- 'en': 'Azure OpenAI Service',
- 'zh-Hans': 'Azure OpenAI Service',
- },
- icon: <OpenaiBlue className='w-full h-full' />,
- },
- item: {
- key: ProviderEnum.azure_openai,
- titleIcon: {
- 'en': <AzureOpenaiServiceText className='h-6' />,
- 'zh-Hans': <AzureOpenaiServiceText className='h-6' />,
- },
- },
- modal: {
- key: ProviderEnum.azure_openai,
- title: {
- 'en': 'Azure OpenAI Service Model',
- 'zh-Hans': 'Azure OpenAI Service Model',
- },
- icon: <AzureOpenaiService className='h-6' />,
- link: {
- href: 'https://azure.microsoft.com/en-us/products/ai-services/openai-service',
- label: {
- 'en': 'Get your API key from Azure',
- 'zh-Hans': '从 Azure 获取 API Key',
- },
- },
- defaultValue: {
- model_type: 'text-generation',
- },
- validateKeys: [
- 'model_name',
- 'model_type',
- 'openai_api_base',
- 'openai_api_key',
- 'base_model_name',
- ],
- fields: [
- {
- type: 'text',
- key: 'model_name',
- required: true,
- label: {
- 'en': 'Deployment Name',
- 'zh-Hans': '部署名称',
- },
- placeholder: {
- 'en': 'Enter your Deployment Name here, matching the Azure deployment name.',
- 'zh-Hans': '在此输入您的部署名称,需要与 Azure 的部署名称匹配',
- },
- },
- {
- type: 'radio',
- key: 'model_type',
- required: true,
- label: {
- 'en': 'Model Type',
- 'zh-Hans': '模型类型',
- },
- options: [
- {
- key: 'text-generation',
- label: {
- 'en': 'Text Generation',
- 'zh-Hans': '文本生成',
- },
- },
- {
- key: 'embeddings',
- label: {
- 'en': 'Embeddings',
- 'zh-Hans': 'Embeddings',
- },
- },
- ],
- },
- {
- type: 'text',
- key: 'openai_api_base',
- required: true,
- label: {
- 'en': 'API Endpoint URL',
- 'zh-Hans': 'API 域名',
- },
- placeholder: {
- 'en': 'Enter your API Endpoint, eg: https://example.com/xxx',
- 'zh-Hans': '在此输入您的 API 域名,如:https://example.com/xxx',
- },
- },
- {
- type: 'text',
- key: 'openai_api_key',
- required: true,
- label: {
- 'en': 'API Key',
- 'zh-Hans': 'API Key',
- },
- placeholder: {
- 'en': 'Enter your API key here',
- 'zh-Hans': '在此输入您的 API Key',
- },
- },
- {
- type: 'select',
- key: 'base_model_name',
- required: true,
- label: {
- 'en': 'Base Model',
- 'zh-Hans': '基础模型',
- },
- options: (v) => {
- if (v.model_type === 'text-generation') {
- return [
- {
- key: 'gpt-35-turbo',
- label: {
- 'en': 'gpt-35-turbo',
- 'zh-Hans': 'gpt-35-turbo',
- },
- },
- {
- key: 'gpt-35-turbo-16k',
- label: {
- 'en': 'gpt-35-turbo-16k',
- 'zh-Hans': 'gpt-35-turbo-16k',
- },
- },
- {
- key: 'gpt-4',
- label: {
- 'en': 'gpt-4',
- 'zh-Hans': 'gpt-4',
- },
- },
- {
- key: 'gpt-4-32k',
- label: {
- 'en': 'gpt-4-32k',
- 'zh-Hans': 'gpt-4-32k',
- },
- },
- {
- key: 'gpt-4-1106-preview',
- label: {
- 'en': 'gpt-4-1106-preview',
- 'zh-Hans': 'gpt-4-1106-preview',
- },
- },
- {
- key: 'gpt-4-vision-preview',
- label: {
- 'en': 'gpt-4-vision-preview',
- 'zh-Hans': 'gpt-4-vision-preview',
- },
- },
- {
- key: 'text-davinci-003',
- label: {
- 'en': 'text-davinci-003',
- 'zh-Hans': 'text-davinci-003',
- },
- },
- ]
- }
- if (v.model_type === 'embeddings') {
- return [
- {
- key: 'text-embedding-ada-002',
- label: {
- 'en': 'text-embedding-ada-002',
- 'zh-Hans': 'text-embedding-ada-002',
- },
- },
- ]
- }
- return []
- },
- },
- ],
- },
- }
- export default config
|