feat: frontend multi models support (#804)
Co-authored-by: StyleZhang <jasonapring2015@outlook.com> Co-authored-by: Joel <iamjoel007@gmail.com>
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
import { ProviderEnum } from '../declarations'
|
||||
import type { ProviderConfig } from '../declarations'
|
||||
import { Anthropic, AnthropicText } from '@/app/components/base/icons/src/public/llm'
|
||||
import { IS_CE_EDITION } from '@/config'
|
||||
|
||||
const config: ProviderConfig = {
|
||||
selector: {
|
||||
name: {
|
||||
'en': 'Anthropic',
|
||||
'zh-Hans': 'Anthropic',
|
||||
},
|
||||
icon: <Anthropic className='w-full h-full' />,
|
||||
},
|
||||
item: {
|
||||
key: ProviderEnum.anthropic,
|
||||
titleIcon: {
|
||||
'en': <AnthropicText className='h-5' />,
|
||||
'zh-Hans': <AnthropicText className='h-5' />,
|
||||
},
|
||||
subTitleIcon: <Anthropic className='h-6' />,
|
||||
desc: {
|
||||
'en': 'Anthropic’s powerful models, such as Claude 2 and Claude Instant.',
|
||||
'zh-Hans': 'Anthropic 的强大模型,例如 Claude 2 和 Claude Instant。',
|
||||
},
|
||||
bgColor: 'bg-[#F0F0EB]',
|
||||
},
|
||||
modal: {
|
||||
key: ProviderEnum.anthropic,
|
||||
title: {
|
||||
'en': 'Anthropic',
|
||||
'zh-Hans': 'Anthropic',
|
||||
},
|
||||
icon: <Anthropic className='h-6' />,
|
||||
link: {
|
||||
href: 'https://console.anthropic.com/account/keys',
|
||||
label: {
|
||||
'en': 'Get your API key from Anthropic',
|
||||
'zh-Hans': '从 Anthropic 获取 API Key',
|
||||
},
|
||||
},
|
||||
validateKeys: ['anthropic_api_key'],
|
||||
fields: [
|
||||
{
|
||||
type: 'text',
|
||||
key: 'anthropic_api_key',
|
||||
required: true,
|
||||
label: {
|
||||
'en': 'API Key',
|
||||
'zh-Hans': 'API Key',
|
||||
},
|
||||
placeholder: {
|
||||
'en': 'Enter your API key here',
|
||||
'zh-Hans': '在此输入您的 API Key',
|
||||
},
|
||||
},
|
||||
...(
|
||||
IS_CE_EDITION
|
||||
? [{
|
||||
type: 'text',
|
||||
key: 'anthropic_api_url',
|
||||
required: false,
|
||||
label: {
|
||||
'en': 'Custom API Domain',
|
||||
'zh-Hans': '自定义 API 域名',
|
||||
},
|
||||
placeholder: {
|
||||
'en': 'Enter your API domain, eg: https://example.com/xxx(Optional)',
|
||||
'zh-Hans': '在此输入您的 API 域名,如:https://example.com/xxx(选填)',
|
||||
},
|
||||
help: {
|
||||
'en': 'Configurable custom Anthropic API server url.',
|
||||
'zh-Hans': '可配置自定义 Anthropic API 服务器地址。',
|
||||
},
|
||||
}]
|
||||
: []
|
||||
),
|
||||
],
|
||||
},
|
||||
}
|
||||
export default config
|
||||
@@ -0,0 +1,175 @@
|
||||
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',
|
||||
'zh-Hans': '在此输入您的部署名称',
|
||||
},
|
||||
},
|
||||
{
|
||||
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: '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
|
||||
@@ -0,0 +1,69 @@
|
||||
import { ProviderEnum } from '../declarations'
|
||||
import type { ProviderConfig } from '../declarations'
|
||||
import { Chatglm, ChatglmText } from '@/app/components/base/icons/src/public/llm'
|
||||
|
||||
const config: ProviderConfig = {
|
||||
selector: {
|
||||
name: {
|
||||
'en': 'ChatGLM',
|
||||
'zh-Hans': 'ChatGLM',
|
||||
},
|
||||
icon: <Chatglm className='w-full h-full' />,
|
||||
},
|
||||
item: {
|
||||
key: ProviderEnum.chatglm,
|
||||
titleIcon: {
|
||||
'en': <ChatglmText className='h-6' />,
|
||||
'zh-Hans': <ChatglmText className='h-6' />,
|
||||
},
|
||||
disable: {
|
||||
tip: {
|
||||
'en': 'Only supports the ',
|
||||
'zh-Hans': '仅支持',
|
||||
},
|
||||
link: {
|
||||
href: {
|
||||
'en': 'https://docs.dify.ai/getting-started/install-self-hosted',
|
||||
'zh-Hans': 'https://docs.dify.ai/v/zh-hans/getting-started/install-self-hosted',
|
||||
},
|
||||
label: {
|
||||
'en': 'community open-source version',
|
||||
'zh-Hans': '社区开源版本',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
modal: {
|
||||
key: ProviderEnum.chatglm,
|
||||
title: {
|
||||
'en': 'ChatGLM',
|
||||
'zh-Hans': 'ChatGLM',
|
||||
},
|
||||
icon: <Chatglm className='h-6' />,
|
||||
link: {
|
||||
href: 'https://github.com/THUDM/ChatGLM-6B#api%E9%83%A8%E7%BD%B2',
|
||||
label: {
|
||||
'en': 'How to deploy ChatGLM',
|
||||
'zh-Hans': '如何部署 ChatGLM',
|
||||
},
|
||||
},
|
||||
validateKeys: ['api_base'],
|
||||
fields: [
|
||||
{
|
||||
type: 'text',
|
||||
key: 'api_base',
|
||||
required: true,
|
||||
label: {
|
||||
'en': 'Custom API Domain',
|
||||
'zh-Hans': '自定义 API 域名',
|
||||
},
|
||||
placeholder: {
|
||||
'en': 'Enter your API domain, eg: https://example.com/xxx',
|
||||
'zh-Hans': '在此输入您的 API 域名,如:https://example.com/xxx',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
export default config
|
||||
@@ -0,0 +1,127 @@
|
||||
import { ProviderEnum } from '../declarations'
|
||||
import type { FormValue, ProviderConfig } from '../declarations'
|
||||
import { Huggingface, HuggingfaceText } from '@/app/components/base/icons/src/public/llm'
|
||||
|
||||
const config: ProviderConfig = {
|
||||
selector: {
|
||||
name: {
|
||||
'en': 'Hugging Face',
|
||||
'zh-Hans': 'Hugging Face',
|
||||
},
|
||||
icon: <Huggingface className='w-full h-full' />,
|
||||
},
|
||||
item: {
|
||||
key: ProviderEnum.huggingface_hub,
|
||||
titleIcon: {
|
||||
'en': <HuggingfaceText className='h-6' />,
|
||||
'zh-Hans': <HuggingfaceText className='h-6' />,
|
||||
},
|
||||
hit: {
|
||||
'en': '🐑 Llama 2 Supported',
|
||||
'zh-Hans': '🐑 Llama 2 已支持',
|
||||
},
|
||||
},
|
||||
modal: {
|
||||
key: ProviderEnum.huggingface_hub,
|
||||
title: {
|
||||
'en': 'Hugging Face Model',
|
||||
'zh-Hans': 'Hugging Face Model',
|
||||
},
|
||||
icon: <Huggingface className='h-6' />,
|
||||
link: {
|
||||
href: 'https://huggingface.co/settings/tokens',
|
||||
label: {
|
||||
'en': 'Get your API key from Hugging Face Hub',
|
||||
'zh-Hans': '从 Hugging Face Hub 获取 API Key',
|
||||
},
|
||||
},
|
||||
defaultValue: {
|
||||
model_type: 'text-generation',
|
||||
huggingfacehub_api_type: 'hosted_inference_api',
|
||||
},
|
||||
validateKeys: (v?: FormValue) => {
|
||||
if (v?.huggingfacehub_api_type === 'hosted_inference_api') {
|
||||
return [
|
||||
'huggingfacehub_api_token',
|
||||
'model_name',
|
||||
]
|
||||
}
|
||||
if (v?.huggingfacehub_api_type === 'inference_endpoints') {
|
||||
return [
|
||||
'huggingfacehub_api_token',
|
||||
'model_name',
|
||||
'huggingfacehub_endpoint_url',
|
||||
]
|
||||
}
|
||||
return []
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
type: 'radio',
|
||||
key: 'huggingfacehub_api_type',
|
||||
required: true,
|
||||
label: {
|
||||
'en': 'Endpoint Type',
|
||||
'zh-Hans': '端点类型',
|
||||
},
|
||||
options: [
|
||||
{
|
||||
key: 'hosted_inference_api',
|
||||
label: {
|
||||
'en': 'Hosted Inference API',
|
||||
'zh-Hans': 'Hosted Inference API',
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'inference_endpoints',
|
||||
label: {
|
||||
'en': 'Inference Endpoints',
|
||||
'zh-Hans': 'Inference Endpoints',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
key: 'huggingfacehub_api_token',
|
||||
required: true,
|
||||
label: {
|
||||
'en': 'API Token',
|
||||
'zh-Hans': 'API Token',
|
||||
},
|
||||
placeholder: {
|
||||
'en': 'Enter your Hugging Face Hub API Token here',
|
||||
'zh-Hans': '在此输入您的 Hugging Face Hub API Token',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
key: 'model_name',
|
||||
required: true,
|
||||
label: {
|
||||
'en': 'Model Name',
|
||||
'zh-Hans': '模型名称',
|
||||
},
|
||||
placeholder: {
|
||||
'en': 'Enter your Model Name here',
|
||||
'zh-Hans': '在此输入您的模型名称',
|
||||
},
|
||||
},
|
||||
{
|
||||
hidden: (value?: FormValue) => value?.huggingfacehub_api_type === 'hosted_inference_api',
|
||||
type: 'text',
|
||||
key: 'huggingfacehub_endpoint_url',
|
||||
label: {
|
||||
'en': 'Endpoint URL',
|
||||
'zh-Hans': '端点 URL',
|
||||
},
|
||||
placeholder: {
|
||||
'en': 'Enter your Endpoint URL here',
|
||||
'zh-Hans': '在此输入您的端点 URL',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
export default config
|
||||
@@ -0,0 +1,23 @@
|
||||
import openai from './openai'
|
||||
import anthropic from './anthropic'
|
||||
import azure_openai from './azure_openai'
|
||||
import replicate from './replicate'
|
||||
import huggingface_hub from './huggingface_hub'
|
||||
import wenxin from './wenxin'
|
||||
import tongyi from './tongyi'
|
||||
import spark from './spark'
|
||||
import minimax from './minimax'
|
||||
import chatglm from './chatglm'
|
||||
|
||||
export default {
|
||||
openai,
|
||||
anthropic,
|
||||
azure_openai,
|
||||
replicate,
|
||||
huggingface_hub,
|
||||
wenxin,
|
||||
tongyi,
|
||||
spark,
|
||||
minimax,
|
||||
chatglm,
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import { ProviderEnum } from '../declarations'
|
||||
import type { ProviderConfig } from '../declarations'
|
||||
import { Minimax, MinimaxText } from '@/app/components/base/icons/src/image/llm'
|
||||
|
||||
const config: ProviderConfig = {
|
||||
selector: {
|
||||
name: {
|
||||
'en': 'MINIMAX',
|
||||
'zh-Hans': 'MINIMAX',
|
||||
},
|
||||
icon: <Minimax className='w-full h-full' />,
|
||||
},
|
||||
item: {
|
||||
key: ProviderEnum.minimax,
|
||||
titleIcon: {
|
||||
'en': <MinimaxText className='w-[84px] h-6' />,
|
||||
'zh-Hans': <MinimaxText className='w-[84px] h-6' />,
|
||||
},
|
||||
},
|
||||
modal: {
|
||||
key: ProviderEnum.minimax,
|
||||
title: {
|
||||
'en': 'MiniMax',
|
||||
'zh-Hans': 'MiniMax',
|
||||
},
|
||||
icon: <Minimax className='w-6 h-6' />,
|
||||
link: {
|
||||
href: 'https://api.minimax.chat/user-center/basic-information/interface-key',
|
||||
label: {
|
||||
'en': 'Get your API key from MiniMax',
|
||||
'zh-Hans': '从 MiniMax 获取 API Key',
|
||||
},
|
||||
},
|
||||
validateKeys: [
|
||||
'minimax_api_key',
|
||||
'minimax_group_id',
|
||||
],
|
||||
fields: [
|
||||
{
|
||||
type: 'text',
|
||||
key: 'minimax_api_key',
|
||||
required: true,
|
||||
label: {
|
||||
'en': 'API Key',
|
||||
'zh-Hans': 'API Key',
|
||||
},
|
||||
placeholder: {
|
||||
'en': 'Enter your API key here',
|
||||
'zh-Hans': '在此输入您的 API Key',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
key: 'minimax_group_id',
|
||||
required: true,
|
||||
label: {
|
||||
'en': 'Group ID',
|
||||
'zh-Hans': 'Group ID',
|
||||
},
|
||||
placeholder: {
|
||||
'en': 'Enter your Group ID here',
|
||||
'zh-Hans': '在此输入您的 Group ID',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
export default config
|
||||
@@ -0,0 +1,93 @@
|
||||
import { ProviderEnum } from '../declarations'
|
||||
import type { ProviderConfig } from '../declarations'
|
||||
import { OpenaiBlack, OpenaiText, OpenaiTransparent } from '@/app/components/base/icons/src/public/llm'
|
||||
import { IS_CE_EDITION } from '@/config'
|
||||
|
||||
const config: ProviderConfig = {
|
||||
selector: {
|
||||
name: {
|
||||
'en': 'OpenAI',
|
||||
'zh-Hans': 'OpenAI',
|
||||
},
|
||||
icon: <OpenaiBlack className='w-full h-full' />,
|
||||
},
|
||||
item: {
|
||||
key: ProviderEnum.openai,
|
||||
titleIcon: {
|
||||
'en': <OpenaiText className='h-5' />,
|
||||
'zh-Hans': <OpenaiText className='h-5' />,
|
||||
},
|
||||
subTitleIcon: <OpenaiBlack className='w-6 h-6' />,
|
||||
desc: {
|
||||
'en': 'Models provided by OpenAI, such as GPT-3.5-Turbo and GPT-4.',
|
||||
'zh-Hans': 'OpenAI 提供的模型,例如 GPT-3.5-Turbo 和 GPT-4。',
|
||||
},
|
||||
bgColor: 'bg-gray-200',
|
||||
},
|
||||
modal: {
|
||||
key: ProviderEnum.openai,
|
||||
title: {
|
||||
'en': 'OpenAI',
|
||||
'zh-Hans': 'OpenAI',
|
||||
},
|
||||
icon: <OpenaiTransparent className='w-6 h-6' />,
|
||||
link: {
|
||||
href: 'https://platform.openai.com/account/api-keys',
|
||||
label: {
|
||||
'en': 'Get your API key from OpenAI',
|
||||
'zh-Hans': '从 OpenAI 获取 API Key',
|
||||
},
|
||||
},
|
||||
validateKeys: ['openai_api_key'],
|
||||
fields: [
|
||||
{
|
||||
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: 'text',
|
||||
key: 'openai_organization',
|
||||
required: false,
|
||||
label: {
|
||||
'en': 'Organization ID',
|
||||
'zh-Hans': '组织 ID',
|
||||
},
|
||||
placeholder: {
|
||||
'en': 'Enter your Organization ID(Optional)',
|
||||
'zh-Hans': '在此输入您的组织 ID(选填)',
|
||||
},
|
||||
},
|
||||
...(
|
||||
IS_CE_EDITION
|
||||
? [{
|
||||
type: 'text',
|
||||
key: 'openai_api_base',
|
||||
required: false,
|
||||
label: {
|
||||
'en': 'Custom API Domain',
|
||||
'zh-Hans': '自定义 API 域名',
|
||||
},
|
||||
placeholder: {
|
||||
'en': 'Enter your API domain, eg: https://example.com/xxx(Optional)',
|
||||
'zh-Hans': '在此输入您的 API 域名,如:https://example.com/xxx(选填)',
|
||||
},
|
||||
help: {
|
||||
'en': 'You can configure your server compatible with the OpenAI API specification, or proxy mirror address',
|
||||
'zh-Hans': '可配置您的兼容 OpenAI API 规范的服务器,或者代理镜像地址',
|
||||
},
|
||||
}]
|
||||
: []
|
||||
),
|
||||
],
|
||||
},
|
||||
}
|
||||
export default config
|
||||
@@ -0,0 +1,115 @@
|
||||
import { ProviderEnum } from '../declarations'
|
||||
import type { ProviderConfig } from '../declarations'
|
||||
import { Replicate, ReplicateText } from '@/app/components/base/icons/src/public/llm'
|
||||
|
||||
const config: ProviderConfig = {
|
||||
selector: {
|
||||
name: {
|
||||
'en': 'Replicate',
|
||||
'zh-Hans': 'Replicate',
|
||||
},
|
||||
icon: <Replicate className='w-full h-full' />,
|
||||
},
|
||||
item: {
|
||||
key: ProviderEnum.replicate,
|
||||
titleIcon: {
|
||||
'en': <ReplicateText className='h-6' />,
|
||||
'zh-Hans': <ReplicateText className='h-6' />,
|
||||
},
|
||||
hit: {
|
||||
'en': '🐑 Llama 2 Supported',
|
||||
'zh-Hans': '🐑 Llama 2 已支持',
|
||||
},
|
||||
},
|
||||
modal: {
|
||||
key: ProviderEnum.replicate,
|
||||
title: {
|
||||
'en': 'Replicate Model',
|
||||
'zh-Hans': 'Replicate Model',
|
||||
},
|
||||
icon: <Replicate className='h-6' />,
|
||||
link: {
|
||||
href: 'https://replicate.com/account/api-tokens',
|
||||
label: {
|
||||
'en': 'Get your API key from Replicate',
|
||||
'zh-Hans': '从 Replicate 获取 API Key',
|
||||
},
|
||||
},
|
||||
defaultValue: {
|
||||
model_type: 'text-generation',
|
||||
},
|
||||
validateKeys: [
|
||||
'model_type',
|
||||
'replicate_api_token',
|
||||
'model_name',
|
||||
'model_version',
|
||||
],
|
||||
fields: [
|
||||
{
|
||||
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: 'replicate_api_token',
|
||||
required: true,
|
||||
label: {
|
||||
'en': 'API Key',
|
||||
'zh-Hans': 'API Key',
|
||||
},
|
||||
placeholder: {
|
||||
'en': 'Enter your Replicate API key here',
|
||||
'zh-Hans': '在此输入您的 Replicate API Key',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
key: 'model_name',
|
||||
required: true,
|
||||
label: {
|
||||
'en': 'Model Name',
|
||||
'zh-Hans': '模型名称',
|
||||
},
|
||||
placeholder: {
|
||||
'en': 'Enter your Model Name here',
|
||||
'zh-Hans': '在此输入您的模型名称',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
key: 'model_version',
|
||||
label: {
|
||||
'en': 'Model Version',
|
||||
'zh-Hans': '模型版本',
|
||||
},
|
||||
placeholder: {
|
||||
'en': 'Enter your Model Version here',
|
||||
'zh-Hans': '在此输入您的模型版本',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
export default config
|
||||
@@ -0,0 +1,83 @@
|
||||
import { ProviderEnum } from '../declarations'
|
||||
import type { ProviderConfig } from '../declarations'
|
||||
import { IflytekSpark, IflytekSparkText, IflytekSparkTextCn } from '@/app/components/base/icons/src/public/llm'
|
||||
|
||||
const config: ProviderConfig = {
|
||||
selector: {
|
||||
name: {
|
||||
'en': 'iFLYTEK SPARK',
|
||||
'zh-Hans': '讯飞星火',
|
||||
},
|
||||
icon: <IflytekSpark className='w-full h-full' />,
|
||||
},
|
||||
item: {
|
||||
key: ProviderEnum.spark,
|
||||
titleIcon: {
|
||||
'en': <IflytekSparkText className='h-6' />,
|
||||
'zh-Hans': <IflytekSparkTextCn className='h-6' />,
|
||||
},
|
||||
},
|
||||
modal: {
|
||||
key: ProviderEnum.spark,
|
||||
title: {
|
||||
'en': 'iFLYTEK SPARK',
|
||||
'zh-Hans': '讯飞星火',
|
||||
},
|
||||
icon: <IflytekSpark className='w-6 h-6' />,
|
||||
link: {
|
||||
href: 'https://www.xfyun.cn/solutions/xinghuoAPI',
|
||||
label: {
|
||||
'en': 'Get your API key from AliCloud',
|
||||
'zh-Hans': '从阿里云获取 API Key',
|
||||
},
|
||||
},
|
||||
validateKeys: [
|
||||
'app_id',
|
||||
'api_key',
|
||||
'api_secret',
|
||||
],
|
||||
fields: [
|
||||
{
|
||||
type: 'text',
|
||||
key: 'app_id',
|
||||
required: true,
|
||||
label: {
|
||||
'en': 'API ID',
|
||||
'zh-Hans': 'API ID',
|
||||
},
|
||||
placeholder: {
|
||||
'en': 'Enter your API ID here',
|
||||
'zh-Hans': '在此输入您的 API ID',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
key: 'api_key',
|
||||
required: true,
|
||||
label: {
|
||||
'en': 'API Key',
|
||||
'zh-Hans': 'API Key',
|
||||
},
|
||||
placeholder: {
|
||||
'en': 'Enter your API key here',
|
||||
'zh-Hans': '在此输入您的 API Key',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
key: 'api_secret',
|
||||
required: true,
|
||||
label: {
|
||||
'en': 'API Secret',
|
||||
'zh-Hans': 'API Secret',
|
||||
},
|
||||
placeholder: {
|
||||
'en': 'Enter your API Secret here',
|
||||
'zh-Hans': '在此输入您的 API Secret',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
export default config
|
||||
@@ -0,0 +1,53 @@
|
||||
import { ProviderEnum } from '../declarations'
|
||||
import type { ProviderConfig } from '../declarations'
|
||||
import { Tongyi, TongyiText, TongyiTextCn } from '@/app/components/base/icons/src/image/llm'
|
||||
|
||||
const config: ProviderConfig = {
|
||||
selector: {
|
||||
name: {
|
||||
'en': 'TONGYI QIANWEN',
|
||||
'zh-Hans': '通义千问',
|
||||
},
|
||||
icon: <Tongyi className='w-full h-full' />,
|
||||
},
|
||||
item: {
|
||||
key: ProviderEnum.tongyi,
|
||||
titleIcon: {
|
||||
'en': <TongyiText className='w-[88px] h-6' />,
|
||||
'zh-Hans': <TongyiTextCn className='w-[100px] h-6' />,
|
||||
},
|
||||
},
|
||||
modal: {
|
||||
key: ProviderEnum.tongyi,
|
||||
title: {
|
||||
'en': 'Tongyi',
|
||||
'zh-Hans': '通义千问',
|
||||
},
|
||||
icon: <Tongyi className='w-6 h-6' />,
|
||||
link: {
|
||||
href: 'https://dashscope.console.aliyun.com/api-key_management',
|
||||
label: {
|
||||
'en': 'Get your API key from AliCloud',
|
||||
'zh-Hans': '从阿里云获取 API Key',
|
||||
},
|
||||
},
|
||||
validateKeys: ['dashscope_api_key'],
|
||||
fields: [
|
||||
{
|
||||
type: 'text',
|
||||
key: 'dashscope_api_key',
|
||||
required: true,
|
||||
label: {
|
||||
'en': 'API Key',
|
||||
'zh-Hans': 'API Key',
|
||||
},
|
||||
placeholder: {
|
||||
'en': 'Enter your API key here',
|
||||
'zh-Hans': '在此输入您的 API Key',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
export default config
|
||||
@@ -0,0 +1,66 @@
|
||||
import { ProviderEnum } from '../declarations'
|
||||
import type { ProviderConfig } from '../declarations'
|
||||
import { Wxyy, WxyyText, WxyyTextCn } from '@/app/components/base/icons/src/image/llm'
|
||||
|
||||
const config: ProviderConfig = {
|
||||
selector: {
|
||||
name: {
|
||||
'en': 'WENXIN YIYAN',
|
||||
'zh-Hans': '文心一言',
|
||||
},
|
||||
icon: <Wxyy className='w-full h-full' />,
|
||||
},
|
||||
item: {
|
||||
key: ProviderEnum.wenxin,
|
||||
titleIcon: {
|
||||
'en': <WxyyText className='w-[124px] h-6' />,
|
||||
'zh-Hans': <WxyyTextCn className='w-[100px] h-6' />,
|
||||
},
|
||||
},
|
||||
modal: {
|
||||
key: ProviderEnum.wenxin,
|
||||
title: {
|
||||
'en': 'WENXINYIYAN',
|
||||
'zh-Hans': '文心一言',
|
||||
},
|
||||
icon: <Wxyy className='w-6 h-6' />,
|
||||
link: {
|
||||
href: 'https://console.bce.baidu.com/qianfan/ais/console/applicationConsole/application',
|
||||
label: {
|
||||
'en': 'Get your API key from Baidu',
|
||||
'zh-Hans': '从百度获取 API Key',
|
||||
},
|
||||
},
|
||||
validateKeys: ['api_key', 'secret_key'],
|
||||
fields: [
|
||||
{
|
||||
type: 'text',
|
||||
key: 'api_key',
|
||||
required: true,
|
||||
label: {
|
||||
'en': 'API Key',
|
||||
'zh-Hans': 'API Key',
|
||||
},
|
||||
placeholder: {
|
||||
'en': 'Enter your API key here',
|
||||
'zh-Hans': '在此输入您的 API Key',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
key: 'secret_key',
|
||||
required: true,
|
||||
label: {
|
||||
'en': 'Secret Key',
|
||||
'zh-Hans': 'Secret Key',
|
||||
},
|
||||
placeholder: {
|
||||
'en': 'Enter your Secret key here',
|
||||
'zh-Hans': '在此输入您的 Secret Key',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
export default config
|
||||
Reference in New Issue
Block a user