fix(vscode-ide-companion): optimize stream termination handling and fix style layering issues

This commit is contained in:
yiliang114
2025-12-15 23:41:36 +08:00
parent 54fd63f04b
commit 725843f9b3
2 changed files with 25 additions and 13 deletions

View File

@@ -144,10 +144,7 @@ export const InputForm: React.FC<InputFormProps> = ({
: '';
return (
<div
className="p-1 px-4 pb-4 absolute bottom-0 left-0 right-0"
style={{ backgroundColor: 'var(--app-primary-background)' }}
>
<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)]">
<div className="block">
<form className="composer-form" onSubmit={onSubmit}>
{/* Inner background layer */}

View File

@@ -439,19 +439,34 @@ export class SessionMessageHandler extends BaseMessageHandler {
} else {
const isTimeoutError =
lower.includes('timeout') || lower.includes('timed out');
if (!isTimeoutError) {
vscode.window.showErrorMessage(`Error sending message: ${error}`);
} else {
// 超时对用户没有可执行的操作,因此只在面板内重置信息,不弹出 VS Code 错误提醒
if (isTimeoutError) {
// 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.
console.warn(
'[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(isTimeoutError ? 'timeout' : 'error');
this.sendStreamEnd('error');
}
}
}
}