diff --git a/src/renderer/src/assets/json/chat-models.json b/src/renderer/src/assets/json/chat-models.json index 6ca8fcf..822ef41 100644 --- a/src/renderer/src/assets/json/chat-models.json +++ b/src/renderer/src/assets/json/chat-models.json @@ -84,8 +84,18 @@ ], "Tiangong": [{ "name": "SkyChat-MegaVerse", "value": "SkyChat-MegaVerse", "type": "text" }], "MoonshotAI": [ - { "name": "moonshot-v1-128k", "value": "moonshot-v1-128k", "type": "text" }, - { "name": "moonshot-v1-32k", "value": "moonshot-v1-32k", "type": "text" }, - { "name": "moonshot-v1-8k", "value": "moonshot-v1-8k", "type": "text" } + { + "name": "moonshot-v1-128k", + "value": "moonshot-v1-128k", + "type": "text", + "isSupportPlugin": true + }, + { + "name": "moonshot-v1-32k", + "value": "moonshot-v1-32k", + "type": "text", + "isSupportPlugin": true + }, + { "name": "moonshot-v1-8k", "value": "moonshot-v1-8k", "type": "text", "isSupportPlugin": true } ] } diff --git a/src/renderer/src/assets/json/drawing-models.json b/src/renderer/src/assets/json/drawing-models.json index d153620..129a340 100644 --- a/src/renderer/src/assets/json/drawing-models.json +++ b/src/renderer/src/assets/json/drawing-models.json @@ -5,5 +5,6 @@ ], "Tongyi": [{ "name": "wanx-v1", "value": "wanx-v1" }], "ERNIE": [{ "name": "stable-diffusion-xl", "value": "sd_xl" }], - "Spark": [{ "name": "tti-v2.1", "value": "tti-v2.1" }] + "Spark": [{ "name": "tti-v2.1", "value": "tti-v2.1" }], + "ZhipuAI": [{ "name": "cogview-3", "value": "cogview-3" }] } diff --git a/src/renderer/src/components/views/ai-calendar/AICalendar.vue b/src/renderer/src/components/views/ai-calendar/AICalendar.vue index f7a729d..3a741fe 100644 --- a/src/renderer/src/components/views/ai-calendar/AICalendar.vue +++ b/src/renderer/src/components/views/ai-calendar/AICalendar.vue @@ -225,12 +225,7 @@ const generateReport = async () => { } // 各家大模型特有选项 - // 各家大模型特有选项 - const otherOption = settingStore.getBigModelConfig( - settingStore.aiCalendar.bigModel.provider, - null, - null - ) + const otherOption = settingStore.getBigModelConfig(settingStore.aiCalendar.bigModel.provider) // 大模型能力调用 await chat2bigModel(settingStore.aiCalendar.bigModel.provider, { diff --git a/src/renderer/src/components/views/ai-drawing/AIDrawing.vue b/src/renderer/src/components/views/ai-drawing/AIDrawing.vue index d93d463..b0b9c08 100644 --- a/src/renderer/src/components/views/ai-drawing/AIDrawing.vue +++ b/src/renderer/src/components/views/ai-drawing/AIDrawing.vue @@ -54,30 +54,7 @@ const newDrawingTask = () => { // 开始生成 const startGenerate = () => { // 检查大模型配置 - let configErrorFlag = false - switch (drawingStore.getCurrentTask.provider) { - case 'OpenAI': - if (!settingStore.openAI.baseUrl || !settingStore.openAI.key) { - configErrorFlag = true - } - break - case 'Tongyi': - if (!settingStore.tongyi.apiKey) { - configErrorFlag = true - } - break - case 'ERNIE': - if (!settingStore.ernie.apiKey || !settingStore.ernie.secretKey) { - configErrorFlag = true - } - break - case 'Spark': - if (!settingStore.spark.appId || !settingStore.spark.secret || !settingStore.spark.key) { - configErrorFlag = true - } - break - } - if (configErrorFlag) { + if (settingStore.checkBigModelConfig(drawingStore.getCurrentTask.provider)) { Modal.confirm({ title: t('common.configError'), content: t(`chatWindow.configMiss.${drawingStore.getCurrentTask.provider}`), @@ -127,34 +104,9 @@ const startGenerate = () => { }, abortCtr: abortCtr } + // 各家大模型特有选项 - let otherOption = {} - switch (drawingStore.getCurrentTask.provider) { - case 'OpenAI': - otherOption = { - apiKey: settingStore.openAI.key, - baseURL: settingStore.openAI.baseUrl - } - break - case 'Tongyi': - otherOption = { - apiKey: settingStore.tongyi.apiKey - } - break - case 'ERNIE': - otherOption = { - apiKey: settingStore.ernie.apiKey, - secretKey: settingStore.ernie.secretKey - } - break - case 'Spark': - otherOption = { - appId: settingStore.spark.appId, - secretKey: settingStore.spark.secret, - apiKey: settingStore.spark.key - } - break - } + const otherOption = settingStore.getBigModelConfig(drawingStore.getCurrentTask.provider) // 调用能力 drawingByBigModel(drawingStore.getCurrentTask.provider, { diff --git a/src/renderer/src/components/views/ai-drawing/AIDrawingConsole.vue b/src/renderer/src/components/views/ai-drawing/AIDrawingConsole.vue index d9f5b6d..b270201 100644 --- a/src/renderer/src/components/views/ai-drawing/AIDrawingConsole.vue +++ b/src/renderer/src/components/views/ai-drawing/AIDrawingConsole.vue @@ -11,19 +11,8 @@ watch( () => drawingStore.getCurrentTask.provider, (value) => { drawingStore.getCurrentTask.options = {} - switch (value) { - case 'OpenAI': - drawingStore.getCurrentTask.model = 'dall-e-3' - break - case 'Spark': - drawingStore.getCurrentTask.model = 'tti-v2.1' - break - case 'Tongyi': - drawingStore.getCurrentTask.model = 'wanx-v1' - break - case 'ERNIE': - drawingStore.getCurrentTask.model = 'sd_xl' - break + if (drawingModels[value]) { + drawingStore.getCurrentTask.model = drawingModels[value][0].name } } ) @@ -85,7 +74,11 @@ watch( - +