mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
fix(vscode-ide-companion): optimize stream termination handling and fix style layering issues
This commit is contained in:
@@ -144,10 +144,7 @@ export const InputForm: React.FC<InputFormProps> = ({
|
|||||||
: '';
|
: '';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div className="p-1 px-4 pb-4 absolute bottom-0 left-0 right-0 bg-gradient-to-b from-transparent to-[var(--app-primary-background)]">
|
||||||
className="p-1 px-4 pb-4 absolute bottom-0 left-0 right-0"
|
|
||||||
style={{ backgroundColor: 'var(--app-primary-background)' }}
|
|
||||||
>
|
|
||||||
<div className="block">
|
<div className="block">
|
||||||
<form className="composer-form" onSubmit={onSubmit}>
|
<form className="composer-form" onSubmit={onSubmit}>
|
||||||
{/* Inner background layer */}
|
{/* Inner background layer */}
|
||||||
|
|||||||
@@ -439,19 +439,34 @@ export class SessionMessageHandler extends BaseMessageHandler {
|
|||||||
} else {
|
} else {
|
||||||
const isTimeoutError =
|
const isTimeoutError =
|
||||||
lower.includes('timeout') || lower.includes('timed out');
|
lower.includes('timeout') || lower.includes('timed out');
|
||||||
if (!isTimeoutError) {
|
if (isTimeoutError) {
|
||||||
vscode.window.showErrorMessage(`Error sending message: ${error}`);
|
// Timeout has no action for the user to perform, so only reset the information in the panel and no VS Code error alert will pop up.
|
||||||
} else {
|
|
||||||
// 超时对用户没有可执行的操作,因此只在面板内重置信息,不弹出 VS Code 错误提醒
|
|
||||||
console.warn(
|
console.warn(
|
||||||
'[SessionMessageHandler] Prompt timed out; suppressing popup',
|
'[SessionMessageHandler] Prompt timed out; suppressing popup',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const timeoutMessage: ChatMessage = {
|
||||||
|
role: 'assistant',
|
||||||
|
content:
|
||||||
|
'Request timed out (no response within 120 seconds). Please try again or simplify the request.',
|
||||||
|
timestamp: Date.now(),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Send a timeout message to the WebView without terminating the stream
|
||||||
|
// In this way, the long-term task can continue to receive subsequent messages after timeout.
|
||||||
|
this.sendToWebView({
|
||||||
|
type: 'message',
|
||||||
|
data: timeoutMessage,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Handling of Non-Timeout Errors
|
||||||
|
vscode.window.showErrorMessage(`Error sending message: ${error}`);
|
||||||
|
this.sendToWebView({
|
||||||
|
type: 'error',
|
||||||
|
data: { message: errorMsg },
|
||||||
|
});
|
||||||
|
this.sendStreamEnd('error');
|
||||||
}
|
}
|
||||||
this.sendToWebView({
|
|
||||||
type: 'error',
|
|
||||||
data: { message: errorMsg },
|
|
||||||
});
|
|
||||||
this.sendStreamEnd(isTimeoutError ? 'timeout' : 'error');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user