소스 검색

feat: provider add baichuan (#1298)

zxhlyh 1 년 전
부모
커밋
df07fb5951
25개의 변경된 파일435개의 추가작업 그리고 0개의 파일을 삭제
  1. BIN
      web/app/components/base/icons/assets/image/llm/baichuan-text-cn.png
  2. 19 0
      web/app/components/base/icons/assets/public/llm/baichuan-text.svg
  3. 11 0
      web/app/components/base/icons/assets/public/llm/baichuan.svg
  4. 2 0
      web/app/components/base/icons/script.js
  5. 5 0
      web/app/components/base/icons/src/image/llm/BaichuanTextCn.module.css
  6. 15 0
      web/app/components/base/icons/src/image/llm/BaichuanTextCn.tsx
  7. 2 0
      web/app/components/base/icons/src/image/llm/Minimax.tsx
  8. 2 0
      web/app/components/base/icons/src/image/llm/MinimaxText.tsx
  9. 2 0
      web/app/components/base/icons/src/image/llm/Tongyi.tsx
  10. 2 0
      web/app/components/base/icons/src/image/llm/TongyiText.tsx
  11. 2 0
      web/app/components/base/icons/src/image/llm/TongyiTextCn.tsx
  12. 2 0
      web/app/components/base/icons/src/image/llm/Wxyy.tsx
  13. 2 0
      web/app/components/base/icons/src/image/llm/WxyyText.tsx
  14. 2 0
      web/app/components/base/icons/src/image/llm/WxyyTextCn.tsx
  15. 1 0
      web/app/components/base/icons/src/image/llm/index.ts
  16. 76 0
      web/app/components/base/icons/src/public/llm/Baichuan.json
  17. 16 0
      web/app/components/base/icons/src/public/llm/Baichuan.tsx
  18. 156 0
      web/app/components/base/icons/src/public/llm/BaichuanText.json
  19. 16 0
      web/app/components/base/icons/src/public/llm/BaichuanText.tsx
  20. 2 0
      web/app/components/base/icons/src/public/llm/index.ts
  21. 70 0
      web/app/components/header/account-setting/model-page/configs/baichuan.tsx
  22. 2 0
      web/app/components/header/account-setting/model-page/configs/index.ts
  23. 25 0
      web/app/components/header/account-setting/model-page/configs/openllm.tsx
  24. 1 0
      web/app/components/header/account-setting/model-page/declarations.ts
  25. 2 0
      web/app/components/header/account-setting/model-page/index.tsx

BIN
web/app/components/base/icons/assets/image/llm/baichuan-text-cn.png


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 19 - 0
web/app/components/base/icons/assets/public/llm/baichuan-text.svg


+ 11 - 0
web/app/components/base/icons/assets/public/llm/baichuan.svg

@@ -0,0 +1,11 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g id="Baichuan">
+<path id="Union" fill-rule="evenodd" clip-rule="evenodd" d="M8.58154 1.7793H5.52779L3.34655 6.20409V17.7335L0.916016 22.2206H6.21333L8.58154 17.7335V1.7793ZM10.5761 1.7793H15.8111V22.2206H10.5761V1.7793ZM22.9166 1.7793H17.6816V6.01712H22.9166V1.7793ZM22.9166 7.38818H17.6816V22.2206H22.9166V7.38818Z" fill="url(#paint0_radial_11622_96084)"/>
+</g>
+<defs>
+<radialGradient id="paint0_radial_11622_96084" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(5.5 5.5) rotate(45) scale(20.5061 22.0704)">
+<stop stop-color="#FEBD3F"/>
+<stop offset="0.77608" stop-color="#FF6933"/>
+</radialGradient>
+</defs>
+</svg>

+ 2 - 0
web/app/components/base/icons/script.js

@@ -115,6 +115,8 @@ const Icon = React.forwardRef<HTMLSpanElement, React.DetailedHTMLProps<React.HTM
   ref,
 ) => <span className={cn(s.wrapper, className)} {...restProps} ref={ref} />)
 
