opencode-see-image 0.8.0 → 0.8.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/index.ts +2 -40
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -221,48 +221,10 @@ async function seeImageViaSDK(
|
|
|
221
221
|
mediaType: string,
|
|
222
222
|
prompt: string,
|
|
223
223
|
abort?: AbortSignal,
|
|
224
|
-
currentSessionID?: string,
|
|
225
224
|
): Promise<{ text: string; model: string; provider: string }> {
|
|
226
225
|
const errors: string[] = []
|
|
227
226
|
|
|
228
|
-
//
|
|
229
|
-
if (currentSessionID) {
|
|
230
|
-
try {
|
|
231
|
-
const controller = new AbortController()
|
|
232
|
-
const timer = setTimeout(() => controller.abort(), TIMEOUT)
|
|
233
|
-
const result = await client.session.prompt({
|
|
234
|
-
path: { id: currentSessionID },
|
|
235
|
-
body: {
|
|
236
|
-
parts: [
|
|
237
|
-
{ type: "file", mime: mediaType, url: dataUrl },
|
|
238
|
-
{ type: "text", text: prompt },
|
|
239
|
-
],
|
|
240
|
-
tools: {},
|
|
241
|
-
system:
|
|
242
|
-
"You are a vision assistant. Describe the image accurately and concisely. Answer with text only.",
|
|
243
|
-
},
|
|
244
|
-
signal: controller.signal,
|
|
245
|
-
})
|
|
246
|
-
clearTimeout(timer)
|
|
247
|
-
|
|
248
|
-
const parts = result.data?.parts ?? []
|
|
249
|
-
const text = (parts as any[])
|
|
250
|
-
.filter((p: any) => p.type === "text")
|
|
251
|
-
.map((p: any) => p.text)
|
|
252
|
-
.filter((t: any) => typeof t === "string" && t.length > 0)
|
|
253
|
-
.join("\n")
|
|
254
|
-
.trim()
|
|
255
|
-
|
|
256
|
-
if (text) {
|
|
257
|
-
return { text, model: "", provider: "current" }
|
|
258
|
-
}
|
|
259
|
-
errors.push(`current-session: no text in response`)
|
|
260
|
-
} catch (e: any) {
|
|
261
|
-
errors.push(`current-session: ${e?.message ?? e}`)
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// Fallback: create new sessions with specific provider/model candidates
|
|
227
|
+
// Create new sessions with specific provider/model candidates
|
|
266
228
|
const envProvider = process.env.SEE_IMAGE_PROVIDER
|
|
267
229
|
const envModel = process.env.SEE_IMAGE_MODEL
|
|
268
230
|
const candidates: Array<{ providerID: string; modelID: string }> = []
|
|
@@ -270,6 +232,7 @@ async function seeImageViaSDK(
|
|
|
270
232
|
candidates.push({ providerID: envProvider, modelID: envModel })
|
|
271
233
|
}
|
|
272
234
|
candidates.push({ providerID: "opencode-go", modelID: "minimax-m3" })
|
|
235
|
+
candidates.push({ providerID: "opencode", modelID: "mimo-v2.5-free" })
|
|
273
236
|
candidates.push({ providerID: "opencode", modelID: "big-pickle" })
|
|
274
237
|
|
|
275
238
|
for (const { providerID, modelID } of candidates) {
|
|
@@ -482,7 +445,6 @@ const SeeImagePlugin: Plugin = async (ctx) => {
|
|
|
482
445
|
resolved.mediaType,
|
|
483
446
|
prompt,
|
|
484
447
|
context.abort,
|
|
485
|
-
context.sessionID,
|
|
486
448
|
)
|
|
487
449
|
}
|
|
488
450
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-see-image",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.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",
|