refactor: 优化错误提示信息
- 统一错误提示为用户友好的消息 - 调整代码风格保持一致性
This commit is contained in:
@ -307,8 +307,8 @@ async function handleUserMessageWithBackend(
|
||||
|
||||
onSegmentUpdate: (segments) => {
|
||||
// 过滤掉包含 [调用工具:xxx] 的段落
|
||||
const filteredSegments = segments.filter(seg => {
|
||||
if (seg.type === 'text' && typeof seg.content === 'string') {
|
||||
const filteredSegments = segments.filter((seg) => {
|
||||
if (seg.type === "text" && typeof seg.content === "string") {
|
||||
return !/\[调用工具:.+?\]/.test(seg.content);
|
||||
}
|
||||
return true;
|
||||
@ -427,7 +427,7 @@ async function handleUserMessageWithBackend(
|
||||
});
|
||||
panel.webview.postMessage({
|
||||
command: "receiveMessage",
|
||||
text: `❌ 错误: ${message}`,
|
||||
text: `❌ 服务繁忙,请稍后重试`,
|
||||
});
|
||||
// 恢复输入状态
|
||||
panel.webview.postMessage({
|
||||
@ -848,10 +848,10 @@ async function handleFileOperation(
|
||||
const errorMsg = error instanceof Error ? error.message : "操作失败";
|
||||
panel.webview.postMessage({
|
||||
command: "receiveMessage",
|
||||
text: `❌ ${errorMsg}`,
|
||||
text: `❌ 服务繁忙,请稍后重试`,
|
||||
});
|
||||
vscode.window.showErrorMessage(errorMsg);
|
||||
await historyManager.addAiMessage(`❌ ${errorMsg}`);
|
||||
await historyManager.addAiMessage(`❌ 服务繁忙,请稍后重试`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user