mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-29 20:20:57 +00:00
Rename invalidParams to validateToolParams (#12)
Methods should be verbs. Fixes #4.
This commit is contained in:
parent
7cd3b95317
commit
e1fac40256
7 changed files with 17 additions and 16 deletions
|
|
@ -106,7 +106,7 @@ export class ReadFileTool extends BaseTool<
|
|||
* @param params Parameters to validate
|
||||
* @returns True if parameters are valid, false otherwise
|
||||
*/
|
||||
invalidParams(params: ReadFileToolParams): string | null {
|
||||
validateToolParams(params: ReadFileToolParams): string | null {
|
||||
if (
|
||||
this.schema.parameters &&
|
||||
!SchemaValidator.validate(
|
||||
|
|
@ -210,8 +210,7 @@ export class ReadFileTool extends BaseTool<
|
|||
* @returns Result with file contents
|
||||
*/
|
||||
async execute(params: ReadFileToolParams): Promise<ToolResult> {
|
||||
const validationError = this.invalidParams(params);
|
||||
const filePath = params.file_path;
|
||||
const validationError = this.validateToolParams(params);
|
||||
if (validationError) {
|
||||
return {
|
||||
llmContent: `Error: Invalid parameters provided. Reason: ${validationError}`,
|
||||
|
|
@ -219,6 +218,7 @@ export class ReadFileTool extends BaseTool<
|
|||
};
|
||||
}
|
||||
|
||||
const filePath = params.file_path;
|
||||
try {
|
||||
if (!fs.existsSync(filePath)) {
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue