diff --git a/electron/main/ipc.ts b/electron/main/ipc.ts index b5a3469..8a59f4a 100644 --- a/electron/main/ipc.ts +++ b/electron/main/ipc.ts @@ -322,9 +322,14 @@ ${extras?.maxScore ?? 100} timeout: ((getStore().get('timeout') as number) ?? 120) * 1000 }) - const content = response.data.choices[0].message.content + const content = response.data?.choices?.[0]?.message?.content + if (!content) { + log.error('AI API 返回为空或格式异常:', JSON.stringify(response.data).slice(0, 1000)) + throw new Error(`API 返回为空,请检查模型名是否正确 (当前: ${config.model})`) + } const parsed = tryParseJson(content) if (!parsed) { + log.error('AI 返回 JSON 解析失败:', content.slice(0, 500)) throw new Error(`AI 返回格式异常,无法解析为 JSON。原始返回:\n${content}`) } return { diff --git a/electron/main/window.ts b/electron/main/window.ts index ff4a13d..2ca0bac 100644 --- a/electron/main/window.ts +++ b/electron/main/window.ts @@ -61,7 +61,7 @@ export function openDialogWindow(type: string): BrowserWindow | null { settings: { width: 520, height: 560 }, history: { width: 800, height: 600 }, templates: { width: 640, height: 520 }, - rubric: { width: 520, height: 480 }, + rubric: { width: 640, height: 700 }, result: { width: 440, height: 560 } } const size = sizes[type] || { width: 500, height: 500 } diff --git a/src/components/RubricEditor.vue b/src/components/RubricEditor.vue index cc2c18a..6c89756 100644 --- a/src/components/RubricEditor.vue +++ b/src/components/RubricEditor.vue @@ -130,5 +130,7 @@ function handleClose() { border: 1px solid #e4e7ed; border-radius: 6px; padding: 16px; + max-height: 480px; + overflow-y: auto; } \ No newline at end of file