This commit is contained in:
2025-10-13 17:09:39 +08:00
parent 347a7292cc
commit 104e7f566c
9 changed files with 376 additions and 230 deletions
+13 -2
View File
@@ -208,6 +208,12 @@ export class ChatController {
message
);
// 检查View是否仍然绑定,如果已解绑则不处理响应(用户可能已退出Panel)
if (!this.callback) {
logger.log("ChatController: View已解绑,忽略AI响应");
return false;
}
if (response) {
// 添加用户消息到模型
this.chatModel.addDialog(true, message);
@@ -232,7 +238,7 @@ export class ChatController {
return false;
}
} catch (error) {
ErrorHandler.Instance.handleApiError(
error,
"ChatController.sendMessage",
@@ -241,7 +247,12 @@ export class ChatController {
message: message.substring(0, 100) + "...",
}
);
this.handleError(error as Error);
// 只有当View仍然绑定时才调用错误处理回调
if (this.callback) {
this.handleError(error as Error);
} else {
logger.log("ChatController: View已解绑,不显示错误提示");
}
return false;
}
}