opencode-see-image 0.6.1 → 0.6.2
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.md +1 -0
- package/index.ts +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -102,6 +102,7 @@ All settings are env-var overrides. The plugin uses opencode's SDK client by def
|
|
|
102
102
|
| `SEE_IMAGE_ENDPOINT` | `https://opencode.ai/zen/go/v1/messages` | HTTP endpoint (only used if `SEE_IMAGE_API_KEY` is set) |
|
|
103
103
|
| `SEE_IMAGE_API_VERSION` | `2023-06-01` | `anthropic-version` header (HTTP mode only) |
|
|
104
104
|
| `SEE_IMAGE_USER_AGENT` | _(Chrome UA)_ | User-Agent header (HTTP mode only) |
|
|
105
|
+
| `SEE_IMAGE_TIMEOUT` | `30000` | Per-candidate timeout in ms. Prevents hanging on slow models. |
|
|
105
106
|
|
|
106
107
|
### Using a different vision model
|
|
107
108
|
|
package/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ const ENDPOINT =
|
|
|
11
11
|
"https://opencode.ai/zen/go/v1/messages"
|
|
12
12
|
const MODEL = process.env.SEE_IMAGE_MODEL || "minimax-m3"
|
|
13
13
|
const PROVIDER_ID = process.env.SEE_IMAGE_PROVIDER || "opencode-go"
|
|
14
|
+
const TIMEOUT = parseInt(process.env.SEE_IMAGE_TIMEOUT || "30000", 10)
|
|
14
15
|
const API_VERSION = process.env.SEE_IMAGE_API_VERSION || "2023-06-01"
|
|
15
16
|
const USER_AGENT =
|
|
16
17
|
process.env.SEE_IMAGE_USER_AGENT ||
|
|
@@ -222,6 +223,10 @@ async function seeImageViaSDK(
|
|
|
222
223
|
continue
|
|
223
224
|
}
|
|
224
225
|
|
|
226
|
+
// Per-candidate timeout so a slow model doesn't hang forever
|
|
227
|
+
const controller = new AbortController()
|
|
228
|
+
const timer = setTimeout(() => controller.abort(), TIMEOUT)
|
|
229
|
+
|
|
225
230
|
const result = await client.session.prompt({
|
|
226
231
|
path: { id: sessionID },
|
|
227
232
|
body: {
|
|
@@ -234,7 +239,9 @@ async function seeImageViaSDK(
|
|
|
234
239
|
system:
|
|
235
240
|
"You are a vision assistant. Describe the image accurately and concisely. Answer with text only.",
|
|
236
241
|
},
|
|
242
|
+
signal: controller.signal,
|
|
237
243
|
})
|
|
244
|
+
clearTimeout(timer)
|
|
238
245
|
|
|
239
246
|
const parts = result.data?.parts ?? []
|
|
240
247
|
const text = (parts as any[])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-see-image",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Give non-vision opencode models the ability to see images/screenshots by routing them to a vision-capable model (MiniMax M3 via opencode-go by default).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|