mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
simplify directory display in shell tool description (#230)
This commit is contained in:
@@ -43,14 +43,10 @@ export class ShellTool extends BaseTool<ShellToolParams, ToolResult> {
|
|||||||
|
|
||||||
getDescription(params: ShellToolParams): string {
|
getDescription(params: ShellToolParams): string {
|
||||||
let description = `${params.command}`;
|
let description = `${params.command}`;
|
||||||
// append optional [./directory], prepending ./ if missing and relative
|
// append optional [in directory]
|
||||||
// note description is needed even if validation fails due to absolute path
|
// note description is needed even if validation fails due to absolute path
|
||||||
if (params.directory) {
|
if (params.directory) {
|
||||||
let path = params.directory;
|
description += ` [in ${params.directory}]`;
|
||||||
if (!path.startsWith('./') && !path.startsWith('/') && path !== '.') {
|
|
||||||
path = './' + path;
|
|
||||||
}
|
|
||||||
description += ` [${path}]`;
|
|
||||||
}
|
}
|
||||||
// append optional (description), replacing any line breaks with spaces
|
// append optional (description), replacing any line breaks with spaces
|
||||||
// tool description/schema should specify a single line w/o line breaks
|
// tool description/schema should specify a single line w/o line breaks
|
||||||
|
|||||||
Reference in New Issue
Block a user