feat(vscode-ide-companion): add cancel streaming functionality

- Add handleCancel callback to App component
- Implement cancelStreaming message posting to VS Code
- Add onCancel prop to InputForm component
- Replace send button with stop button during streaming
This commit is contained in:
yiliang114
2025-12-04 01:53:19 +08:00
parent 35f98723ca
commit e3c456a430
27 changed files with 730 additions and 286 deletions

View File

@@ -204,6 +204,17 @@ export class WebViewProvider {
// Handle messages from WebView
newPanel.webview.onDidReceiveMessage(
async (message: { type: string; data?: unknown }) => {
// Allow webview to request updating the VS Code tab title
if (message.type === 'updatePanelTitle') {
const title = String(
(message.data as { title?: unknown } | undefined)?.title ?? '',
).trim();
const panelRef = this.panelManager.getPanel();
if (panelRef) {
panelRef.title = title || 'Qwen Code';
}
return;
}
await this.messageHandler.route(message);
},
null,
@@ -790,9 +801,19 @@ export class WebViewProvider {
panel.webview.html = WebViewContent.generate(panel, this.extensionUri);
// Handle messages from WebView
// Handle messages from WebView (restored panel)
panel.webview.onDidReceiveMessage(
async (message: { type: string; data?: unknown }) => {
if (message.type === 'updatePanelTitle') {
const title = String(
(message.data as { title?: unknown } | undefined)?.title ?? '',
).trim();
const panelRef = this.panelManager.getPanel();
if (panelRef) {
panelRef.title = title || 'Qwen Code';
}
return;
}
await this.messageHandler.route(message);
},
null,