fix: include custom tools in Ollama API requests
Custom tools were displayed as enabled in the UI but never sent to Ollama because getEnabledToolDefinitions() only queried the builtin tool registry. Now iterates customTools and includes enabled ones. Fixes #4
This commit is contained in:
@@ -110,8 +110,25 @@ class ToolsState {
|
||||
return [];
|
||||
}
|
||||
|
||||
const definitions = toolRegistry.getDefinitions();
|
||||
return definitions.filter(def => this.isToolEnabled(def.function.name));
|
||||
// Get enabled builtin tools
|
||||
const builtinDefs = toolRegistry.getDefinitions();
|
||||
const enabled = builtinDefs.filter(def => this.isToolEnabled(def.function.name));
|
||||
|
||||
// Add enabled custom tools
|
||||
for (const custom of this.customTools) {
|
||||
if (custom.enabled && this.isToolEnabled(custom.name)) {
|
||||
enabled.push({
|
||||
type: 'function',
|
||||
function: {
|
||||
name: custom.name,
|
||||
description: custom.description,
|
||||
parameters: custom.parameters
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user