fix: memory 工具 required 数组添加 type — 解决模型持续不传 type 参数问题

Ollama function calling 依赖 JSON Schema 的 required 数组判断参数必要性,
type 不在 required 中导致模型认为它是可选的,即使 error 提示了也不传。
将其加入 required 数组后,模型将被强制要求每次调用都提供 type 参数。
This commit is contained in:
紫影233
2026-06-24 15:10:58 +08:00
parent e119ffbcf6
commit d3a28822b3
2 changed files with 23 additions and 2 deletions
+1 -1
View File
@@ -367,7 +367,7 @@ export const TOOL_DEFINITIONS: ToolDefinition[] = [
CRITICAL: For add action, you MUST include both "type" (fact/preference/rule) and "content" fields. If you omit them, the call will fail.`,
parameters: {
type: 'object',
required: ['action'],
required: ['action', 'type'],
properties: {
action: { type: 'string', enum: ['search', 'add', 'replace', 'remove', 'read_all'], description: 'Which operation to perform.' },
query: { type: 'string', description: '[search] Keywords to search for.' },