mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-03 23:53:46 +00:00
tweak: move zod validation for tools to ensure it always runs (#3565)
This commit is contained in:
@@ -42,8 +42,13 @@ export namespace Tool {
|
||||
return {
|
||||
id,
|
||||
init: async () => {
|
||||
if (init instanceof Function) return init()
|
||||
return init
|
||||
const toolInfo = init instanceof Function ? await init() : init
|
||||
const execute = toolInfo.execute
|
||||
toolInfo.execute = (args, ctx) => {
|
||||
toolInfo.parameters.parse(args)
|
||||
return execute(args, ctx)
|
||||
}
|
||||
return toolInfo
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user