+Icon.displayName = '<%= fileName %>'
+
 export default Icon
 `.trim())
 

+ 5 - 0
web/app/components/base/icons/src/image/llm/BaichuanTextCn.module.css

@@ -0,0 +1,5 @@
+.wrapper {
+  display: inline-flex;
+  background: url(~@/app/components/base/icons/assets/image/llm/baichuan-text-cn.png) center center no-repeat;
+  background-size: contain;
+}

+ 15 - 0
web/app/components/base/icons/src/image/llm/BaichuanTextCn.tsx

@@ -0,0 +1,15 @@
+// GENERATE BY script
+// DON NOT EDIT IT MANUALLY
+
+import * as React from 'react'
+import cn from 'classnames'
+import s from './BaichuanTextCn.module.css'
+
+const Icon = React.forwardRef<HTMLSpanElement, React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>>((
+  { className, ...restProps },
+  ref,
+) => <span className={cn(s.wrapper, className)} {...restProps} ref={ref} />)
+
+Icon.displayName = 'BaichuanTextCn'
+
+export default Icon

+ 2 - 0
web/app/components/base/icons/src/image/llm/Minimax.tsx

@@ -10,4 +10,6 @@ const Icon = React.forwardRef<HTMLSpanElement, React.DetailedHTMLProps<React.HTM
   ref,
 ) => <span className={cn(s.wrapper, className)} {...restProps} ref={ref} />)
 
+Icon.displayName = 'Minimax'
+
 export default Icon

+ 2 - 0
web/app/components/base/icons/src/image/llm/MinimaxText.tsx

@@ -10,4 +10,6 @@ const Icon = React.forwardRef<HTMLSpanElement, React.DetailedHTMLProps<React.HTM
   ref,
 ) => <span className={cn(s.wrapper, className)} {...restProps} ref={ref} />)
 
+Icon.displayName = 'MinimaxText'
+
 export default Icon

+ 2 - 0
web/app/components/base/icons/src/image/llm/Tongyi.tsx

@@ -10,4 +10,6 @@ const Icon = React.forwardRef<HTMLSpanElement, React.DetailedHTMLProps<React.HTM
   ref,
 ) => <span className={cn(s.wrapper, className)} {...restProps} ref={ref} />)
 
+Icon.displayName = 'Tongyi'
+
 export default Icon

+ 2 - 0
web/app/components/base/icons/src/image/llm/TongyiText.tsx

@@ -10,4 +10,6 @@ const Icon = React.forwardRef<HTMLSpanElement, React.DetailedHTMLProps<React.HTM
   ref,
 ) => <span className={cn(s.wrapper, className)} {...restProps} ref={ref} />)
 
+Icon.displayName = 'TongyiText'
+
 export default Icon

+ 2 - 0
web/app/components/base/icons/src/image/llm/TongyiTextCn.tsx

@@ -10,4 +10,6 @@ const Icon = React.forwardRef<HTMLSpanElement, React.DetailedHTMLProps<React.HTM
   ref,
 ) => <span className={cn(s.wrapper, className)} {...restProps} ref={ref} />)
 
+Icon.displayName = 'TongyiTextCn'
+
 export default Icon

+ 2 - 0
web/app/components/base/icons/src/image/llm/Wxyy.tsx

@@ -10,4 +10,6 @@ const Icon = React.forwardRef<HTMLSpanElement, React.DetailedHTMLProps<React.HTM
   ref,
 ) => <span className={cn(s.wrapper, className)} {...restProps} ref={ref} />)
 
+Icon.displayName = 'Wxyy'
+
 export default Icon

+ 2 - 0
web/app/components/base/icons/src/image/llm/WxyyText.tsx

@@ -10,4 +10,6 @@ const Icon = React.forwardRef<HTMLSpanElement, React.DetailedHTMLProps<React.HTM
   ref,
 ) => <span className={cn(s.wrapper, className)} {...restProps} ref={ref} />)
 
+Icon.displayName = 'WxyyText'
+
 export default Icon

+ 2 - 0
web/app/components/base/icons/src/image/llm/WxyyTextCn.tsx

@@ -10,4 +10,6 @@ const Icon = React.forwardRef<HTMLSpanElement, React.DetailedHTMLProps<React.HTM
   ref,
 ) => <span className={cn(s.wrapper, className)} {...restProps} ref={ref} />)
 
+Icon.displayName = 'WxyyTextCn'
+
 export default Icon

+ 1 - 0
web/app/components/base/icons/src/image/llm/index.ts

@@ -1,3 +1,4 @@
+export { default as BaichuanTextCn } from './BaichuanTextCn'
 export { default as MinimaxText } from './MinimaxText'
 export { default as Minimax } from './Minimax'
 export { default as TongyiTextCn } from './TongyiTextCn'

+ 76 - 0
web/app/components/base/icons/src/public/llm/Baichuan.json

@@ -0,0 +1,76 @@
+{
+	"icon": {
+		"type": "element",
+		"isRootNode": true,
+		"name": "svg",
+		"attributes": {
+			"width": "24",
+			"height": "24",
+			"viewBox": "0 0 24 24",
+			"fill": "none",
+			"xmlns": "http://www.w3.org/2000/svg"
+		},
+		"children": [
+			{
+				"type": "element",
+				"name": "g",
+				"attributes": {
+					"id": "Baichuan"
+				},
+				"children": [
+					{
+						"type": "element",
+						"name": "path",
+						"attributes": {
+							"id": "Union",
+							"fill-rule": "evenodd",
+							"clip-rule": "evenodd",
+							"d": "M8.58154 1.7793H5.52779L3.34655 6.20409V17.7335L0.916016 22.2206H6.21333L8.58154 17.7335V1.7793ZM10.5761 1.7793H15.8111V22.2206H10.5761V1.7793ZM22.9166 1.7793H17.6816V6.01712H22.9166V1.7793ZM22.9166 7.38818H17.6816V22.2206H22.9166V7.38818Z",
+							"fill": "url(#paint0_radial_11622_96084)"
+						},
+						"children": []
+					}
+				]
+			},
+			{
+				"type": "element",
+				"name": "defs",
+				"attributes": {},
+				"children": [
+					{
+						"type": "element",
+						"name": "radialGradient",
+						"attributes": {
+							"id": "paint0_radial_11622_96084",
+							"cx": "0",
+							"cy": "0",
+							"r": "1",
+							"gradientUnits": "userSpaceOnUse",
+							"gradientTransform": "translate(5.5 5.5) rotate(45) scale(20.5061 22.0704)"
+						},
+						"children": [
+							{
+								"type": "element",
+								"name": "stop",
+								"attributes": {
+									"stop-color": "#FEBD3F"
+								},
+								"children": []
+							},
+							{
+								"type": "element",
+								"name": "stop",
+								"attributes": {
+									"offset": "0.77608",
+									"stop-color": "#FF6933"
+								},
+								"children": []
+							}
+						]
+					}
+				]
+			}
+		]
+	},
+	"name": "Baichuan"
+}

+ 16 - 0
web/app/components/base/icons/src/public/llm/Baichuan.tsx

@@ -0,0 +1,16 @@
+// GENERATE BY script
+// DON NOT EDIT IT MANUALLY
+
+import * as React from 'react'
+import data from './Baichuan.json'
+import IconBase from '@/app/components/base/icons/IconBase'
+import type { IconBaseProps, IconData } from '@/app/components/base/icons/IconBase'
+
+const Icon = React.forwardRef<React.MutableRefObject<SVGElement>, Omit<IconBaseProps, 'data'>>((
+  props,
+  ref,
+) => <IconBase {...props} ref={ref} data={data as IconData} />)
+
+Icon.displayName = 'Baichuan'
+
+export default Icon

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 156 - 0
web/app/components/base/icons/src/public/llm/BaichuanText.json


+ 16 - 0
web/app/components/base/icons/src/public/llm/BaichuanText.tsx

@@ -0,0 +1,16 @@
+// GENERATE BY script
+// DON NOT EDIT IT MANUALLY
+
+import * as React from 'react'
+import data from './BaichuanText.json'
+import IconBase from '@/app/components/base/icons/IconBase'
+import type { IconBaseProps, IconData } from '@/app/components/base/icons/IconBase'
+
+const Icon = React.forwardRef<React.MutableRefObject<SVGElement>, Omit<IconBaseProps, 'data'>>((
+  props,
+  ref,
+) => <IconBase {...props} ref={ref} data={data as IconData} />)
+
+Icon.displayName = 'BaichuanText'
+
+export default Icon

+ 2 - 0
web/app/components/base/icons/src/public/llm/index.ts

@@ -4,6 +4,8 @@ export { default as AzureOpenaiServiceText } from './AzureOpenaiServiceText'
 export { default as AzureOpenaiService } from './AzureOpenaiService'
 export { default as AzureaiText } from './AzureaiText'
 export { default as Azureai } from './Azureai'
+export { default as BaichuanText } from './BaichuanText'
+export { default as Baichuan } from './Baichuan'
 export { default as ChatglmText } from './ChatglmText'
 export { default as Chatglm } from './Chatglm'
 export { default as Gpt3 } from './Gpt3'

+ 70 - 0
web/app/components/header/account-setting/model-page/configs/baichuan.tsx

@@ -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

+ 2 - 0
web/app/components/header/account-setting/model-page/configs/index.ts

@@ -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,
 }

+ 25 - 0
web/app/components/header/account-setting/model-page/configs/openllm.tsx

@@ -57,6 +57,31 @@ const config: ProviderConfig = {
     ],
     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',
         required: true,

+ 1 - 0
web/app/components/header/account-setting/model-page/declarations.ts

@@ -43,6 +43,7 @@ export enum ProviderEnum {
   'openllm' = 'openllm',
   'localai' = 'localai',
   'zhipuai' = 'zhipuai',
+  'baichuan' = 'baichuan',
 }
 
 export type ProviderConfigItem = {

+ 2 - 0
web/app/components/header/account-setting/model-page/index.tsx

@@ -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,