mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 12:40:44 +00:00
refactor ui for stop hook reason and systemMessage
This commit is contained in:
parent
a5c6084222
commit
cf0b67ef8e
10 changed files with 134 additions and 22 deletions
|
|
@ -87,7 +87,7 @@ import {
|
|||
ExtensionManager,
|
||||
type Extension,
|
||||
} from '../extension/extensionManager.js';
|
||||
import { HookSystem } from '../hooks/index.js';
|
||||
import { HookSystem, createHookOutput } from '../hooks/index.js';
|
||||
import { MessageBus } from '../confirmation-bus/message-bus.js';
|
||||
import {
|
||||
MessageBusType,
|
||||
|
|
@ -823,6 +823,7 @@ export class Config {
|
|||
|
||||
// Execute the appropriate hook based on eventName
|
||||
let result;
|
||||
let stopHookCount: number | undefined;
|
||||
const input = request.input || {};
|
||||
const signal = request.signal;
|
||||
switch (request.eventName) {
|
||||
|
|
@ -832,13 +833,18 @@ export class Config {
|
|||
signal,
|
||||
);
|
||||
break;
|
||||
case 'Stop':
|
||||
result = await hookSystem.fireStopEvent(
|
||||
case 'Stop': {
|
||||
const stopResult = await hookSystem.fireStopEvent(
|
||||
(input['stop_hook_active'] as boolean) || false,
|
||||
(input['last_assistant_message'] as string) || '',
|
||||
signal,
|
||||
);
|
||||
result = stopResult.finalOutput
|
||||
? createHookOutput('Stop', stopResult.finalOutput)
|
||||
: undefined;
|
||||
stopHookCount = stopResult.allOutputs.length;
|
||||
break;
|
||||
}
|
||||
case 'PreToolUse': {
|
||||
result = await hookSystem.firePreToolUseEvent(
|
||||
(input['tool_name'] as string) || '',
|
||||
|
|
@ -926,6 +932,8 @@ export class Config {
|
|||
correlationId: request.correlationId,
|
||||
success: true,
|
||||
output: result,
|
||||
// Include stop hook count for Stop events
|
||||
stopHookCount,
|
||||
} as HookExecutionResponse);
|
||||
} catch (error) {
|
||||
this.debugLogger.warn(`Hook execution failed: ${error}`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue