AI正在处理中,请稍候... at DeepseekChatManager.sendMessage (file:///E:/SteamLibrary/steam...
🚨 错误信息
Error: AI正在处理中,请稍候...
at DeepseekChatManager.sendMessage (file:///E:/SteamLibrary/steamapps/common/MeijuStory_Demo/resources/app.asar/src/js/core/DeepseekChatManager.js:1:29431)
at UISystem.sendChatPanelMessage (file:///E:/SteamLibrary/steamapps/common/MeijuStory_Demo/resources/app.asar/src/js/systems/UISystem.js:1:67224)
at async UISystem.handleChatPanelSend (file:///E:/SteamLibrary/steamapps/common/MeijuStory_Demo/resources/app.asar/src/js/systems/UISystem.js:1:65544)
🤖 AI解决方案
报错分析报告
1.错误翻译
原文:Error: AI is being processed, please wait...
译文:错误:AI正在处理中,请稍候...
2. 原因分析
DeepseekChatManager.sendMessage方法(文件:DeepseekChatManager.js:1:29431) UISystem.handleChatPanelSend→sendChatPanelMessage→sendMessage,异步流程未做状态拦截3. 解决方案
javascript
// 修复后的状态管理代码(以DeepseekChatManager为例)
class DeepseekChatManager {
constructor() {
this.isProcessing = false; // 新增处理状态锁
} async sendMessage(message) {
if (this.isProcessing) {
throw new Error("AI正在处理中,请稍候...");
}
this.isProcessing = true;
try {
// 原AI请求逻辑(示例)
const response = await fetch("/api/ai", { method: "POST", body: JSON.stringify({ message }) });
return await response.json();
} finally {
this.isProcessing = false; // 确保状态释放
}
}
}
4. 预防措施
p-queue库)缓存后续请求,按顺序执行 Promise状态管理或浏览器AbortController取消过期请求 ---
注:修复需同步更新调用处(如UISystem)的状态检查逻辑。