open-agents-ai 0.184.73 → 0.184.74
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/index.js +42 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15839,10 +15839,34 @@ var init_vision = __esm({
|
|
|
15839
15839
|
const ollamaResult = await this.tryOllamaVision(buffer, filename, action, prompt, length, start);
|
|
15840
15840
|
if (ollamaResult)
|
|
15841
15841
|
return ollamaResult;
|
|
15842
|
+
try {
|
|
15843
|
+
const { execSync: execSync34 } = await import("node:child_process");
|
|
15844
|
+
try {
|
|
15845
|
+
execSync34("pip3 install --user moondream 2>/dev/null || pip install --user moondream 2>/dev/null", {
|
|
15846
|
+
timeout: 12e4,
|
|
15847
|
+
stdio: "pipe"
|
|
15848
|
+
});
|
|
15849
|
+
moondreamError = null;
|
|
15850
|
+
moondreamClient = null;
|
|
15851
|
+
const retryClient = await getMoondreamClient().catch(() => null);
|
|
15852
|
+
if (retryClient) {
|
|
15853
|
+
return await this.runMoondream(retryClient, buffer, filename, action, prompt, length, start);
|
|
15854
|
+
}
|
|
15855
|
+
} catch {
|
|
15856
|
+
}
|
|
15857
|
+
try {
|
|
15858
|
+
execSync34("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
|
|
15859
|
+
const retryOllama = await this.tryOllamaVision(buffer, filename, action, prompt, length, start);
|
|
15860
|
+
if (retryOllama)
|
|
15861
|
+
return retryOllama;
|
|
15862
|
+
} catch {
|
|
15863
|
+
}
|
|
15864
|
+
} catch {
|
|
15865
|
+
}
|
|
15842
15866
|
return {
|
|
15843
15867
|
success: false,
|
|
15844
15868
|
output: "",
|
|
15845
|
-
error: "No vision backend available
|
|
15869
|
+
error: "No vision backend available (auto-install attempted but failed).\nManual options:\n 1. ollama pull moondream \u2014 uses Ollama (easiest)\n 2. pip install moondream-station \u2014 dedicated server\n 3. Set MOONDREAM_API_KEY for cloud inference",
|
|
15846
15870
|
durationMs: performance.now() - start
|
|
15847
15871
|
};
|
|
15848
15872
|
} catch (error) {
|
|
@@ -15929,12 +15953,28 @@ Coordinates are normalized (0-1). Multiply by image width/height for pixel value
|
|
|
15929
15953
|
return null;
|
|
15930
15954
|
}
|
|
15931
15955
|
try {
|
|
15932
|
-
|
|
15956
|
+
let res = await fetch(`${ollamaHost}/api/generate`, {
|
|
15933
15957
|
method: "POST",
|
|
15934
15958
|
headers: { "Content-Type": "application/json" },
|
|
15935
15959
|
body: JSON.stringify({ model, prompt: ollamaPrompt, images: [imageBase64], stream: false }),
|
|
15936
15960
|
signal: AbortSignal.timeout(6e4)
|
|
15937
15961
|
});
|
|
15962
|
+
if (!res.ok && model === "moondream") {
|
|
15963
|
+
const errText = await res.text().catch(() => "");
|
|
15964
|
+
if (res.status === 404 || /not found|does not exist/i.test(errText)) {
|
|
15965
|
+
try {
|
|
15966
|
+
const { execSync: execSync34 } = await import("node:child_process");
|
|
15967
|
+
execSync34("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
|
|
15968
|
+
res = await fetch(`${ollamaHost}/api/generate`, {
|
|
15969
|
+
method: "POST",
|
|
15970
|
+
headers: { "Content-Type": "application/json" },
|
|
15971
|
+
body: JSON.stringify({ model, prompt: ollamaPrompt, images: [imageBase64], stream: false }),
|
|
15972
|
+
signal: AbortSignal.timeout(6e4)
|
|
15973
|
+
});
|
|
15974
|
+
} catch {
|
|
15975
|
+
}
|
|
15976
|
+
}
|
|
15977
|
+
}
|
|
15938
15978
|
if (!res.ok)
|
|
15939
15979
|
return null;
|
|
15940
15980
|
const data = await res.json();
|
package/package.json
CHANGED