mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
Fix read-file from exploding with path not found error.
- There were a few hiccups here. Somehow 2.5-flash wasn't actually abiding by our tool schema. Instead it was inferring `path`. To semi-combat this I've renamed `file_path` -> `path`. - We weren't elevating errors that were created via schema validation. Instead both the `glob` and `read-file.ts` now surface this. - In error scenarios (like failing schema) we were improperly surfacing these as success cases because we were overriding tool status.
This commit is contained in:
committed by
N. Taylor Mullen
parent
c095091853
commit
63f864cdd7
@@ -38,8 +38,7 @@ export class ReadFileTool extends BaseTool<ReadFileToolParams, ToolResult> {
|
||||
* Delegates validation to the core logic
|
||||
*/
|
||||
validateToolParams(_params: ReadFileToolParams): string | null {
|
||||
// Currently allowing any path. Add validation if needed.
|
||||
return null;
|
||||
return this.coreLogic.validateToolParams(_params);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +61,7 @@ export class ReadFileTool extends BaseTool<ReadFileToolParams, ToolResult> {
|
||||
/**
|
||||
* Delegates execution to the core logic
|
||||
*/
|
||||
async execute(params: ReadFileToolParams): Promise<ToolResult> {
|
||||
execute(params: ReadFileToolParams): Promise<ToolResult> {
|
||||
return this.coreLogic.execute(params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,7 +330,13 @@ export const useGeminiStream = (
|
||||
...item,
|
||||
tools: item.tools.map((tool) =>
|
||||
tool.callId === callId
|
||||
? { ...tool, status: ToolCallStatus.Invoked }
|
||||
? {
|
||||
...tool,
|
||||
status:
|
||||
tool.status === ToolCallStatus.Error
|
||||
? ToolCallStatus.Error
|
||||
: ToolCallStatus.Invoked,
|
||||
}
|
||||
: tool,
|
||||
),
|
||||
};
|
||||
@@ -362,7 +368,10 @@ export const useGeminiStream = (
|
||||
tool.callId === callId
|
||||
? {
|
||||
...tool,
|
||||
status: ToolCallStatus.Success,
|
||||
status:
|
||||
tool.status === ToolCallStatus.Error
|
||||
? ToolCallStatus.Error
|
||||
: ToolCallStatus.Success,
|
||||
resultDisplay: result.returnDisplay,
|
||||
}
|
||||
: tool,
|
||||
|
||||
Reference in New Issue
Block a user