agency-orchestrator 0.6.3 → 0.6.4

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/cli/demo.js CHANGED
@@ -151,7 +151,8 @@ export async function detectAvailableLLMs() {
151
151
  try {
152
152
  const controller = new AbortController();
153
153
  const timeout = setTimeout(() => controller.abort(), 2000);
154
- const res = await fetch('http://localhost:11434/api/tags', {
154
+ const ollamaUrl = process.env.OLLAMA_BASE_URL || 'http://localhost:11434';
155
+ const res = await fetch(`${ollamaUrl.replace(/\/+$/, '')}/api/tags`, {
155
156
  signal: controller.signal,
156
157
  });
157
158
  clearTimeout(timeout);
@@ -5,23 +5,36 @@ export class OllamaConnector {
5
5
  this.baseUrl = raw.replace(/\/+$/, '');
6
6
  }
7
7
  async chat(systemPrompt, userMessage, config) {
8
- const response = await fetch(`${this.baseUrl}/api/chat`, {
9
- method: 'POST',
10
- headers: { 'Content-Type': 'application/json' },
11
- body: JSON.stringify({
12
- model: config.model || 'llama3.1',
13
- messages: [
14
- { role: 'system', content: systemPrompt },
15
- { role: 'user', content: userMessage },
16
- ],
17
- stream: false,
18
- options: {
19
- num_predict: config.max_tokens || 2048,
20
- },
21
- }),
22
- });
8
+ let response;
9
+ try {
10
+ response = await fetch(`${this.baseUrl}/api/chat`, {
11
+ method: 'POST',
12
+ headers: { 'Content-Type': 'application/json' },
13
+ body: JSON.stringify({
14
+ model: config.model || 'llama3.1',
15
+ messages: [
16
+ { role: 'system', content: systemPrompt },
17
+ { role: 'user', content: userMessage },
18
+ ],
19
+ stream: false,
20
+ options: {
21
+ num_predict: config.max_tokens || 2048,
22
+ },
23
+ }),
24
+ });
25
+ }
26
+ catch (err) {
27
+ if (err?.cause?.code === 'ECONNREFUSED' || err?.message?.includes('ECONNREFUSED')) {
28
+ throw new Error(`无法连接 Ollama (${this.baseUrl}),请确认 ollama 已启动。Docker 环境请设置 OLLAMA_BASE_URL=http://host.docker.internal:11434`);
29
+ }
30
+ throw err;
31
+ }
23
32
  if (!response.ok) {
24
33
  const text = await response.text();
34
+ if (response.status === 404 && text.includes('not found')) {
35
+ const model = config.model || 'llama3.1';
36
+ throw new Error(`Ollama 模型 "${model}" 未找到,请先运行: ollama pull ${model}`);
37
+ }
25
38
  throw new Error(`Ollama error ${response.status}: ${text}`);
26
39
  }
27
40
  const data = await response.json();
@@ -232,14 +232,14 @@ export async function startServer(verbose = false) {
232
232
  }, async ({ description, provider, model }) => {
233
233
  try {
234
234
  const agentsDir = findAgentsDir();
235
- const llmProvider = provider || 'deepseek';
235
+ const llmProvider = provider || process.env.AO_PROVIDER || 'deepseek';
236
236
  const defaultModels = {
237
237
  deepseek: 'deepseek-chat',
238
238
  claude: 'claude-sonnet-4-20250514',
239
239
  openai: 'gpt-4o',
240
240
  ollama: 'llama3',
241
241
  };
242
- const llmModel = model || defaultModels[llmProvider] || 'gpt-4o';
242
+ const llmModel = model || process.env.AO_MODEL || defaultModels[llmProvider] || 'gpt-4o';
243
243
  const result = await silentCall(() => composeWorkflow({
244
244
  description,
245
245
  agentsDir,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agency-orchestrator",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
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",