小白龙 Bailongma - 初始提交

自主操作员与思考搭档系统。
包含 orchestrator-v2 多Agent编排层、后台意识引擎、记忆系统、ACUI 组件。
This commit is contained in:
chengjiaxi
2026-05-22 19:22:06 +08:00
commit 664ffb3834
64 changed files with 111533 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
const fs = require("fs");
const path = "D:\\q\\Bailongma\\orchestrator-v2\\debate\\llm.js";
const content = `// ============================================================
// LLM 调用工具 — 独立于 agent-worker直接 fetch API
// ============================================================
const BASE_URL = (process.env.LLM_BASE_URL || process.env.OPENAI_BASE_URL || "https://api.openai.com/v1").replace(/\\/+$/, "");
const MODEL = process.env.LLM_MODEL || process.env.OPENAI_MODEL || "gpt-4o";
const API_KEY = process.env.LLM_API_KEY || process.env.OPENAI_API_KEY || "";
async function callLLM({ messages, model, maxTokens, temperature }) {
const url = BASE_URL + "/chat/completions";
const body = {
model: model || MODEL,
messages: messages,
max_tokens: maxTokens || 2048,
temperature: temperature ?? 0.7
};
const resp = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer " + API_KEY
},
body: JSON.stringify(body)
});
if (!resp.ok) {
const errText = await resp.text().catch(() => "");
throw new Error("LLM " + resp.status + ": " + errText.slice(0, 200));
}
return await resp.json();
}
module.exports = { callLLM };
`;
fs.writeFileSync(path, content.trim(), "utf8");
console.log("llm.js written, bytes: " + content.length);