fix: 停止时消息内容变 undefined — 变量作用域问题
assistantContent/thinkContent/modelName 声明在 try 块内, catch 中访问不到导致全部为 undefined。 将声明提到 try 外部,catch 正常访问已生成内容。
This commit is contained in:
@@ -196,12 +196,13 @@ export async function sendMessage() {
|
||||
const systemPrompt = state.get(KEYS.SYSTEM_PROMPT);
|
||||
const numCtx = state.get(KEYS.NUM_CTX, 24576);
|
||||
|
||||
try {
|
||||
// 流式回复状态变量(声明在 try 外,catch 中也需要访问)
|
||||
let assistantContent = '';
|
||||
let thinkContent = '';
|
||||
let finalStats = null;
|
||||
let modelName = '';
|
||||
|
||||
try {
|
||||
const apiMessages = currentSession.messages.map(m => ({
|
||||
role: m.role,
|
||||
content: m.content || '',
|
||||
|
||||
Reference in New Issue
Block a user