sapper-iq 1.2.4 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/sapper.mjs +24 -24
package/package.json
CHANGED
package/sapper.mjs
CHANGED
|
@@ -8634,31 +8634,31 @@ async function runSapper() {
|
|
|
8634
8634
|
spinner.start('Thinking...');
|
|
8635
8635
|
const aiStartTime = Date.now();
|
|
8636
8636
|
let response;
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
if
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
chatOpts.tools = nativeToolDefs;
|
|
8660
|
-
}
|
|
8637
|
+
// Build chat options — pass native tools when supported
|
|
8638
|
+
const chatOpts = { model: selectedModel, messages, stream: true };
|
|
8639
|
+
if (effectiveContextLength()) {
|
|
8640
|
+
chatOpts.options = { num_ctx: effectiveContextLength() };
|
|
8641
|
+
}
|
|
8642
|
+
// Thinking can be forced on, forced off, or auto-disabled for simple prompts.
|
|
8643
|
+
if (turnThinkingEnabled) chatOpts.think = true;
|
|
8644
|
+
if (useNativeTools) {
|
|
8645
|
+
// Filter tool defs by agent restrictions if any
|
|
8646
|
+
if (currentAgentTools) {
|
|
8647
|
+
const toolNameMap = {
|
|
8648
|
+
list_directory: 'LIST', read_file: 'READ', search_files: 'SEARCH',
|
|
8649
|
+
write_file: 'WRITE', patch_file: 'PATCH', create_directory: 'MKDIR',
|
|
8650
|
+
ls: 'LS', cat: 'CAT', head: 'HEAD', tail: 'TAIL', grep: 'GREP', find: 'FIND',
|
|
8651
|
+
pwd: 'PWD', cd: 'CD', rmdir: 'RMDIR', changes: 'CHANGES',
|
|
8652
|
+
fetch_web: 'FETCH', recall_memory: 'MEMORY', open_url: 'OPEN', run_shell: 'SHELL'
|
|
8653
|
+
};
|
|
8654
|
+
chatOpts.tools = nativeToolDefs.filter(t =>
|
|
8655
|
+
isToolAllowedForAgent(currentAgentTools, toolNameMap[t.function.name])
|
|
8656
|
+
);
|
|
8657
|
+
} else {
|
|
8658
|
+
chatOpts.tools = nativeToolDefs;
|
|
8661
8659
|
}
|
|
8660
|
+
}
|
|
8661
|
+
try {
|
|
8662
8662
|
response = await ollama.chat(chatOpts);
|
|
8663
8663
|
} catch (ollamaError) {
|
|
8664
8664
|
const errMsg = ollamaError && ollamaError.message ? ollamaError.message : String(ollamaError);
|