mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-10 03:16:51 +08:00
feat: provider add baichuan (#1298)
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
import { ProviderEnum } from '../declarations'
|
||||
import type { ProviderConfig } from '../declarations'
|
||||
import { BaichuanTextCn } from '@/app/components/base/icons/src/image/llm'
|
||||
import {
|
||||
Baichuan,
|
||||
BaichuanText,
|
||||
} from '@/app/components/base/icons/src/public/llm'
|
||||
|
||||
const config: ProviderConfig = {
|
||||
selector: {
|
||||
name: {
|
||||
'en': 'BAICHUAN AI',
|
||||
'zh-Hans': '百川智能',
|
||||
},
|
||||
icon: <Baichuan className='w-full h-full' />,
|
||||
},
|
||||
item: {
|
||||
key: ProviderEnum.baichuan,
|
||||
titleIcon: {
|
||||
'en': <BaichuanText className='w-[124px] h-6' />,
|
||||
'zh-Hans': <BaichuanTextCn className='w-[100px] h-6' />,
|
||||
},
|
||||
},
|
||||
modal: {
|
||||
key: ProviderEnum.baichuan,
|
||||
title: {
|
||||
'en': 'BAICHUAN AI',
|
||||
'zh-Hans': '百川智能',
|
||||
},
|
||||
icon: <Baichuan className='w-6 h-6' />,
|
||||
link: {
|
||||
href: 'https://platform.baichuan-ai.com/console/apikey',
|
||||
label: {
|
||||
'en': 'Get your API key from BAICHUAN AI',
|
||||
'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
|
||||
@@ -12,6 +12,7 @@ import xinference from './xinference'
|
||||
import openllm from './openllm'
|
||||
import localai from './localai'
|
||||
import zhipuai from './zhipuai'
|
||||
import baichuan from './baichuan'
|
||||
|
||||
export default {
|
||||
openai,
|
||||
@@ -28,4 +29,5 @@ export default {
|
||||
openllm,
|
||||
localai,
|
||||
zhipuai,
|
||||
baichuan,
|
||||
}
|
||||
|
||||
@@ -56,6 +56,31 @@ const config: ProviderConfig = {
|
||||
'server_url',
|
||||
],
|
||||
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: 'model_name',
|
||||
|
||||
@@ -43,6 +43,7 @@ export enum ProviderEnum {
|
||||
'openllm' = 'openllm',
|
||||
'localai' = 'localai',
|
||||
'zhipuai' = 'zhipuai',
|
||||
'baichuan' = 'baichuan',
|
||||
}
|
||||
|
||||
export type ProviderConfigItem = {
|
||||
|
||||
@@ -79,6 +79,7 @@ const ModelPage = () => {
|
||||
config.replicate,
|
||||
config.huggingface_hub,
|
||||
config.zhipuai,
|
||||
config.baichuan,
|
||||
config.spark,
|
||||
config.minimax,
|
||||
config.tongyi,
|
||||
@@ -93,6 +94,7 @@ const ModelPage = () => {
|
||||
modelList = [
|
||||
config.huggingface_hub,
|
||||
config.zhipuai,
|
||||
config.baichuan,
|
||||
config.spark,
|
||||
config.minimax,
|
||||
config.azure_openai,
|
||||
|
||||
Reference in New Issue
Block a user