From 0be5350a1cf32d6b36cb1b80b8321400347a1db7 Mon Sep 17 00:00:00 2001
From: CGD <3030332422@qq.com>
Date: Tue, 8 Apr 2025 18:01:47 +0800
Subject: [PATCH 1/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=86=E2=80=9C?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A8=A1=E5=9E=8B=E2=80=9D=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=EF=BC=8C=E4=BD=BF=E5=85=B6=E8=83=BD=E5=A4=9F=E5=8A=A8=E6=80=81?=
=?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=88=B0=E8=B0=83=E7=94=A8=E4=BF=A1=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/components/ModelEditDialog.vue | 87 +++++++------------
main/manager-web/src/views/ModelConfig.vue | 2 +-
2 files changed, 33 insertions(+), 56 deletions(-)
diff --git a/main/manager-web/src/components/ModelEditDialog.vue b/main/manager-web/src/components/ModelEditDialog.vue
index a6a71a6d..dfffbda8 100644
--- a/main/manager-web/src/components/ModelEditDialog.vue
+++ b/main/manager-web/src/components/ModelEditDialog.vue
@@ -61,10 +61,11 @@
调用信息
-
+
-
@@ -129,6 +130,7 @@ export default {
dialogVisible: this.visible,
providers: [],
providersLoaded: false,
+ dynamicCallInfoFields: [],
form: {
id: "",
modelType: "",
@@ -144,53 +146,11 @@ export default {
};
},
computed: {
- callInfoFields() {
- const fieldsMap = {
- llm: [
- { label: '模型名称', prop: 'model_name', placeholder: '请输入model_name' },
- { label: '接口地址', prop: 'base_url', placeholder: '请输入base_url' },
- { label: '秘钥信息', prop: 'api_key', placeholder: '请输入api_key', type: 'password' }
- ],
- vad: [
- { label: '模型名称', prop: 'model_name', placeholder: '请输入model_name' },
- { label: '模型目录', prop: 'model_dir', placeholder: '请输入model_dir' },
- { label: '阈值', prop: 'threshold', placeholder: '请输入threshold' },
- { label: '静音时长', prop: 'min_silence_duration_ms', placeholder: '请输入min_silence_duration_ms' },
- { label: '接口地址', prop: 'base_url', placeholder: '请输入base_url' },
- { label: '秘钥信息', prop: 'api_key', placeholder: '请输入api_key', type: 'password' }
- ],
- asr: [
- { label: '模型名称', prop: 'model_name', placeholder: '请输入model_name' },
- { label: '集群', prop: 'cluster', placeholder: '请输入cluster' },
- { label: '接口地址', prop: 'base_url', placeholder: '请输入base_url' },
- { label: '秘钥信息', prop: 'api_key', placeholder: '请输入api_key', type: 'password' }
- ],
- intent: [
- { label: '模型名称', prop: 'model_name', placeholder: '请输入model_name' },
- { label: 'LLM模型', prop: 'llm', placeholder: '请输入llm' },
- { label: '接口地址', prop: 'base_url', placeholder: '请输入base_url' },
- { label: '秘钥信息', prop: 'api_key', placeholder: '请输入api_key', type: 'password' }
- ],
- tts: [
- { label: '模型名称', prop: 'model_name', placeholder: '请输入model_name' },
- { label: '语音ID', prop: 'voice_id', placeholder: '请输入voice_id' },
- { label: '接口地址', prop: 'base_url', placeholder: '请输入base_url' },
- { label: '秘钥信息', prop: 'api_key', placeholder: '请输入api_key', type: 'password' }
- ],
- memory: [
- { label: '模型名称', prop: 'model_name', placeholder: '请输入model_name' },
- { label: '接口地址', prop: 'base_url', placeholder: '请输入base_url' },
- { label: '秘钥信息', prop: 'api_key', placeholder: '请输入api_key', type: 'password' }
- ]
- };
-
- return fieldsMap[this.modelType] || [];
- },
chunkedCallInfoFields() {
const chunkSize = 2;
const result = [];
- for (let i = 0; i < this.callInfoFields.length; i += chunkSize) {
- result.push(this.callInfoFields.slice(i, i + chunkSize));
+ for (let i = 0; i < this.dynamicCallInfoFields.length; i += chunkSize) {
+ result.push(this.dynamicCallInfoFields.slice(i, i + chunkSize));
}
return result;
},
@@ -209,7 +169,12 @@ export default {
},
visible(val) {
this.dialogVisible = val;
+ },
+ 'form.configJson.type'(newVal) {
+ if (newVal) {
+ this.loadProviderFields(newVal);
}
+ }
},
methods: {
resetForm() {
@@ -230,19 +195,18 @@ export default {
this.providers = [];
this.providersLoaded = false;
},
- loadModelData() {
+ async loadModelData() {
if (this.modelData.id) {
- Api.model.getModelConfig(this.modelData.id, ({ data }) => {
+ Api.model.getModelConfig(this.modelData.id, async ({ data }) => {
if (data.code === 0 && data.data) {
const model = data.data;
- let configJson = model.configJson || {};
- if (typeof configJson !== 'object' || Array.isArray(configJson)) {
- console.warn('Invalid configJson format, using default');
- configJson = {};
- }
+ // 获取供应器字段配置
+ await this.loadProviderFields(model.configJson.type);
- this.callInfoFields.forEach(field => {
+ // 初始化configJson
+ let configJson = model.configJson || {};
+ this.dynamicCallInfoFields.forEach(field => {
if (!configJson.hasOwnProperty(field.prop)) {
configJson[field.prop] = '';
}
@@ -306,6 +270,19 @@ export default {
this.providersLoaded = true;
});
},
+ async loadProviderFields(providerCode) {
+ Api.model.getModelProviders(this.modelType, (data) => {
+ const provider = data.find(p => p.providerCode === providerCode);
+ if (provider) {
+ this.dynamicCallInfoFields = JSON.parse(provider.fields || '[]').map(f => ({
+ label: f.label,
+ prop: f.key,
+ type: f.type === 'password' ? 'password' : 'text',
+ placeholder: `请输入${f.label}`
+ }));
+ }
+ });
+ }
}
};
diff --git a/main/manager-web/src/views/ModelConfig.vue b/main/manager-web/src/views/ModelConfig.vue
index 71df5d2d..af60fef7 100644
--- a/main/manager-web/src/views/ModelConfig.vue
+++ b/main/manager-web/src/views/ModelConfig.vue
@@ -69,7 +69,7 @@
- {{ scope.row.configJson?.provider || '未知' }}
+ {{ scope.row.configJson.type || '未知' }}
From 0e81a165e4c6320829a32560c32aa84ac7873ba6 Mon Sep 17 00:00:00 2001
From: CGD <3030332422@qq.com>
Date: Wed, 9 Apr 2025 14:08:05 +0800
Subject: [PATCH 2/3] =?UTF-8?q?update:=E4=BC=98=E5=8C=96=E4=BA=86=E2=80=9C?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=85=8D=E7=BD=AE=E2=80=9D=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=E5=92=8C=E2=80=9C=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE=E2=80=9D?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2=EF=BC=8C=E4=BF=AE=E5=A4=8D=E4=BA=86=E2=80=9C?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=85=8D=E7=BD=AE=E2=80=9D=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=E9=9D=9E=E6=AD=A3=E5=B8=B8=E5=85=B3=E9=97=AD=E6=B7=BB=E5=8A=A0?=
=?UTF-8?q?=E5=AF=B9=E8=AF=9D=E6=A1=86=E6=97=B6=EF=BC=8C=E6=B2=A1=E6=9C=89?=
=?UTF-8?q?=E6=AD=A3=E7=A1=AE=E9=87=8D=E7=BD=AE=E5=AF=B9=E8=AF=9D=E6=A1=86?=
=?UTF-8?q?=E7=9A=84=E7=8A=B6=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/components/AddModelDialog.vue | 23 +++-
.../src/components/ModelEditDialog.vue | 109 +++++++++++-------
2 files changed, 84 insertions(+), 48 deletions(-)
diff --git a/main/manager-web/src/components/AddModelDialog.vue b/main/manager-web/src/components/AddModelDialog.vue
index 5c119da1..4e647381 100644
--- a/main/manager-web/src/components/AddModelDialog.vue
+++ b/main/manager-web/src/components/AddModelDialog.vue
@@ -1,5 +1,5 @@
-
@@ -63,7 +63,7 @@
调用信息
-
+
{
@@ -223,10 +238,6 @@ export default {
this.providerFields = [];
this.currentProvider = null;
},
- handleClose() {
- this.resetForm();
- this.$emit('update:visible', false);
- }
}
}
diff --git a/main/manager-web/src/components/ModelEditDialog.vue b/main/manager-web/src/components/ModelEditDialog.vue
index dfffbda8..36249ae7 100644
--- a/main/manager-web/src/components/ModelEditDialog.vue
+++ b/main/manager-web/src/components/ModelEditDialog.vue
@@ -44,7 +44,7 @@
-
+
@@ -61,7 +61,7 @@
调用信息
-
+
{
+ Api.model.getModelConfig(this.modelData.id, ({ data }) => {
if (data.code === 0 && data.data) {
const model = data.data;
+ this.pendingProviderType = model.configJson.type;
+ this.pendingModelData = model;
- // 获取供应器字段配置
- await this.loadProviderFields(model.configJson.type);
-
- // 初始化configJson
- let configJson = model.configJson || {};
- this.dynamicCallInfoFields.forEach(field => {
- if (!configJson.hasOwnProperty(field.prop)) {
- configJson[field.prop] = '';
- }
- });
-
- this.form = {
- id: model.id || "",
- modelType: model.modelType || "",
- modelCode: model.modelCode || "",
- modelName: model.modelName || "",
- isDefault: model.isDefault || 0,
- isEnabled: model.isEnabled || 0,
- docLink: model.docLink || "",
- remark: model.remark || "",
- sort: model.sort || 0,
- configJson: {
- ...JSON.parse(JSON.stringify(DEFAULT_CONFIG_JSON)),
- ...configJson,
- config: {
- ...DEFAULT_CONFIG_JSON.config,
- ...(configJson.config || {})
- }
- }
- };
+ if (this.providersLoaded) {
+ this.loadProviderFields(model.configJson.type);
+ } else {
+ this.loadProviders();
+ }
}
});
}
@@ -268,11 +252,17 @@ export default {
value: item.providerCode
}));
this.providersLoaded = true;
+
+ this.allProvidersData = data;
+
+ if (this.pendingProviderType) {
+ this.loadProviderFields(this.pendingProviderType);
+ }
});
},
- async loadProviderFields(providerCode) {
- Api.model.getModelProviders(this.modelType, (data) => {
- const provider = data.find(p => p.providerCode === providerCode);
+ loadProviderFields(providerCode) {
+ if (this.allProvidersData) {
+ const provider = this.allProvidersData.find(p => p.providerCode === providerCode);
if (provider) {
this.dynamicCallInfoFields = JSON.parse(provider.fields || '[]').map(f => ({
label: f.label,
@@ -280,9 +270,44 @@ export default {
type: f.type === 'password' ? 'password' : 'text',
placeholder: `请输入${f.label}`
}));
+
+ if (this.pendingModelData && this.pendingProviderType === providerCode) {
+ this.processModelData(this.pendingModelData);
+ this.pendingModelData = null;
+ this.pendingProviderType = null;
+ }
+ }
+ }
+ },
+ processModelData(model) {
+ let configJson = model.configJson || {};
+ this.dynamicCallInfoFields.forEach(field => {
+ if (!configJson.hasOwnProperty(field.prop)) {
+ configJson[field.prop] = '';
}
});
+
+ this.form = {
+ id: model.id || "",
+ modelType: model.modelType || "",
+ modelCode: model.modelCode || "",
+ modelName: model.modelName || "",
+ isDefault: model.isDefault || 0,
+ isEnabled: model.isEnabled || 0,
+ docLink: model.docLink || "",
+ remark: model.remark || "",
+ sort: Number(model.sort) || 0,
+ configJson: {
+ ...JSON.parse(JSON.stringify(DEFAULT_CONFIG_JSON)),
+ ...configJson,
+ config: {
+ ...DEFAULT_CONFIG_JSON.config,
+ ...(configJson.config || {})
+ }
+ }
+ };
}
+
}
};
From 137f29e9e5d6abe8c0a5c0ee4c4a57d1f82565d1 Mon Sep 17 00:00:00 2001
From: CGD <3030332422@qq.com>
Date: Wed, 9 Apr 2025 14:23:23 +0800
Subject: [PATCH 3/3] =?UTF-8?q?update:=E4=BC=98=E5=8C=96=E4=BA=86=E2=80=9C?=
=?UTF-8?q?=E6=A8=A1=E5=9E=8B=E9=85=8D=E7=BD=AE=E2=80=9D=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=E5=92=8C=E2=80=9C=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86=E2=80=9D?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=A0=B7=E5=BC=8F=EF=BC=8C=E5=AE=8C?=
=?UTF-8?q?=E5=96=84=E4=BA=86=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
main/manager-web/src/views/ModelConfig.vue | 22 +++++++++----------
main/manager-web/src/views/UserManagement.vue | 9 +++++++-
2 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/main/manager-web/src/views/ModelConfig.vue b/main/manager-web/src/views/ModelConfig.vue
index af60fef7..e437c7dd 100644
--- a/main/manager-web/src/views/ModelConfig.vue
+++ b/main/manager-web/src/views/ModelConfig.vue
@@ -4,16 +4,16 @@
模型配置
-
-
-
- 导入配置
-
-
-
- 导出配置
-
-
+
+
+
+
+
+
+
+
+
+
@@ -53,7 +53,7 @@
-
+
查询
diff --git a/main/manager-web/src/views/UserManagement.vue b/main/manager-web/src/views/UserManagement.vue
index 21d4c523..cc58b81b 100644
--- a/main/manager-web/src/views/UserManagement.vue
+++ b/main/manager-web/src/views/UserManagement.vue
@@ -5,7 +5,7 @@
用户管理
-
搜索
@@ -556,6 +556,13 @@ export default {
}
}
}
+:deep(.el-table .el-button--text) {
+ color: #7079aa !important;
+}
+
+:deep(.el-table .el-button--text:hover) {
+ color: #5a64b5 !important;
+}
:deep(.custom-selection-header) {
.el-checkbox {