opencode-see-image 0.8.1 → 0.8.3
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 +1 -41
- 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 }> = []
|
|
@@ -271,7 +233,6 @@ async function seeImageViaSDK(
|
|
|
271
233
|
}
|
|
272
234
|
candidates.push({ providerID: "opencode-go", modelID: "minimax-m3" })
|
|
273
235
|
candidates.push({ providerID: "opencode", modelID: "mimo-v2.5-free" })
|
|
274
|
-
candidates.push({ providerID: "opencode", modelID: "big-pickle" })
|
|
275
236
|
|
|
276
237
|
for (const { providerID, modelID } of candidates) {
|
|
277
238
|
let sessionID: string | undefined
|
|
@@ -483,7 +444,6 @@ const SeeImagePlugin: Plugin = async (ctx) => {
|
|
|
483
444
|
resolved.mediaType,
|
|
484
445
|
prompt,
|
|
485
446
|
context.abort,
|
|
486
|
-
context.sessionID,
|
|
487
447
|
)
|
|
488
448
|
}
|
|
489
449
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-see-image",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
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",
|