mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-22 01:37:50 +00:00
add flags for markdown rendering and live updating to Tool to avoid special-casing shell tool by name, and open door for other tools to specify their rendering/updating (#629)
This commit is contained in:
@@ -42,6 +42,8 @@ export class ShellTool extends BaseTool<ShellToolParams, ToolResult> {
|
||||
toolDisplayName,
|
||||
toolDescription,
|
||||
toolParameterSchema,
|
||||
false, // output is not markdown
|
||||
true, // output can be updated
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,16 @@ export interface Tool<
|
||||
*/
|
||||
schema: FunctionDeclaration;
|
||||
|
||||
/**
|
||||
* Whether the tool's output should be rendered as markdown
|
||||
*/
|
||||
isOutputMarkdown: boolean;
|
||||
|
||||
/**
|
||||
* Whether the tool supports live (streaming) output
|
||||
*/
|
||||
canUpdateOutput: boolean;
|
||||
|
||||
/**
|
||||
* Validates the parameters for the tool
|
||||
* Should be called from both `shouldConfirmExecute` and `execute`
|
||||
@@ -85,6 +95,8 @@ export abstract class BaseTool<
|
||||
* @param name Internal name of the tool (used for API calls)
|
||||
* @param displayName User-friendly display name of the tool
|
||||
* @param description Description of what the tool does
|
||||
* @param isOutputMarkdown Whether the tool's output should be rendered as markdown
|
||||
* @param canUpdateOutput Whether the tool supports live (streaming) output
|
||||
* @param parameterSchema JSON Schema defining the parameters
|
||||
*/
|
||||
constructor(
|
||||
@@ -92,6 +104,8 @@ export abstract class BaseTool<
|
||||
readonly displayName: string,
|
||||
readonly description: string,
|
||||
readonly parameterSchema: Record<string, unknown>,
|
||||
readonly isOutputMarkdown: boolean = true,
|
||||
readonly canUpdateOutput: boolean = false,
|
||||
) {}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user