agency-orchestrator 0.6.5 → 0.6.6
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/README.en.md +18 -1
- package/README.md +27 -1
- package/dist/connectors/ollama.js +21 -1
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -211,7 +211,24 @@ analyze ──→ tech_review ──→ summary
|
|
|
211
211
|
| Claude API | `provider: "claude"` | `ANTHROPIC_API_KEY` |
|
|
212
212
|
| OpenAI | `provider: "openai"` | `OPENAI_API_KEY` |
|
|
213
213
|
|
|
214
|
-
|
|
214
|
+
**Custom API (any OpenAI-compatible endpoint):**
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
ao init --provider openai --model model-name \
|
|
218
|
+
--base-url https://your-api-endpoint/v1 \
|
|
219
|
+
--api-key your-key
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Or edit `.env` manually:
|
|
223
|
+
|
|
224
|
+
```env
|
|
225
|
+
AO_PROVIDER=openai
|
|
226
|
+
AO_MODEL=model-name
|
|
227
|
+
OPENAI_BASE_URL=https://your-api-endpoint/v1
|
|
228
|
+
OPENAI_API_KEY=your-key
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
> ⚠️ Use `provider: "openai"` for third-party APIs, not `provider: "ollama"`. Ollama is for local models only and does not send API keys.
|
|
215
232
|
|
|
216
233
|
## CLI Reference
|
|
217
234
|
|
package/README.md
CHANGED
|
@@ -210,7 +210,33 @@ analyze ──→ tech_review ──→ summary
|
|
|
210
210
|
| Claude API | `provider: "claude"` | `ANTHROPIC_API_KEY` |
|
|
211
211
|
| OpenAI | `provider: "openai"` | `OPENAI_API_KEY` |
|
|
212
212
|
|
|
213
|
-
|
|
213
|
+
**自定义 API(火山引擎、智谱、月之暗面、硅基流动等 OpenAI 兼容 API):**
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
ao init --provider openai --model 模型名 \
|
|
217
|
+
--base-url https://你的API地址/v1 \
|
|
218
|
+
--api-key 你的key
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
或手动编辑 `.env`:
|
|
222
|
+
|
|
223
|
+
```env
|
|
224
|
+
AO_PROVIDER=openai
|
|
225
|
+
AO_MODEL=模型名
|
|
226
|
+
OPENAI_BASE_URL=https://你的API地址/v1
|
|
227
|
+
OPENAI_API_KEY=你的key
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
常见示例:
|
|
231
|
+
|
|
232
|
+
| 平台 | base_url | model |
|
|
233
|
+
|------|----------|-------|
|
|
234
|
+
| 火山引擎 | `https://ark.cn-beijing.volces.com/api/coding/v3` | `ark-code-latest` |
|
|
235
|
+
| 智谱 AI | `https://open.bigmodel.cn/api/paas/v4` | `glm-4` |
|
|
236
|
+
| 硅基流动 | `https://api.siliconflow.cn/v1` | `deepseek-ai/DeepSeek-V3` |
|
|
237
|
+
| 月之暗面 | `https://api.moonshot.cn/v1` | `moonshot-v1-8k` |
|
|
238
|
+
|
|
239
|
+
> ⚠️ 注意:这些平台请使用 `provider: "openai"`,不要用 `provider: "ollama"`。Ollama 仅用于本地模型,不发送 API Key。
|
|
214
240
|
|
|
215
241
|
## CLI 命令
|
|
216
242
|
|
|
@@ -5,6 +5,8 @@ export class OllamaConnector {
|
|
|
5
5
|
this.baseUrl = raw.replace(/\/+$/, '');
|
|
6
6
|
}
|
|
7
7
|
async chat(systemPrompt, userMessage, config) {
|
|
8
|
+
const numPredict = config.max_tokens || 8192;
|
|
9
|
+
const numCtx = estimateNumCtx(systemPrompt, userMessage, numPredict);
|
|
8
10
|
let response;
|
|
9
11
|
try {
|
|
10
12
|
response = await fetch(`${this.baseUrl}/api/chat`, {
|
|
@@ -18,7 +20,8 @@ export class OllamaConnector {
|
|
|
18
20
|
],
|
|
19
21
|
stream: false,
|
|
20
22
|
options: {
|
|
21
|
-
num_predict:
|
|
23
|
+
num_predict: numPredict,
|
|
24
|
+
num_ctx: numCtx,
|
|
22
25
|
},
|
|
23
26
|
}),
|
|
24
27
|
});
|
|
@@ -47,3 +50,20 @@ export class OllamaConnector {
|
|
|
47
50
|
};
|
|
48
51
|
}
|
|
49
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* 根据实际输入长度自适应计算 num_ctx,避免 Ollama 默认 2048 截断,
|
|
55
|
+
* 同时小输入不分配多余显存,提升推理速度。
|
|
56
|
+
*/
|
|
57
|
+
function estimateNumCtx(systemPrompt, userMessage, numPredict) {
|
|
58
|
+
const text = systemPrompt + userMessage;
|
|
59
|
+
// CJK 字符约 1.5-2 token/字,ASCII 约 0.25 token/字,按实际比例加权
|
|
60
|
+
let tokens = 0;
|
|
61
|
+
for (let i = 0; i < text.length; i++) {
|
|
62
|
+
tokens += text.charCodeAt(i) > 0x7F ? 1.5 : 0.3;
|
|
63
|
+
}
|
|
64
|
+
const estimatedInputTokens = Math.ceil(tokens);
|
|
65
|
+
const buffer = 512;
|
|
66
|
+
const computed = estimatedInputTokens + numPredict + buffer;
|
|
67
|
+
// 下限 4096(部分模型低于此值行为异常),上限 131072(主流模型极限)
|
|
68
|
+
return Math.min(Math.max(computed, 4096), 131072);
|
|
69
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agency-orchestrator",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6",
|
|
4
4
|
"description": "Multi-agent YAML workflow engine — 211 AI roles, auto DAG parallelism, zero code. One sentence → multiple AI roles collaborate → complete plan in minutes. 10 LLM providers, 7 need no API key.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"multi-agent",
|