mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 17:27:54 +00:00
wip(vscode-ide-companion): OnboardingPage
This commit is contained in:
@@ -329,7 +329,6 @@ export const useWebViewMessages = ({
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('[useWebViewMessages1111]__________ other message:', msg);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -351,30 +350,42 @@ export const useWebViewMessages = ({
|
||||
}
|
||||
|
||||
case 'streamEnd': {
|
||||
// Always end local streaming state and collapse any thoughts
|
||||
// Always end local streaming state and clear thinking state
|
||||
handlers.messageHandling.endStreaming();
|
||||
handlers.messageHandling.clearThinking();
|
||||
|
||||
// If the stream ended due to explicit user cancel, proactively
|
||||
// clear the waiting indicator and reset any tracked exec calls.
|
||||
// This avoids the UI being stuck with the Stop button visible
|
||||
// after rejecting a permission request.
|
||||
// If stream ended due to explicit user cancellation, proactively clear
|
||||
// waiting indicator and reset tracked execution calls.
|
||||
// This avoids UI getting stuck with Stop button visible after
|
||||
// rejecting a permission request.
|
||||
try {
|
||||
const reason = (
|
||||
(message.data as { reason?: string } | undefined)?.reason || ''
|
||||
).toLowerCase();
|
||||
|
||||
/**
|
||||
* Handle different types of stream end reasons:
|
||||
* - 'user_cancelled': User explicitly cancelled operation
|
||||
* - 'cancelled': General cancellation
|
||||
* For these cases, immediately clear all active states
|
||||
*/
|
||||
if (reason === 'user_cancelled' || reason === 'cancelled') {
|
||||
// Clear active execution tool call tracking, reset state
|
||||
activeExecToolCallsRef.current.clear();
|
||||
// Clear waiting response state to ensure UI returns to normal
|
||||
handlers.messageHandling.clearWaitingForResponse();
|
||||
break;
|
||||
}
|
||||
} catch (_error) {
|
||||
// best-effort
|
||||
// Best-effort handling, errors don't affect main flow
|
||||
}
|
||||
|
||||
// Otherwise, clear the generic waiting indicator only if there are
|
||||
// no active long-running tool calls. If there are still active
|
||||
// execute/bash/command calls, keep the hint visible.
|
||||
/**
|
||||
* For other types of stream end (non-user cancellation):
|
||||
* Only clear generic waiting indicator when there are no active
|
||||
* long-running tool calls. If there are still active execute/bash/command
|
||||
* calls, keep the hint visible.
|
||||
*/
|
||||
if (activeExecToolCallsRef.current.size === 0) {
|
||||
handlers.messageHandling.clearWaitingForResponse();
|
||||
}
|
||||
@@ -575,15 +586,21 @@ export const useWebViewMessages = ({
|
||||
// While long-running tools (e.g., execute/bash/command) are in progress,
|
||||
// surface a lightweight loading indicator and expose the Stop button.
|
||||
try {
|
||||
const id = (toolCallData.toolCallId || '').toString();
|
||||
const kind = (toolCallData.kind || '').toString().toLowerCase();
|
||||
const isExec =
|
||||
const isExecKind =
|
||||
kind === 'execute' || kind === 'bash' || kind === 'command';
|
||||
// CLI sometimes omits kind in tool_call_update payloads; fall back to
|
||||
// whether we've already tracked this ID as an exec tool.
|
||||
const wasTrackedExec = activeExecToolCallsRef.current.has(id);
|
||||
const isExec = isExecKind || wasTrackedExec;
|
||||
|
||||
if (isExec) {
|
||||
const id = (toolCallData.toolCallId || '').toString();
|
||||
if (!isExec || !id) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Maintain the active set by status
|
||||
if (status === 'pending' || status === 'in_progress') {
|
||||
if (status === 'pending' || status === 'in_progress') {
|
||||
if (isExecKind) {
|
||||
activeExecToolCallsRef.current.add(id);
|
||||
|
||||
// Build a helpful hint from rawInput
|
||||
@@ -597,14 +614,14 @@ export const useWebViewMessages = ({
|
||||
}
|
||||
const hint = cmd ? `Running: ${cmd}` : 'Running command...';
|
||||
handlers.messageHandling.setWaitingForResponse(hint);
|
||||
} else if (status === 'completed' || status === 'failed') {
|
||||
activeExecToolCallsRef.current.delete(id);
|
||||
}
|
||||
} else if (status === 'completed' || status === 'failed') {
|
||||
activeExecToolCallsRef.current.delete(id);
|
||||
}
|
||||
|
||||
// If no active exec tool remains, clear the waiting message.
|
||||
if (activeExecToolCallsRef.current.size === 0) {
|
||||
handlers.messageHandling.clearWaitingForResponse();
|
||||
}
|
||||
// If no active exec tool remains, clear the waiting message.
|
||||
if (activeExecToolCallsRef.current.size === 0) {
|
||||
handlers.messageHandling.clearWaitingForResponse();
|
||||
}
|
||||
} catch (_error) {
|
||||
// Best-effort UI hint; ignore errors
|
||||
|
||||
Reference in New Issue
Block a user