diff --git a/domain/modelkit.go b/domain/modelkit.go
index f0f28bd..432bb84 100644
--- a/domain/modelkit.go
+++ b/domain/modelkit.go
@@ -403,7 +403,7 @@ func getSiliconFlowModels() []ModelMetadata {
{ModelName: "Qwen/Qwen3-Coder-30B-A3B-Instruct", Object: "model", Provider: consts.ModelProviderSiliconFlow, ModelType: consts.ModelTypeCoder},
}
}
-
+// 月之暗面模型
func getMoonshotModels() []ModelMetadata {
return []ModelMetadata{
{ModelName: "moonshot-v1-auto", Object: "model", Provider: consts.ModelProviderMoonshot, ModelType: consts.ModelTypeChat},
@@ -414,6 +414,7 @@ func getMoonshotModels() []ModelMetadata {
}
+// getAzureOpenAIModels 返回Azure OpenAI模型列表
func getAzureOpenAIModels() []ModelMetadata {
return []ModelMetadata{
{ModelName: "gpt-4", Object: "model", Provider: consts.ModelProviderAzureOpenAI, ModelType: consts.ModelTypeChat},
@@ -452,22 +453,22 @@ func getGeminiModels() []ModelMetadata {
func getZhiPuModels() []ModelMetadata {
return []ModelMetadata{
{ModelName: "glm-4.5", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
- {ModelName: "glm-4.5-x", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
+ // {ModelName: "glm-4.5-x", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
{ModelName: "glm-4.5-air", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
- {ModelName: "glm-4.5-airx", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
+ // {ModelName: "glm-4.5-airx", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
{ModelName: "glm-4.5-flash", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
- {ModelName: "glm-4-plus", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
- {ModelName: "glm-4-air-250414", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
- {ModelName: "glm-4-airx", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
- {ModelName: "glm-4-long", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
- {ModelName: "glm-4-flashx-250414", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
- {ModelName: "glm-4-flash-250414", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
- {ModelName: "glm-z1-air", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
- {ModelName: "glm-z1-airx", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
- {ModelName: "glm-z1-flashx", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
- {ModelName: "glm-z1-flash", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
- {ModelName: "glm-4v-plus-0111", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeVision},
- {ModelName: "glm-4v-flash", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeVision},
+ // {ModelName: "glm-4-plus", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
+ // {ModelName: "glm-4-air-250414", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
+ // {ModelName: "glm-4-airx", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
+ // {ModelName: "glm-4-long", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
+ // {ModelName: "glm-4-flashx-250414", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
+ // {ModelName: "glm-4-flash-250414", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
+ // {ModelName: "glm-z1-air", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
+ // {ModelName: "glm-z1-airx", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
+ // {ModelName: "glm-z1-flashx", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
+ // {ModelName: "glm-z1-flash", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeChat},
+ // {ModelName: "glm-4v-plus-0111", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeVision},
+ // {ModelName: "glm-4v-flash", Object: "model", Provider: consts.ModelProviderZhiPu, ModelType: consts.ModelTypeVision},
}
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
deleted file mode 100644
index 7aa65a7..0000000
--- a/pnpm-lock.yaml
+++ /dev/null
@@ -1,29 +0,0 @@
-lockfileVersion: '9.0'
-
-settings:
- autoInstallPeers: true
- excludeLinksFromLockfile: false
-
-importers:
-
- .:
- devDependencies:
- '@types/node':
- specifier: ^24.2.1
- version: 24.2.1
-
-packages:
-
- '@types/node@24.2.1':
- resolution: {integrity: sha512-DRh5K+ka5eJic8CjH7td8QpYEV6Zo10gfRkjHCO3weqZHWDtAaSTFtl4+VMqOJ4N5jcuhZ9/l+yy8rVgw7BQeQ==}
-
- undici-types@7.10.0:
- resolution: {integrity: sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==}
-
-snapshots:
-
- '@types/node@24.2.1':
- dependencies:
- undici-types: 7.10.0
-
- undici-types@7.10.0: {}
diff --git a/ui/ModelModal/README.md b/ui/ModelModal/README.md
index fde4ef4..8e97c2d 100644
--- a/ui/ModelModal/README.md
+++ b/ui/ModelModal/README.md
@@ -1,6 +1,6 @@
-# ModelKit UI
+# ModelModal
-一个基于 React 和 Material-UI 的模型管理组件库。
+一个用于管理AI模型配置的React组件,基于Material-UI构建。
## 安装
@@ -14,37 +14,90 @@ pnpm add @yokowu/modelkit-ui
## 使用方法
-### 基本使用
+### 基本用法
```tsx
-import React, { useState } from 'react';
-import { ModelAdd, ModelProvider } from '@yokowu/modelkit-ui';
+import React from 'react';
+import { ModelModal, ConstsModelType } from '@your-org/model-modal';
+import { ThemeProvider, createTheme } from '@mui/material/styles';
+
+// 创建主题时需要包含 paper2 背景色
+const theme = createTheme({
+ palette: {
+ background: {
+ default: '#fff',
+ paper: '#F1F2F8',
+ paper2: '#F8F9FA', // 重要:需要定义 paper2 背景色
+ },
+ },
+});
function App() {
- const [modalOpen, setModalOpen] = useState(false);
-
- const handleModalClose = () => {
- setModalOpen(false);
- };
-
- const handleRefresh = () => {
- // 刷新逻辑
+ const [open, setOpen] = React.useState(false);
+
+ const modelService = {
+ createModel: async (data) => {
+ // 实现创建模型的逻辑
+ return { model: {} };
+ },
+ listModel: async (data) => {
+ // 实现获取模型列表的逻辑
+ return { models: [] };
+ },
+ checkModel: async (data) => {
+ // 实现检查模型的逻辑
+ return { model: {} };
+ },
+ updateModel: async (data) => {
+ // 实现更新模型的逻辑
+ return { model: {} };
+ },
};
return (
-
-
+ setOpen(false)}
+ refresh={() => console.log('refresh')}
data={null}
- type="chat"
- onClose={handleModalClose}
- refresh={handleRefresh}
+ type={ConstsModelType.ModelTypeLLM}
+ modelService={modelService}
/>
-
+
);
}
+```
-export default App;
+### 主题配置
+
+为了确保组件样式正确显示,你需要在主题中定义 `background.paper2` 属性:
+
+```tsx
+import { createTheme } from '@mui/material/styles';
+import { mergeThemeWithDefaults } from '@your-org/model-modal';
+
+// 方法1:直接在主题中定义
+const theme = createTheme({
+ palette: {
+ background: {
+ default: '#fff',
+ paper: '#F1F2F8',
+ paper2: '#F8F9FA', // 必需
+ },
+ },
+});
+
+// 方法2:使用提供的合并工具
+const baseTheme = createTheme({
+ palette: {
+ primary: {
+ main: '#1976d2',
+ },
+ },
+});
+
+const theme = mergeThemeWithDefaults(baseTheme);
```
## 组件
diff --git a/ui/ModelModal/package.json b/ui/ModelModal/package.json
index c1803fe..7b0d7cb 100644
--- a/ui/ModelModal/package.json
+++ b/ui/ModelModal/package.json
@@ -1,6 +1,6 @@
{
"name": "@yokowu/modelkit-ui",
- "version": "0.2.0",
+ "version": "0.3.0",
"description": "A reusable AI model configuration modal component for React applications",
"private": false,
"type": "module",
@@ -55,7 +55,7 @@
},
"dependencies": {
"@c-x/ui": "^1.0.9",
- "@mui/material": "^7.3.1",
+ "@mui/material": "^6.4.12",
"react": "^19.1.0",
"react-activity-calendar": "^2.7.12",
"react-copy-to-clipboard": "^5.1.0",
@@ -66,6 +66,7 @@
"react-syntax-highlighter": "^15.6.1"
},
"devDependencies": {
+ "@types/node": "^24.2.1",
"@types/react": "^19.1.10",
"@types/react-dom": "^19.1.7",
"@vitejs/plugin-react": "^4.4.1",
diff --git a/ui/ModelModal/pnpm-lock.yaml b/ui/ModelModal/pnpm-lock.yaml
index bae97d6..7e8307d 100644
--- a/ui/ModelModal/pnpm-lock.yaml
+++ b/ui/ModelModal/pnpm-lock.yaml
@@ -10,10 +10,10 @@ importers:
dependencies:
'@c-x/ui':
specifier: ^1.0.9
- version: 1.0.9(f4d7aaa425137340707156a337dd7fe8)
+ version: 1.0.9(d7ef6141ca5ef333168542ae2595cf87)
'@mui/material':
- specifier: ^7.3.1
- version: 7.3.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
+ specifier: ^6.4.12
+ version: 6.5.0(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
react:
specifier: ^19.1.0
version: 19.1.1
@@ -39,6 +39,9 @@ importers:
specifier: ^15.6.1
version: 15.6.1(react@19.1.1)
devDependencies:
+ '@types/node':
+ specifier: ^24.2.1
+ version: 24.2.1
'@types/react':
specifier: ^19.1.10
version: 19.1.10
@@ -47,16 +50,16 @@ importers:
version: 19.1.7(@types/react@19.1.10)
'@vitejs/plugin-react':
specifier: ^4.4.1
- version: 4.7.0(vite@6.3.5)
+ version: 4.7.0(vite@6.3.5(@types/node@24.2.1))
axios:
specifier: ^1.11.0
version: 1.11.0
vite:
specifier: ^6.3.5
- version: 6.3.5
+ version: 6.3.5(@types/node@24.2.1)
vite-plugin-dts:
specifier: ^4.5.4
- version: 4.5.4(rollup@4.46.2)(typescript@5.8.2)(vite@6.3.5)
+ version: 4.5.4(@types/node@24.2.1)(rollup@4.46.2)(typescript@5.8.2)(vite@6.3.5(@types/node@24.2.1))
packages:
@@ -434,8 +437,8 @@ packages:
'@types/react':
optional: true
- '@mui/core-downloads-tracker@7.3.1':
- resolution: {integrity: sha512-+mIK1Z0BhOaQ0vCgOkT1mSrIpEHLo338h4/duuL4TBLXPvUMit732mnwJY3W40Avy30HdeSfwUAAGRkKmwRaEQ==}
+ '@mui/core-downloads-tracker@6.5.0':
+ resolution: {integrity: sha512-LGb8t8i6M2ZtS3Drn3GbTI1DVhDY6FJ9crEey2lZ0aN2EMZo8IZBZj9wRf4vqbZHaWjsYgtbOnJw5V8UWbmK2Q==}
'@mui/icons-material@6.5.0':
resolution: {integrity: sha512-VPuPqXqbBPlcVSA0BmnoE4knW4/xG6Thazo8vCLWkOKusko6DtwFV6B665MMWJ9j0KFohTIf3yx2zYtYacvG1g==}
@@ -466,13 +469,13 @@ packages:
'@types/react':
optional: true
- '@mui/material@7.3.1':
- resolution: {integrity: sha512-Xf6Shbo03YmcBedZMwSpEFOwpYDtU7tC+rhAHTrA9FHk0FpsDqiQ9jUa1j/9s3HLs7KWb5mDcGnlwdh9Q9KAag==}
+ '@mui/material@6.5.0':
+ resolution: {integrity: sha512-yjvtXoFcrPLGtgKRxFaH6OQPtcLPhkloC0BML6rBG5UeldR0nPULR/2E2BfXdo5JNV7j7lOzrrLX2Qf/iSidow==}
engines: {node: '>=14.0.0'}
peerDependencies:
'@emotion/react': ^11.5.0
'@emotion/styled': ^11.3.0
- '@mui/material-pigment-css': ^7.3.1
+ '@mui/material-pigment-css': ^6.5.0
'@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0
react: ^17.0.0 || ^18.0.0 || ^19.0.0
react-dom: ^17.0.0 || ^18.0.0 || ^19.0.0
@@ -496,16 +499,6 @@ packages:
'@types/react':
optional: true
- '@mui/private-theming@7.3.1':
- resolution: {integrity: sha512-WU3YLkKXii/x8ZEKnrLKsPwplCVE11yZxUvlaaZSIzCcI3x2OdFC8eMlNy74hVeUsYQvzzX1Es/k4ARPlFvpPQ==}
- engines: {node: '>=14.0.0'}
- peerDependencies:
- '@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0
- react: ^17.0.0 || ^18.0.0 || ^19.0.0
- peerDependenciesMeta:
- '@types/react':
- optional: true
-
'@mui/styled-engine@6.5.0':
resolution: {integrity: sha512-8woC2zAqF4qUDSPIBZ8v3sakj+WgweolpyM/FXf8jAx6FMls+IE4Y8VDZc+zS805J7PRz31vz73n2SovKGaYgw==}
engines: {node: '>=14.0.0'}
@@ -519,19 +512,6 @@ packages:
'@emotion/styled':
optional: true
- '@mui/styled-engine@7.3.1':
- resolution: {integrity: sha512-Nqo6OHjvJpXJ1+9TekTE//+8RybgPQUKwns2Lh0sq+8rJOUSUKS3KALv4InSOdHhIM9Mdi8/L7LTF1/Ky6D6TQ==}
- engines: {node: '>=14.0.0'}
- peerDependencies:
- '@emotion/react': ^11.4.1
- '@emotion/styled': ^11.3.0
- react: ^17.0.0 || ^18.0.0 || ^19.0.0
- peerDependenciesMeta:
- '@emotion/react':
- optional: true
- '@emotion/styled':
- optional: true
-
'@mui/system@6.5.0':
resolution: {integrity: sha512-XcbBYxDS+h/lgsoGe78ExXFZXtuIlSBpn/KsZq8PtZcIkUNJInkuDqcLd2rVBQrDC1u+rvVovdaWPf2FHKJf3w==}
engines: {node: '>=14.0.0'}
@@ -548,22 +528,6 @@ packages:
'@types/react':
optional: true
- '@mui/system@7.3.1':
- resolution: {integrity: sha512-mIidecvcNVpNJMdPDmCeoSL5zshKBbYPcphjuh6ZMjhybhqhZ4mX6k9zmIWh6XOXcqRQMg5KrcjnO0QstrNj3w==}
- engines: {node: '>=14.0.0'}
- peerDependencies:
- '@emotion/react': ^11.5.0
- '@emotion/styled': ^11.3.0
- '@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0
- react: ^17.0.0 || ^18.0.0 || ^19.0.0
- peerDependenciesMeta:
- '@emotion/react':
- optional: true
- '@emotion/styled':
- optional: true
- '@types/react':
- optional: true
-
'@mui/types@7.2.24':
resolution: {integrity: sha512-3c8tRt/CbWZ+pEg7QpSwbdxOk36EfmhbKf6AGZsD1EcLDLTSZoxxJ86FVtcjxvjuhdyBiWKSTGZFaXCnidO2kw==}
peerDependencies:
@@ -590,16 +554,6 @@ packages:
'@types/react':
optional: true
- '@mui/utils@7.3.1':
- resolution: {integrity: sha512-/31y4wZqVWa0jzMnzo6JPjxwP6xXy4P3+iLbosFg/mJQowL1KIou0LC+lquWW60FKVbKz5ZUWBg2H3jausa0pw==}
- engines: {node: '>=14.0.0'}
- peerDependencies:
- '@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0
- react: ^17.0.0 || ^18.0.0 || ^19.0.0
- peerDependenciesMeta:
- '@types/react':
- optional: true
-
'@popperjs/core@2.11.8':
resolution: {integrity: sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==}
@@ -773,6 +727,9 @@ packages:
'@types/ms@2.1.0':
resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==}
+ '@types/node@24.2.1':
+ resolution: {integrity: sha512-DRh5K+ka5eJic8CjH7td8QpYEV6Zo10gfRkjHCO3weqZHWDtAaSTFtl4+VMqOJ4N5jcuhZ9/l+yy8rVgw7BQeQ==}
+
'@types/parse-json@4.0.2':
resolution: {integrity: sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==}
@@ -901,8 +858,8 @@ packages:
resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==}
engines: {node: '>=6'}
- caniuse-lite@1.0.30001734:
- resolution: {integrity: sha512-uhE1Ye5vgqju6OI71HTQqcBCZrvHugk0MjLak7Q+HfoBgoq5Bi+5YnwjP4fjDgrtYr/l8MVRBvzz9dPD4KyK0A==}
+ caniuse-lite@1.0.30001735:
+ resolution: {integrity: sha512-EV/laoX7Wq2J9TQlyIXRxTJqIw4sxfXS4OYgudGxBYRuTv0q7AM6yMEpU/Vo1I94thg9U6EZ2NfZx9GJq83u7w==}
ccount@2.0.1:
resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==}
@@ -1657,6 +1614,9 @@ packages:
ufo@1.6.1:
resolution: {integrity: sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==}
+ undici-types@7.10.0:
+ resolution: {integrity: sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==}
+
unified@11.0.5:
resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==}
@@ -1884,14 +1844,14 @@ snapshots:
'@babel/helper-string-parser': 7.27.1
'@babel/helper-validator-identifier': 7.27.1
- '@c-x/ui@1.0.9(f4d7aaa425137340707156a337dd7fe8)':
+ '@c-x/ui@1.0.9(d7ef6141ca5ef333168542ae2595cf87)':
dependencies:
'@emotion/react': 11.14.0(@types/react@19.1.10)(react@19.1.1)
'@emotion/styled': 11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1)
- '@mui/icons-material': 6.5.0(@mui/material@7.3.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(@types/react@19.1.10)(react@19.1.1)
- '@mui/lab': 6.0.0-dev.240424162023-9968b4889d(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@mui/material@7.3.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
- '@mui/material': 7.3.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
- '@mui/utils': 7.3.1(@types/react@19.1.10)(react@19.1.1)
+ '@mui/icons-material': 6.5.0(@mui/material@6.5.0(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(@types/react@19.1.10)(react@19.1.1)
+ '@mui/lab': 6.0.0-dev.240424162023-9968b4889d(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@mui/material@6.5.0(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
+ '@mui/material': 6.5.0(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
+ '@mui/utils': 6.4.9(@types/react@19.1.10)(react@19.1.1)
react: 19.1.1
react-dom: 19.1.1(react@19.1.1)
react-virtuoso: 4.14.0(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
@@ -2094,23 +2054,23 @@ snapshots:
'@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.5.5
- '@microsoft/api-extractor-model@7.30.7':
+ '@microsoft/api-extractor-model@7.30.7(@types/node@24.2.1)':
dependencies:
'@microsoft/tsdoc': 0.15.1
'@microsoft/tsdoc-config': 0.17.1
- '@rushstack/node-core-library': 5.14.0
+ '@rushstack/node-core-library': 5.14.0(@types/node@24.2.1)
transitivePeerDependencies:
- '@types/node'
- '@microsoft/api-extractor@7.52.10':
+ '@microsoft/api-extractor@7.52.10(@types/node@24.2.1)':
dependencies:
- '@microsoft/api-extractor-model': 7.30.7
+ '@microsoft/api-extractor-model': 7.30.7(@types/node@24.2.1)
'@microsoft/tsdoc': 0.15.1
'@microsoft/tsdoc-config': 0.17.1
- '@rushstack/node-core-library': 5.14.0
+ '@rushstack/node-core-library': 5.14.0(@types/node@24.2.1)
'@rushstack/rig-package': 0.5.3
- '@rushstack/terminal': 0.15.4
- '@rushstack/ts-command-line': 5.0.2
+ '@rushstack/terminal': 0.15.4(@types/node@24.2.1)
+ '@rushstack/ts-command-line': 5.0.2(@types/node@24.2.1)
lodash: 4.17.21
minimatch: 10.0.3
resolve: 1.22.10
@@ -2143,21 +2103,21 @@ snapshots:
optionalDependencies:
'@types/react': 19.1.10
- '@mui/core-downloads-tracker@7.3.1': {}
+ '@mui/core-downloads-tracker@6.5.0': {}
- '@mui/icons-material@6.5.0(@mui/material@7.3.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(@types/react@19.1.10)(react@19.1.1)':
+ '@mui/icons-material@6.5.0(@mui/material@6.5.0(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(@types/react@19.1.10)(react@19.1.1)':
dependencies:
'@babel/runtime': 7.28.2
- '@mui/material': 7.3.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
+ '@mui/material': 6.5.0(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
react: 19.1.1
optionalDependencies:
'@types/react': 19.1.10
- '@mui/lab@6.0.0-dev.240424162023-9968b4889d(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@mui/material@7.3.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)':
+ '@mui/lab@6.0.0-dev.240424162023-9968b4889d(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@mui/material@6.5.0(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)':
dependencies:
'@babel/runtime': 7.28.2
'@mui/base': 5.0.0-beta.42(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
- '@mui/material': 7.3.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
+ '@mui/material': 6.5.0(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
'@mui/system': 6.5.0(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1)
'@mui/types': 7.4.5(@types/react@19.1.10)
'@mui/utils': 6.4.9(@types/react@19.1.10)(react@19.1.1)
@@ -2170,13 +2130,13 @@ snapshots:
'@emotion/styled': 11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1)
'@types/react': 19.1.10
- '@mui/material@7.3.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)':
+ '@mui/material@6.5.0(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)':
dependencies:
'@babel/runtime': 7.28.2
- '@mui/core-downloads-tracker': 7.3.1
- '@mui/system': 7.3.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1)
- '@mui/types': 7.4.5(@types/react@19.1.10)
- '@mui/utils': 7.3.1(@types/react@19.1.10)(react@19.1.1)
+ '@mui/core-downloads-tracker': 6.5.0
+ '@mui/system': 6.5.0(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1)
+ '@mui/types': 7.2.24(@types/react@19.1.10)
+ '@mui/utils': 6.4.9(@types/react@19.1.10)(react@19.1.1)
'@popperjs/core': 2.11.8
'@types/react-transition-group': 4.4.12(@types/react@19.1.10)
clsx: 2.1.1
@@ -2200,15 +2160,6 @@ snapshots:
optionalDependencies:
'@types/react': 19.1.10
- '@mui/private-theming@7.3.1(@types/react@19.1.10)(react@19.1.1)':
- dependencies:
- '@babel/runtime': 7.28.2
- '@mui/utils': 7.3.1(@types/react@19.1.10)(react@19.1.1)
- prop-types: 15.8.1
- react: 19.1.1
- optionalDependencies:
- '@types/react': 19.1.10
-
'@mui/styled-engine@6.5.0(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(react@19.1.1)':
dependencies:
'@babel/runtime': 7.28.2
@@ -2222,19 +2173,6 @@ snapshots:
'@emotion/react': 11.14.0(@types/react@19.1.10)(react@19.1.1)
'@emotion/styled': 11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1)
- '@mui/styled-engine@7.3.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(react@19.1.1)':
- dependencies:
- '@babel/runtime': 7.28.2
- '@emotion/cache': 11.14.0
- '@emotion/serialize': 1.3.3
- '@emotion/sheet': 1.4.0
- csstype: 3.1.3
- prop-types: 15.8.1
- react: 19.1.1
- optionalDependencies:
- '@emotion/react': 11.14.0(@types/react@19.1.10)(react@19.1.1)
- '@emotion/styled': 11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1)
-
'@mui/system@6.5.0(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1)':
dependencies:
'@babel/runtime': 7.28.2
@@ -2251,22 +2189,6 @@ snapshots:
'@emotion/styled': 11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1)
'@types/react': 19.1.10
- '@mui/system@7.3.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1)':
- dependencies:
- '@babel/runtime': 7.28.2
- '@mui/private-theming': 7.3.1(@types/react@19.1.10)(react@19.1.1)
- '@mui/styled-engine': 7.3.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(react@19.1.1)
- '@mui/types': 7.4.5(@types/react@19.1.10)
- '@mui/utils': 7.3.1(@types/react@19.1.10)(react@19.1.1)
- clsx: 2.1.1
- csstype: 3.1.3
- prop-types: 15.8.1
- react: 19.1.1
- optionalDependencies:
- '@emotion/react': 11.14.0(@types/react@19.1.10)(react@19.1.1)
- '@emotion/styled': 11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1)
- '@types/react': 19.1.10
-
'@mui/types@7.2.24(@types/react@19.1.10)':
optionalDependencies:
'@types/react': 19.1.10
@@ -2289,18 +2211,6 @@ snapshots:
optionalDependencies:
'@types/react': 19.1.10
- '@mui/utils@7.3.1(@types/react@19.1.10)(react@19.1.1)':
- dependencies:
- '@babel/runtime': 7.28.2
- '@mui/types': 7.4.5(@types/react@19.1.10)
- '@types/prop-types': 15.7.15
- clsx: 2.1.1
- prop-types: 15.8.1
- react: 19.1.1
- react-is: 19.1.1
- optionalDependencies:
- '@types/react': 19.1.10
-
'@popperjs/core@2.11.8': {}
'@rolldown/pluginutils@1.0.0-beta.27': {}
@@ -2373,7 +2283,7 @@ snapshots:
'@rollup/rollup-win32-x64-msvc@4.46.2':
optional: true
- '@rushstack/node-core-library@5.14.0':
+ '@rushstack/node-core-library@5.14.0(@types/node@24.2.1)':
dependencies:
ajv: 8.13.0
ajv-draft-04: 1.0.0(ajv@8.13.0)
@@ -2383,20 +2293,24 @@ snapshots:
jju: 1.4.0
resolve: 1.22.10
semver: 7.5.4
+ optionalDependencies:
+ '@types/node': 24.2.1
'@rushstack/rig-package@0.5.3':
dependencies:
resolve: 1.22.10
strip-json-comments: 3.1.1
- '@rushstack/terminal@0.15.4':
+ '@rushstack/terminal@0.15.4(@types/node@24.2.1)':
dependencies:
- '@rushstack/node-core-library': 5.14.0
+ '@rushstack/node-core-library': 5.14.0(@types/node@24.2.1)
supports-color: 8.1.1
+ optionalDependencies:
+ '@types/node': 24.2.1
- '@rushstack/ts-command-line@5.0.2':
+ '@rushstack/ts-command-line@5.0.2(@types/node@24.2.1)':
dependencies:
- '@rushstack/terminal': 0.15.4
+ '@rushstack/terminal': 0.15.4(@types/node@24.2.1)
'@types/argparse': 1.0.38
argparse: 1.0.10
string-argv: 0.3.2
@@ -2450,6 +2364,10 @@ snapshots:
'@types/ms@2.1.0': {}
+ '@types/node@24.2.1':
+ dependencies:
+ undici-types: 7.10.0
+
'@types/parse-json@4.0.2': {}
'@types/prop-types@15.7.15': {}
@@ -2472,7 +2390,7 @@ snapshots:
'@ungap/structured-clone@1.3.0': {}
- '@vitejs/plugin-react@4.7.0(vite@6.3.5)':
+ '@vitejs/plugin-react@4.7.0(vite@6.3.5(@types/node@24.2.1))':
dependencies:
'@babel/core': 7.28.0
'@babel/plugin-transform-react-jsx-self': 7.27.1(@babel/core@7.28.0)
@@ -2480,7 +2398,7 @@ snapshots:
'@rolldown/pluginutils': 1.0.0-beta.27
'@types/babel__core': 7.20.5
react-refresh: 0.17.0
- vite: 6.3.5
+ vite: 6.3.5(@types/node@24.2.1)
transitivePeerDependencies:
- supports-color
@@ -2585,7 +2503,7 @@ snapshots:
browserslist@4.25.2:
dependencies:
- caniuse-lite: 1.0.30001734
+ caniuse-lite: 1.0.30001735
electron-to-chromium: 1.5.200
node-releases: 2.0.19
update-browserslist-db: 1.1.3(browserslist@4.25.2)
@@ -2597,7 +2515,7 @@ snapshots:
callsites@3.1.0: {}
- caniuse-lite@1.0.30001734: {}
+ caniuse-lite@1.0.30001735: {}
ccount@2.0.1: {}
@@ -3497,6 +3415,8 @@ snapshots:
ufo@1.6.1: {}
+ undici-types@7.10.0: {}
+
unified@11.0.5:
dependencies:
'@types/unist': 3.0.3
@@ -3552,9 +3472,9 @@ snapshots:
'@types/unist': 3.0.3
vfile-message: 4.0.3
- vite-plugin-dts@4.5.4(rollup@4.46.2)(typescript@5.8.2)(vite@6.3.5):
+ vite-plugin-dts@4.5.4(@types/node@24.2.1)(rollup@4.46.2)(typescript@5.8.2)(vite@6.3.5(@types/node@24.2.1)):
dependencies:
- '@microsoft/api-extractor': 7.52.10
+ '@microsoft/api-extractor': 7.52.10(@types/node@24.2.1)
'@rollup/pluginutils': 5.2.0(rollup@4.46.2)
'@volar/typescript': 2.4.23
'@vue/language-core': 2.2.0(typescript@5.8.2)
@@ -3565,13 +3485,13 @@ snapshots:
magic-string: 0.30.17
typescript: 5.8.2
optionalDependencies:
- vite: 6.3.5
+ vite: 6.3.5(@types/node@24.2.1)
transitivePeerDependencies:
- '@types/node'
- rollup
- supports-color
- vite@6.3.5:
+ vite@6.3.5(@types/node@24.2.1):
dependencies:
esbuild: 0.25.9
fdir: 6.4.6(picomatch@4.0.3)
@@ -3580,6 +3500,7 @@ snapshots:
rollup: 4.46.2
tinyglobby: 0.2.14
optionalDependencies:
+ '@types/node': 24.2.1
fsevents: 2.3.3
vscode-uri@3.1.0: {}
diff --git a/ui/ModelModal/src/ModelModal.tsx b/ui/ModelModal/src/ModelModal.tsx
index c75d156..a50b2af 100644
--- a/ui/ModelModal/src/ModelModal.tsx
+++ b/ui/ModelModal/src/ModelModal.tsx
@@ -12,7 +12,7 @@ import {
Checkbox,
FormControlLabel,
} from '@mui/material';
-import { Icon, message, Modal } from '@c-x/ui';
+import { Icon, message, Modal, ThemeProvider } from '@c-x/ui';
import Card from './components/card';
import React, { useEffect, useState } from 'react';
import { useForm, Controller } from 'react-hook-form';
@@ -21,11 +21,13 @@ import {
Model,
ConstsModelType,
ModelModalProps,
-} from './types';
+} from './types/types';
import { DEFAULT_MODEL_PROVIDERS } from './constants/providers';
-import { getTitleMap } from './constants/locale';
import { ModelProvider } from './constants/providers';
+import { mergeThemeWithDefaults } from './constants/theme';
+import { getLocaleMessage } from './constants/locale';
import './assets/fonts/iconfont';
+import { lightTheme } from './theme';
const titleMap = {
[ConstsModelType.ModelTypeLLM]: '对话模型',
@@ -42,6 +44,7 @@ export const ModelModal: React.FC = ({
data,
type = ConstsModelType.ModelTypeLLM,
modelService,
+ language = 'zh-CN',
}: ModelModalProps) => {
const theme = useTheme();
@@ -299,12 +302,14 @@ export const ModelModal: React.FC = ({
}, [data, open]);
return (
+
= ({
fullWidth
variant='outlined'
loading={modelLoading}
- sx={{ mt: 4 }}
+ sx={{
+ mt: 4,
+ borderRadius: '10px',
+ boxShadow: 'none',
+ fontFamily: `var(--font-gilory), var(--font-HarmonyOS), 'PingFang SC', 'Roboto', 'Helvetica', 'Arial', sans-serif`,
+ color: 'black',
+ borderColor: 'black'
+ }}
onClick={handleSubmit(getModel)}
>
获取模型列表
@@ -642,147 +654,149 @@ export const ModelModal: React.FC = ({
>
)}
- {/* 高级设置部分 */}
-
-
+ )}
+ {/* 高级设置部分 - 在选择了模型或者是其它供应商时显示 */}
+ {(modelUserList.length !== 0 || providerBrand === 'Other') && (
+
+ setExpandAdvanced(!expandAdvanced)}
+ >
+ setExpandAdvanced(!expandAdvanced)}
>
-
- 高级设置
-
-
-
-
-
- 上下文窗口大小
-
- (
- <>
- field.onChange(Number(e.target.value))}
- />
-
- {[
- { label: '128k', value: 128000 },
- { label: '256k', value: 256000 },
- { label: '512k', value: 512000 },
- { label: '1m', value: 1_000_000 }
- ].map((option) => (
- field.onChange(option.value)}
- >
- {option.label}
-
- ))}
-
- >
- )}
- />
+ 高级设置
+
+
+
+
+
+ 上下文窗口大小
-
-
-
- 最大输出 Token
-
- (
+ (
+ <>
field.onChange(Number(e.target.value))}
/>
- )}
- />
+
+ {[
+ { label: '128k', value: 128000 },
+ { label: '256k', value: 256000 },
+ { label: '512k', value: 512000 },
+ { label: '1m', value: 1_000_000 }
+ ].map((option) => (
+ field.onChange(option.value)}
+ >
+ {option.label}
+
+ ))}
+
+ >
+ )}
+ />
+
+
+
+
+ 最大输出 Token
-
- {/* 复选框组 - 使用更紧凑的布局 */}
-
- (
- field.onChange(e.target.checked)}
- size='small'
- />
- }
- label={
-
- 启用 R1 模型参数
-
- (使用 QWQ 等 R1 系列模型时必须启用,避免出现 400 错误)
-
+ (
+ field.onChange(Number(e.target.value))}
+ />
+ )}
+ />
+
+
+ {/* 复选框组 - 使用更紧凑的布局 */}
+
+ (
+ field.onChange(e.target.checked)}
+ size='small'
+ />
+ }
+ label={
+
+ 启用 R1 模型参数
+
+ (使用 QWQ 等 R1 系列模型时必须启用,避免出现 400 错误)
- }
- sx={{ margin: 0 }}
- />
- )}
- />
-
+
+ }
+ sx={{ margin: 0 }}
+ />
+ )}
+ />
-
-
-
- >
- )}
+
+
+
+
+ )}
{error && (
= ({
+
);
};
diff --git a/ui/ModelModal/src/api/Model.ts b/ui/ModelModal/src/api/Model.ts
deleted file mode 100644
index b52db83..0000000
--- a/ui/ModelModal/src/api/Model.ts
+++ /dev/null
@@ -1,244 +0,0 @@
-import request, { ContentType, RequestParams } from "./httpClient";
-import {
- DeleteDeleteModelParams,
- DomainAllModelResp,
- DomainCheckModelReq,
- DomainCreateModelReq,
- DomainGetProviderModelListResp,
- DomainModel,
- DomainModelTokenUsageResp,
- DomainUpdateModelReq,
- GetGetProviderModelListParams,
- GetGetTokenUsageParams,
- GetMyModelListParams,
- WebResp,
-} from "../types";
-
-/**
- * @description 获取模型列表
- *
- * @tags Model
- * @name GetListModel
- * @summary 获取模型列表
- * @request GET:/api/v1/model
- * @response `200` `(WebResp & {
- data?: DomainAllModelResp,
-
-})` OK
- */
-
-export const getListModel = (params: RequestParams = {}) =>
- request<
- WebResp & {
- data?: DomainAllModelResp;
- }
- >({
- path: `/api/v1/model`,
- method: "GET",
- type: ContentType.Json,
- format: "json",
- ...params,
- });
-
-/**
- * @description 更新模型
- *
- * @tags Model
- * @name PutUpdateModel
- * @summary 更新模型
- * @request PUT:/api/v1/model
- * @response `200` `(WebResp & {
- data?: DomainModel,
-
-})` OK
- */
-
-export const putUpdateModel = (
- model: DomainUpdateModelReq,
- params: RequestParams = {},
-) =>
- request<
- WebResp & {
- data?: DomainModel;
- }
- >({
- path: `/api/v1/model`,
- method: "PUT",
- body: model,
- type: ContentType.Json,
- format: "json",
- ...params,
- });
-
-/**
- * @description 创建模型
- *
- * @tags Model
- * @name PostCreateModel
- * @summary 创建模型
- * @request POST:/api/v1/model
- * @response `200` `(WebResp & {
- data?: DomainModel,
-
-})` OK
- */
-
-export const postCreateModel = (
- model: DomainCreateModelReq,
- params: RequestParams = {},
-) =>
- request<
- WebResp & {
- data?: DomainModel;
- }
- >({
- path: `/api/v1/model`,
- method: "POST",
- body: model,
- type: ContentType.Json,
- format: "json",
- ...params,
- });
-
-/**
- * @description 删除模型
- *
- * @tags Model
- * @name DeleteDeleteModel
- * @summary 删除模型
- * @request DELETE:/api/v1/model
- * @response `200` `WebResp` OK
- */
-
-export const deleteDeleteModel = (
- query: DeleteDeleteModelParams,
- params: RequestParams = {},
-) =>
- request({
- path: `/api/v1/model`,
- method: "DELETE",
- query: query,
- type: ContentType.Json,
- format: "json",
- ...params,
- });
-
-/**
- * @description 检查模型
- *
- * @tags Model
- * @name PostCheckModel
- * @summary 检查模型
- * @request POST:/api/v1/model/check
- * @response `200` `(WebResp & {
- data?: DomainModel,
-
-})` OK
- */
-
-export const postCheckModel = (
- model: DomainCheckModelReq,
- params: RequestParams = {},
-) =>
- request<
- WebResp & {
- data?: DomainModel;
- }
- >({
- path: `/api/v1/model/check`,
- method: "POST",
- body: model,
- type: ContentType.Json,
- format: "json",
- ...params,
- });
-
-/**
- * @description 获取我的模型列表
- *
- * @tags Model
- * @name GetMyModelList
- * @summary 获取我的模型列表
- * @request GET:/api/v1/model/my
- * @response `200` `(WebResp & {
- data?: (DomainModel)[],
-
-})` OK
- */
-
-export const getMyModelList = (
- query: GetMyModelListParams,
- params: RequestParams = {},
-) =>
- request<
- WebResp & {
- data?: DomainModel[];
- }
- >({
- path: `/api/v1/model/my`,
- method: "GET",
- query: query,
- type: ContentType.Json,
- format: "json",
- ...params,
- });
-
-/**
- * @description 获取供应商支持的模型列表
- *
- * @tags Model
- * @name GetGetProviderModelList
- * @summary 获取供应商支持的模型列表
- * @request GET:/api/v1/model/provider/supported
- * @response `200` `(WebResp & {
- data?: DomainGetProviderModelListResp,
-
-})` OK
- */
-
-export const getGetProviderModelList = (
- query: GetGetProviderModelListParams,
- params: RequestParams = {},
-) =>
- request<
- WebResp & {
- data?: DomainGetProviderModelListResp;
- }
- >({
- path: `/api/v1/model/provider/supported`,
- method: "GET",
- query: query,
- type: ContentType.Json,
- format: "json",
- ...params,
- });
-
-/**
- * @description 获取模型token使用情况
- *
- * @tags Model
- * @name GetGetTokenUsage
- * @summary 获取模型token使用情况
- * @request GET:/api/v1/model/token-usage
- * @response `200` `(WebResp & {
- data?: DomainModelTokenUsageResp,
-
-})` OK
- */
-
-export const getGetTokenUsage = (
- query: GetGetTokenUsageParams,
- params: RequestParams = {},
-) =>
- request<
- WebResp & {
- data?: DomainModelTokenUsageResp;
- }
- >({
- path: `/api/v1/model/token-usage`,
- method: "GET",
- query: query,
- type: ContentType.Json,
- format: "json",
- ...params,
- });
diff --git a/ui/ModelModal/src/api/httpClient.ts b/ui/ModelModal/src/api/httpClient.ts
deleted file mode 100644
index 9e6c0c4..0000000
--- a/ui/ModelModal/src/api/httpClient.ts
+++ /dev/null
@@ -1,217 +0,0 @@
-import { message as Message } from "@c-x/ui";
-import type {
- AxiosInstance,
- AxiosRequestConfig,
- HeadersDefaults,
- ResponseType,
-} from "axios";
-import axios from "axios";
-
-export type QueryParamsType = Record;
-
-export interface FullRequestParams
- extends Omit {
- /** set parameter to `true` for call `securityWorker` for this request */
- secure?: boolean;
- /** request path */
- path: string;
- /** content type of request body */
- type?: ContentType;
- /** query params */
- query?: QueryParamsType;
- /** format of response (i.e. response.json() -> format: "json") */
- format?: ResponseType;
- /** request body */
- body?: unknown;
-}
-
-export type RequestParams = Omit<
- FullRequestParams,
- "body" | "method" | "query" | "path"
->;
-
-export interface ApiConfig
- extends Omit {
- securityWorker?: (
- securityData: SecurityDataType | null,
- ) => Promise | AxiosRequestConfig | void;
- secure?: boolean;
- format?: ResponseType;
-}
-
-export enum ContentType {
- Json = "application/json",
- FormData = "multipart/form-data",
- UrlEncoded = "application/x-www-form-urlencoded",
- Text = "text/plain",
-}
-
-const whitePathnameList = ["/user/login", "/login", "/auth", "/invite"];
-const whiteApiList = ["/api/v1/user/profile", "/api/v1/admin/profile"];
-
-const redirectToLogin = () => {
- const redirectAfterLogin = encodeURIComponent(location.href);
- const search = `redirect=${redirectAfterLogin}`;
- const pathname = location.pathname.startsWith("/user")
- ? "/login"
- : "/login/admin";
- window.location.href = `${pathname}`;
-};
-
-type ExtractDataProp = T extends { data?: infer U } ? U : never;
-
-export class HttpClient {
- public instance: AxiosInstance;
- private securityData: SecurityDataType | null = null;
- private securityWorker?: ApiConfig["securityWorker"];
- private secure?: boolean;
- private format?: ResponseType;
-
- constructor({
- securityWorker,
- secure,
- format,
- ...axiosConfig
- }: ApiConfig = {}) {
- this.instance = axios.create({
- withCredentials: true,
- ...axiosConfig,
- baseURL: axiosConfig.baseURL || "",
- });
- this.secure = secure;
- this.format = format;
- this.securityWorker = securityWorker;
- this.instance.interceptors.response.use(
- (resp) => {
- if (resp.data.code === 0) {
- return resp.data.data;
- } else {
- Message.error(resp.data.message);
- return Promise.reject(resp.data.message);
- }
- },
- (err) => {
- if (err?.response?.status === 401) {
- if (
- whitePathnameList.find((item) => location.pathname.startsWith(item))
- ) {
- return Promise.reject("尚未登录");
- }
- Message.error("尚未登录");
- redirectToLogin();
- return Promise.reject("尚未登录");
- }
- // 手动取消请求
- if (err.code === "ERR_CANCELED") {
- return;
- }
- const msg = err?.response?.data?.message || err?.message;
- Message.error(msg);
- return Promise.reject(msg);
- },
- );
- }
-
- public setSecurityData = (data: SecurityDataType | null) => {
- this.securityData = data;
- };
-
- protected mergeRequestParams(
- params1: AxiosRequestConfig,
- params2?: AxiosRequestConfig,
- ): AxiosRequestConfig {
- const method = params1.method || (params2 && params2.method);
-
- return {
- ...this.instance.defaults,
- ...params1,
- ...(params2 || {}),
- headers: {
- ...((method &&
- this.instance.defaults.headers[
- method.toLowerCase() as keyof HeadersDefaults
- ]) ||
- {}),
- ...(params1.headers || {}),
- ...((params2 && params2.headers) || {}),
- },
- };
- }
-
- protected stringifyFormItem(formItem: unknown) {
- if (typeof formItem === "object" && formItem !== null) {
- return JSON.stringify(formItem);
- } else {
- return `${formItem}`;
- }
- }
-
- protected createFormData(input: Record): FormData {
- return Object.keys(input || {}).reduce((formData, key) => {
- const property = input[key];
- const propertyContent: any[] =
- property instanceof Array ? property : [property];
-
- for (const formItem of propertyContent) {
- const isFileType = formItem instanceof Blob || formItem instanceof File;
- formData.append(
- key,
- isFileType ? formItem : this.stringifyFormItem(formItem),
- );
- }
-
- return formData;
- }, new FormData());
- }
-
- public request = async ({
- secure,
- path,
- type,
- query,
- format,
- body,
- ...params
- }: FullRequestParams): Promise> => {
- const secureParams =
- ((typeof secure === "boolean" ? secure : this.secure) &&
- this.securityWorker &&
- (await this.securityWorker(this.securityData))) ||
- {};
- const requestParams = this.mergeRequestParams(params, secureParams);
- const responseFormat = format || this.format || undefined;
-
- if (
- type === ContentType.FormData &&
- body &&
- body !== null &&
- typeof body === "object"
- ) {
- body = this.createFormData(body as Record);
- }
-
- if (
- type === ContentType.Text &&
- body &&
- body !== null &&
- typeof body !== "string"
- ) {
- body = JSON.stringify(body);
- }
-
- return this.instance.request({
- ...requestParams,
- headers: {
- ...(requestParams.headers || {}),
- ...(type && type !== ContentType.FormData
- ? { "Content-Type": type }
- : {}),
- },
- params: query,
- responseType: responseFormat,
- data: body,
- url: path,
- });
- };
-}
-export default new HttpClient({ format: "json" }).request;
diff --git a/ui/ModelModal/src/assets/fonts/iconfont.js b/ui/ModelModal/src/assets/fonts/iconfont.js
index 8c442a5..3013a34 100644
--- a/ui/ModelModal/src/assets/fonts/iconfont.js
+++ b/ui/ModelModal/src/assets/fonts/iconfont.js
@@ -1 +1 @@
-window._iconfont_svg_string_4940939='',(l=>{var a=(c=(c=document.getElementsByTagName("script"))[c.length-1]).getAttribute("data-injectcss"),c=c.getAttribute("data-disable-injectsvg");if(!c){var h,t,i,o,m,e=function(a,c){c.parentNode.insertBefore(a,c)};if(a&&!l.__iconfont__svg__cssinject__){l.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(a){console&&console.log(a)}}h=function(){var a,c=document.createElement("div");c.innerHTML=l._iconfont_svg_string_4940939,(c=c.getElementsByTagName("svg")[0])&&(c.setAttribute("aria-hidden","true"),c.style.position="absolute",c.style.width=0,c.style.height=0,c.style.overflow="hidden",c=c,(a=document.body).firstChild?e(c,a.firstChild):a.appendChild(c))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(h,0):(t=function(){document.removeEventListener("DOMContentLoaded",t,!1),h()},document.addEventListener("DOMContentLoaded",t,!1)):document.attachEvent&&(i=h,o=l.document,m=!1,s(),o.onreadystatechange=function(){"complete"==o.readyState&&(o.onreadystatechange=null,d())})}function d(){m||(m=!0,i())}function s(){try{o.documentElement.doScroll("left")}catch(a){return void setTimeout(s,50)}d()}})(window);
\ No newline at end of file
+window._iconfont_svg_string_4856251='',(c=>{var a=(l=(l=document.getElementsByTagName("script"))[l.length-1]).getAttribute("data-injectcss"),l=l.getAttribute("data-disable-injectsvg");if(!l){var h,i,o,t,p,v=function(a,l){l.parentNode.insertBefore(a,l)};if(a&&!c.__iconfont__svg__cssinject__){c.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(a){console&&console.log(a)}}h=function(){var a,l=document.createElement("div");l.innerHTML=c._iconfont_svg_string_4856251,(l=l.getElementsByTagName("svg")[0])&&(l.setAttribute("aria-hidden","true"),l.style.position="absolute",l.style.width=0,l.style.height=0,l.style.overflow="hidden",l=l,(a=document.body).firstChild?v(l,a.firstChild):a.appendChild(l))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(h,0):(i=function(){document.removeEventListener("DOMContentLoaded",i,!1),h()},document.addEventListener("DOMContentLoaded",i,!1)):document.attachEvent&&(o=h,t=c.document,p=!1,d(),t.onreadystatechange=function(){"complete"==t.readyState&&(t.onreadystatechange=null,z())})}function z(){p||(p=!0,o())}function d(){try{t.documentElement.doScroll("left")}catch(a){return void setTimeout(d,50)}z()}})(window);
\ No newline at end of file
diff --git a/ui/ModelModal/src/assets/images/logo.png b/ui/ModelModal/src/assets/images/logo.png
new file mode 100644
index 0000000..da96d16
Binary files /dev/null and b/ui/ModelModal/src/assets/images/logo.png differ
diff --git a/ui/ModelModal/src/assets/images/nodata.png b/ui/ModelModal/src/assets/images/nodata.png
new file mode 100644
index 0000000..8a289bd
Binary files /dev/null and b/ui/ModelModal/src/assets/images/nodata.png differ
diff --git a/ui/ModelModal/src/assets/images/qrcode.png b/ui/ModelModal/src/assets/images/qrcode.png
new file mode 100644
index 0000000..803314a
Binary files /dev/null and b/ui/ModelModal/src/assets/images/qrcode.png differ
diff --git a/ui/ModelModal/src/components/card/index.tsx b/ui/ModelModal/src/components/card/index.tsx
index 33ec1b8..885c1ad 100644
--- a/ui/ModelModal/src/components/card/index.tsx
+++ b/ui/ModelModal/src/components/card/index.tsx
@@ -1,10 +1,11 @@
import { styled } from '@mui/material';
+import type { Theme } from '@mui/material/styles';
+import type { ComponentType } from 'react';
-// @ts-ignore TS2742: Inferred type cannot be named without a reference
-const StyledCard = styled('div')(({ theme }) => ({
- padding: theme!.spacing(2),
- borderRadius: theme!.shape.borderRadius * 2.5,
- backgroundColor: theme!.palette.background.default,
+const StyledCard: ComponentType = styled('div')<{}>(({ theme }: { theme: Theme }) => ({
+ padding: theme.spacing(2),
+ borderRadius: theme.shape.borderRadius * 2.5,
+ backgroundColor: theme.palette.background.default,
}));
-export default StyledCard;
+export default StyledCard;
\ No newline at end of file
diff --git a/ui/ModelModal/src/constants/locale.ts b/ui/ModelModal/src/constants/locale.ts
index 4d550c9..8ba8992 100644
--- a/ui/ModelModal/src/constants/locale.ts
+++ b/ui/ModelModal/src/constants/locale.ts
@@ -18,7 +18,7 @@ export const LOCALE_MESSAGES: Record<'zh-CN' | 'en-US', Record>
'header': 'Header',
'save': '保存',
'cancel': '取消',
- 'getModelList': '获取模型列表',
+ 'getModelList': '获取模型列表1',
'viewDocumentation': '查看文档',
// 验证消息
diff --git a/ui/ModelModal/src/constants/providers.ts b/ui/ModelModal/src/constants/providers.ts
index 4a0009a..cdc41b1 100644
--- a/ui/ModelModal/src/constants/providers.ts
+++ b/ui/ModelModal/src/constants/providers.ts
@@ -1,4 +1,4 @@
-import { ModelProviderMap } from '../types';
+import { ModelProviderMap } from '../types/types';
// 默认模型提供商配置
export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
@@ -12,6 +12,16 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
modelDocumentUrl: 'https://model-square.app.baizhi.cloud/token',
defaultBaseUrl: 'https://model-square.app.baizhi.cloud/v1',
},
+ ZhiPu: {
+ label: 'ZhiPu',
+ cn: '智谱',
+ icon: 'icon-zhipuqingyan', // 需要添加对应的图标
+ urlWrite: false,
+ secretRequired: true,
+ customHeader: false,
+ modelDocumentUrl: 'https://open.bigmodel.cn/usercenter/apikeys',
+ defaultBaseUrl: 'https://open.bigmodel.cn/api/paas/v4',
+ },
DeepSeek: {
label: 'DeepSeek',
cn: 'DeepSeek',
diff --git a/ui/ModelModal/src/constants/theme.ts b/ui/ModelModal/src/constants/theme.ts
new file mode 100644
index 0000000..a660924
--- /dev/null
+++ b/ui/ModelModal/src/constants/theme.ts
@@ -0,0 +1,253 @@
+import { createTheme } from '@mui/material/styles';
+import type { Shadows } from '@mui/material';
+import { zhCN } from '@mui/material/locale';
+import { zhCN as CuiZhCN } from '@c-x/ui/dist/local';
+import onData from '@/assets/images/nodata.png';
+
+const defaultTheme = createTheme();
+// 默认主题配置,确保与UI项目主题一致
+export const defaultModelModalTheme = createTheme({
+ cssVariables: true,
+ palette: {
+ // mode: 'light',
+ primary: {
+ main: '#21222D',
+ },
+ error: {
+ main: '#F64E54',
+ },
+ success: {
+ main: '#35B37E',
+ light: '#AAF27F',
+ dark: '#229A16',
+ contrastText: '#fff',
+ },
+ warning: {
+ main: '#FFA500',
+ },
+ info: {
+ main: '#3248F2',
+ },
+ risk: {
+ severe: '#FF6262',
+ critical: '#FFA762',
+ suggest: '#FFCF62'
+ },
+ disabled: {
+ main: '#666',
+ },
+ dark: {
+ dark: '#000',
+ main: '#14141B',
+ light: '#20232A',
+ contrastText: '#fff',
+ },
+ light: {
+ main: '#fff',
+ contrastText: '#000',
+ },
+ background: {
+ default: '#fff',
+ paper: '#F1F2F8',
+ },
+ text: {
+ primary: '#21222D',
+ secondary: 'rgba(33,34,45, 0.7)',
+ tertiary: 'rgba(33,34,45, 0.5)',
+ // @ts-ignore
+ auxiliary: 'rgba(33,34,45, 0.5)',
+ disabled: 'rgba(33,34,45, 0.2)',
+ },
+ // divider: '#ECEEF1',
+ },
+ shadows: [
+ ...defaultTheme.shadows.slice(0, 8),
+ '0px 10px 20px 0px rgba(54,59,76,0.2)',
+ ...defaultTheme.shadows.slice(9),
+ ] as Shadows,
+ components: {
+ MuiPaper: {
+ styleOverrides: {
+ root: {
+ backgroundColor: '#fff',
+ backgroundImage: 'none',
+ },
+ },
+ },
+
+ MuiInputBase: {
+ styleOverrides: {
+ root: {
+ backgroundColor: '#F8F9FA',
+ fontFamily: `var(--font-gilory), var(--font-HarmonyOS), 'PingFang SC',
+ 'Roboto', 'Helvetica', 'Arial', sans-serif`,
+ '.MuiOutlinedInput-notchedOutline': {
+ borderColor: 'transparent',
+ },
+ '&.Mui-focused .MuiOutlinedInput-notchedOutline': {
+ borderColor: '#21222D !important',
+ borderWidth: '10px !important',
+ },
+ borderRadius: '10px !important',
+ fontSize: 14,
+ },
+ },
+ },
+
+ MuiTypography: {
+ styleOverrides: {
+ root: {
+ fontFamily: `var(--font-gilory), var(--font-HarmonyOS), 'PingFang SC',
+ 'Roboto', 'Helvetica', 'Arial', sans-serif`,
+ },
+ },
+ },
+ MuiButtonBase: {
+ styleOverrides: {
+ root: {
+ // lineHeight: '1.5',
+ fontFamily: `var(--font-gilory), var(--font-HarmonyOS), 'PingFang SC',
+ 'Roboto', 'Helvetica', 'Arial', sans-serif`,
+ },
+ },
+ },
+ MuiButton: {
+ styleOverrides: {
+ root: {
+ // lineHeight: '1.5',
+ borderRadius: '10px',
+ boxShadow: 'none',
+ fontFamily: `var(--font-gilory), var(--font-HarmonyOS), 'PingFang SC',
+ 'Roboto', 'Helvetica', 'Arial', sans-serif`,
+ },
+ },
+ },
+ // @ts-ignore
+ MuiLoadingButton: {
+ styleOverrides: {
+ root: {
+ lineHeight: '1.5',
+ borderRadius: '10px',
+ },
+ },
+ },
+ MuiInputLabel: {
+ styleOverrides: {
+ root: {
+ fontSize: 14,
+ },
+ },
+ },
+ MuiMenu: {
+ styleOverrides: {
+ paper: {
+ borderRadius: '10px',
+ },
+ },
+ },
+ MuiMenuItem: {
+ styleOverrides: {
+ root: {
+ fontFamily: 'var(--font-gilory), var(--font-HarmonyOS)',
+ fontSize: '14px',
+ },
+ },
+ },
+ MuiAutocomplete: {
+ defaultProps: {
+ slotProps: {
+ paper: {
+ elevation: 8,
+ },
+ },
+ },
+ styleOverrides: {
+ paper: {
+ borderRadius: '10px',
+ },
+ option: {
+ fontSize: '14px',
+ fontFamily: 'var(--font-gilory), var(--font-HarmonyOS)',
+ },
+ },
+ },
+ MuiFormLabel: {
+ styleOverrides: {
+ root: {
+ fontFamily: 'var(--font-gilory), var(--font-HarmonyOS)',
+ },
+ asterisk: {
+ color: '#F64E54',
+ },
+ },
+ },
+ MuiLink: {
+ styleOverrides: {
+ root: {
+ textDecoration: 'none',
+ },
+ },
+ },
+ MuiTableCell: {
+ styleOverrides: {
+ root: {
+ borderColor: '#eee',
+ paddingLeft: '24px !important',
+ fontFamily: 'var(--font-gilory), var(--font-HarmonyOS)',
+ padding: '25px 12px 26px !important',
+ '&:first-of-type': {
+ paddingLeft: '16px !important',
+ },
+ },
+ head: {
+ paddingTop: '0 !important',
+ paddingBottom: '0 !important',
+ height: '50px',
+ backgroundColor: '#f8f9fa',
+ borderBottom: 'none !important',
+ },
+ body: {
+ borderBottom: '1px dashed',
+ borderColor: '#ECEEF1',
+ },
+ },
+ },
+ },
+ },
+ zhCN,
+ CuiZhCN,
+ {
+ components: {
+ CuiEmpty: {
+ defaultProps: {
+ image: onData,
+ imageStyle: {
+ width: '150px',
+ },
+ },
+ },
+ },
+
+});
+
+// 主题合并工具函数 - 以用户自定义主题为主
+// 深度合并函数
+const deepMerge = (target: any, source: any): any => {
+ const result = { ...target };
+
+ for (const key in source) {
+ if (source.hasOwnProperty(key)) {
+ if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {
+ result[key] = deepMerge(target[key] || {}, source[key]);
+ } else {
+ result[key] = source[key];
+ }
+ }
+ }
+
+ return result;
+};
+
+export const mergeThemeWithDefaults = (userTheme: any) => {
+ return deepMerge(defaultModelModalTheme, userTheme);
+};
\ No newline at end of file
diff --git a/ui/ModelModal/src/index.ts b/ui/ModelModal/src/index.ts
index 51c9cba..814318b 100644
--- a/ui/ModelModal/src/index.ts
+++ b/ui/ModelModal/src/index.ts
@@ -2,14 +2,17 @@
export { ModelModal } from './ModelModal';
// 类型定义
-export type { ModelType, Model, ModelParam, ConstsModelStatus, ConstsModelProvider, ModelProviderConfig, ModelProviderMap, CreateModelReq as CreateModelData, ListModelReq as GetModelNameData, CheckModelReq as CheckModelData, UpdateModelReq as UpdateModelData, ModelService, ModelListItem, AddModelForm, ModelModalProps } from './types';
+export type { ModelType, Model, ModelParam, ConstsModelStatus, ConstsModelProvider, ModelProviderConfig, ModelProviderMap, CreateModelReq as CreateModelData, ListModelReq as GetModelNameData, CheckModelReq as CheckModelData, UpdateModelReq as UpdateModelData, ModelService, ModelListItem, AddModelForm, ModelModalProps } from './types/types';
// 导出 ConstsModelType 枚举值
-export { ConstsModelType } from './types';
+export { ConstsModelType } from './types/types';
// 常量
export { DEFAULT_MODEL_PROVIDERS, getProvidersByType } from './constants/providers';
export { LOCALE_MESSAGES, getLocaleMessage, getTitleMap } from './constants/locale';
+export * from './constants/theme';
+
+// 主题类型声明会通过TypeScript自动包含
// 工具函数
export {
@@ -59,7 +62,7 @@ export const DEFAULT_CONFIG = {
export const createModelModal = (defaultConfig: Partial = {}) => {
const mergedConfig = { ...DEFAULT_CONFIG, ...defaultConfig };
- return (props: Omit) => {
+ return (props: Omit) => {
return {
...props,
config: mergedConfig,
diff --git a/ui/ModelModal/src/theme.ts b/ui/ModelModal/src/theme.ts
new file mode 100644
index 0000000..e97ed30
--- /dev/null
+++ b/ui/ModelModal/src/theme.ts
@@ -0,0 +1,237 @@
+'use client';
+import { createTheme, Paper } from '@mui/material';
+import type { Shadows } from '@mui/material';
+import { zhCN } from '@mui/material/locale';
+import { zhCN as CuiZhCN } from '@c-x/ui/dist/local';
+import onData from '@/assets/images/nodata.png';
+import { common } from '@mui/material/colors';
+
+const defaultTheme = createTheme();
+
+const lightTheme = createTheme(
+ {
+ cssVariables: true,
+ palette: {
+ // mode: 'light',
+ primary: {
+ main: '#21222D',
+ },
+ error: {
+ main: '#F64E54',
+ },
+ success: {
+ main: '#35B37E',
+ light: '#AAF27F',
+ dark: '#229A16',
+ contrastText: '#fff',
+ },
+ warning: {
+ main: '#FFA500',
+ },
+ info: {
+ main: '#3248F2',
+ },
+ risk: {
+ severe: '#FF6262',
+ critical: '#FFA762',
+ suggest: '#FFCF62'
+ },
+ disabled: {
+ main: '#666',
+ },
+ dark: {
+ dark: '#000',
+ main: '#14141B',
+ light: '#20232A',
+ contrastText: '#fff',
+ },
+ light: {
+ main: '#fff',
+ contrastText: '#000',
+ },
+ background: {
+ default: '#fff',
+ paper: '#F1F2F8',
+ },
+
+ text: {
+ primary: '#21222D',
+ secondary: 'rgba(33,34,45, 0.7)',
+ tertiary: 'rgba(33,34,45, 0.5)',
+ // @ts-ignore
+ auxiliary: 'rgba(33,34,45, 0.5)',
+ disabled: 'rgba(33,34,45, 0.2)',
+ },
+ // divider: '#ECEEF1',
+ },
+ shadows: [
+ ...defaultTheme.shadows.slice(0, 8),
+ '0px 10px 20px 0px rgba(54,59,76,0.2)',
+ ...defaultTheme.shadows.slice(9),
+ ] as Shadows,
+ components: {
+ MuiPaper: {
+ styleOverrides: {
+ root: {
+ backgroundColor: '#fff',
+ backgroundImage: 'none',
+ },
+ },
+ },
+
+ MuiInputBase: {
+ styleOverrides: {
+ root: {
+ backgroundColor: '#F8F9FA',
+ fontFamily: `var(--font-gilory), var(--font-HarmonyOS), 'PingFang SC',
+ 'Roboto', 'Helvetica', 'Arial', sans-serif`,
+ '.MuiOutlinedInput-notchedOutline': {
+ borderColor: 'transparent',
+ },
+ '&.Mui-focused .MuiOutlinedInput-notchedOutline': {
+ borderColor: '#21222D !important',
+ borderWidth: '1px !important',
+ },
+ borderRadius: '10px !important',
+ fontSize: 14,
+ },
+ },
+ },
+
+ MuiTypography: {
+ styleOverrides: {
+ root: {
+ fontFamily: `var(--font-gilory), var(--font-HarmonyOS), 'PingFang SC',
+ 'Roboto', 'Helvetica', 'Arial', sans-serif`,
+ },
+ },
+ },
+ MuiButtonBase: {
+ styleOverrides: {
+ root: {
+ // lineHeight: '1.5',
+ fontFamily: `var(--font-gilory), var(--font-HarmonyOS), 'PingFang SC',
+ 'Roboto', 'Helvetica', 'Arial', sans-serif`,
+ },
+ },
+ },
+ MuiButton: {
+ styleOverrides: {
+ root: {
+ // lineHeight: '1.5',
+ borderRadius: '10px',
+ boxShadow: 'none',
+ fontFamily: `var(--font-gilory), var(--font-HarmonyOS), 'PingFang SC',
+ 'Roboto', 'Helvetica', 'Arial', sans-serif`,
+ },
+ },
+ },
+ // @ts-ignore
+ MuiLoadingButton: {
+ styleOverrides: {
+ root: {
+ lineHeight: '1.5',
+ borderRadius: '10px',
+ },
+ },
+ },
+ MuiInputLabel: {
+ styleOverrides: {
+ root: {
+ fontSize: 14,
+ },
+ },
+ },
+ MuiMenu: {
+ styleOverrides: {
+ paper: {
+ borderRadius: '10px',
+ },
+ },
+ },
+ MuiMenuItem: {
+ styleOverrides: {
+ root: {
+ fontFamily: 'var(--font-gilory), var(--font-HarmonyOS)',
+ fontSize: '14px',
+ },
+ },
+ },
+ MuiAutocomplete: {
+ defaultProps: {
+ slotProps: {
+ paper: {
+ elevation: 8,
+ },
+ },
+ },
+ styleOverrides: {
+ paper: {
+ borderRadius: '10px',
+ },
+ option: {
+ fontSize: '14px',
+ fontFamily: 'var(--font-gilory), var(--font-HarmonyOS)',
+ },
+ },
+ },
+ MuiFormLabel: {
+ styleOverrides: {
+ root: {
+ fontFamily: 'var(--font-gilory), var(--font-HarmonyOS)',
+ },
+ asterisk: {
+ color: '#F64E54',
+ },
+ },
+ },
+ MuiLink: {
+ styleOverrides: {
+ root: {
+ textDecoration: 'none',
+ },
+ },
+ },
+ MuiTableCell: {
+ styleOverrides: {
+ root: {
+ borderColor: '#eee',
+ paddingLeft: '24px !important',
+ fontFamily: 'var(--font-gilory), var(--font-HarmonyOS)',
+ padding: '25px 12px 26px !important',
+ '&:first-of-type': {
+ paddingLeft: '16px !important',
+ },
+ },
+ head: {
+ paddingTop: '0 !important',
+ paddingBottom: '0 !important',
+ height: '50px',
+ backgroundColor: '#f8f9fa',
+ borderBottom: 'none !important',
+ },
+ body: {
+ borderBottom: '1px dashed',
+ borderColor: '#ECEEF1',
+ },
+ },
+ },
+ },
+ },
+ zhCN,
+ CuiZhCN,
+ {
+ components: {
+ CuiEmpty: {
+ defaultProps: {
+ image: onData,
+ imageStyle: {
+ width: '150px',
+ },
+ },
+ },
+ },
+ }
+);
+
+export { lightTheme };
diff --git a/ui/ModelModal/src/types/theme.d.ts b/ui/ModelModal/src/types/theme.d.ts
new file mode 100644
index 0000000..79fa6b5
--- /dev/null
+++ b/ui/ModelModal/src/types/theme.d.ts
@@ -0,0 +1,48 @@
+///
+
+import type { PaletteColorChannel } from '@mui/material';
+
+declare module '@mui/material/styles' {
+ interface TypeText {
+ tertiary: string;
+ auxiliary: string;
+ }
+
+ interface TypeBackground {
+ paper2: string;
+ }
+
+ interface Palette {
+ light: Palette['primary'] & PaletteColorChannel;
+ dark: Palette['primary'] & PaletteColorChannel;
+ disabled: Palette['primary'] & PaletteColorChannel;
+ risk: {
+ severe: string;
+ critical: string;
+ suggest: string;
+ };
+ }
+
+ // allow configuration using `createTheme`
+ interface PaletteOptions {
+ light?: PaletteOptions['primary'] & Partial;
+ dark?: PaletteOptions['primary'] & Partial;
+ disabled?: PaletteOptions['primary'] & Partial;
+ risk?: {
+ severe?: string;
+ critical?: string;
+ suggest?: string;
+ };
+ text?: Partial;
+ background?: Partial;
+ }
+}
+
+declare module '@mui/material/Button' {
+ interface ButtonPropsColorOverrides {
+ light: true;
+ dark: true;
+ }
+}
+
+import type {} from '@mui/material/themeCssVarsAugmentation';
\ No newline at end of file
diff --git a/ui/ModelModal/src/types/index.ts b/ui/ModelModal/src/types/types.ts
similarity index 99%
rename from ui/ModelModal/src/types/index.ts
rename to ui/ModelModal/src/types/types.ts
index e421913..da0323c 100644
--- a/ui/ModelModal/src/types/index.ts
+++ b/ui/ModelModal/src/types/types.ts
@@ -232,4 +232,5 @@ export interface ModelModalProps {
onClose: () => void;
refresh: () => void;
modelService: ModelService;
+ language?: 'zh-CN' | 'en-US';
}
diff --git a/ui/ModelModal/src/vite-env.d.ts b/ui/ModelModal/src/vite-env.d.ts
new file mode 100644
index 0000000..e88820e
--- /dev/null
+++ b/ui/ModelModal/src/vite-env.d.ts
@@ -0,0 +1,35 @@
+///
+
+import type { PaletteColorChannel } from '@mui/material';
+declare module '@mui/material/styles' {
+ interface TypeText {
+ tertiary: string;
+ }
+
+ interface TypeBackground {
+ paper2: string;
+ }
+
+ interface Palette {
+ light: Palette['primary'] & PaletteColorChannel;
+ dark: Palette['primary'] & PaletteColorChannel;
+ disabled: Palette['primary'] & PaletteColorChannel;
+ }
+
+ // allow configuration using `createTheme`
+ interface PaletteOptions {
+ light?: PaletteOptions['primary'] & Partial;
+ dark?: PaletteOptions['primary'] & Partial;
+ disabled?: PaletteOptions['primary'] & Partial;
+ text?: Partial;
+ background?: Partial;
+ }
+}
+declare module '@mui/material/Button' {
+ interface ButtonPropsColorOverrides {
+ light: true;
+ dark: true;
+ }
+}
+
+import type {} from '@mui/material/themeCssVarsAugmentation';
diff --git a/usecase/modelkit.go b/usecase/modelkit.go
index 02a3ec0..c967899 100644
--- a/usecase/modelkit.go
+++ b/usecase/modelkit.go
@@ -39,6 +39,7 @@ func ModelList(ctx context.Context, req *domain.ModelListReq) (*domain.ModelList
}
switch provider := consts.ModelProvider(req.Provider); provider {
case consts.ModelProviderAzureOpenAI,
+ consts.ModelProviderZhiPu,
consts.ModelProviderVolcengine:
return &domain.ModelListResp{
Models: domain.From(domain.ModelProviders[provider]),