akemon 0.1.70 → 0.1.72
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/dist/server.js +6 -3
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -722,6 +722,7 @@ const LLM_ENGINES = new Set(["claude", "codex", "opencode", "gemini", "local"]);
|
|
|
722
722
|
// Local engine: tool call loop over OpenAI-compatible API (Ollama, llama.cpp)
|
|
723
723
|
// ---------------------------------------------------------------------------
|
|
724
724
|
const LOCAL_API_URL = process.env.AKEMON_LOCAL_URL || "http://localhost:11434/v1";
|
|
725
|
+
const LOCAL_API_KEY = process.env.AKEMON_LOCAL_KEY || "";
|
|
725
726
|
const LOCAL_MAX_ROUNDS = 20;
|
|
726
727
|
const LOCAL_TOOLS = [
|
|
727
728
|
{
|
|
@@ -822,7 +823,7 @@ async function executeLocalTool(name, args, workdir) {
|
|
|
822
823
|
async function runLocalEngine(task, model, workdir) {
|
|
823
824
|
const apiUrl = LOCAL_API_URL + "/chat/completions";
|
|
824
825
|
const modelName = model || "gemma4:4b";
|
|
825
|
-
console.log(`[local] Task
|
|
826
|
+
console.log(`[local] Task:\n${task}`);
|
|
826
827
|
const messages = [
|
|
827
828
|
{ role: "system", content: "You are a helpful agent. Use tools when needed to complete the task. When done, reply with your final answer in plain text." },
|
|
828
829
|
{ role: "user", content: task },
|
|
@@ -833,7 +834,9 @@ async function runLocalEngine(task, model, workdir) {
|
|
|
833
834
|
try {
|
|
834
835
|
const res = await fetch(apiUrl, {
|
|
835
836
|
method: "POST",
|
|
836
|
-
headers:
|
|
837
|
+
headers: LOCAL_API_KEY
|
|
838
|
+
? { "Content-Type": "application/json", "Authorization": `Bearer ${LOCAL_API_KEY}` }
|
|
839
|
+
: { "Content-Type": "application/json" },
|
|
837
840
|
body: JSON.stringify(body),
|
|
838
841
|
signal: AbortSignal.timeout(300_000),
|
|
839
842
|
});
|
|
@@ -878,7 +881,7 @@ async function runLocalEngine(task, model, workdir) {
|
|
|
878
881
|
// No tool calls — this is the final response
|
|
879
882
|
const content = msg.content || "";
|
|
880
883
|
if (content.trim()) {
|
|
881
|
-
console.log(`[local] Done in ${round + 1} round(s), response
|
|
884
|
+
console.log(`[local] Done in ${round + 1} round(s), response:\n${content}`);
|
|
882
885
|
return content.trim();
|
|
883
886
|
}
|
|
884
887
|
}
|