opencode-pollinations-plugin 5.3.5 → 5.3.7
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 +8 -1
- package/dist/server/proxy.js +24 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -69,7 +69,14 @@ You spend it to verify API calls on premium models.
|
|
|
69
69
|
|
|
70
70
|
> 🎁 **Beta Bonus**: Buy one Pollen pack, get one free!
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
### 🐧 Platform Support & Port Management
|
|
73
|
+
|
|
74
|
+
This plugin is **Cross-Platform** (Windows, macOS, Linux).
|
|
75
|
+
|
|
76
|
+
> **Note**: The **Automatic Port Zombie Killer** (which clears port 10001 on startup) is currently **Linux-optimized** (using `fuser -k`).
|
|
77
|
+
> On **Windows/macOS**, if you encounter "Address in use", you may need to manually kill the process occupying port 10001 or reload the window.
|
|
78
|
+
|
|
79
|
+
## 📦 Installation & Ecology Only
|
|
73
80
|
|
|
74
81
|
This plugin is part of the **OpenCode Ecosystem**.
|
|
75
82
|
|
package/dist/server/proxy.js
CHANGED
|
@@ -351,27 +351,39 @@ export async function handleChatCompletion(req, res, bodyRaw) {
|
|
|
351
351
|
// Restore Tools but REMOVE conflicting ones (Search)
|
|
352
352
|
// B. GEMINI UNIFIED FIX (Free, Fast, Pro, Enterprise, Legacy)
|
|
353
353
|
// Handles: "tools" vs "grounding" conflicts, and "infinite loops" via Stop Sequences.
|
|
354
|
+
// B. GEMINI UNIFIED FIX (Free, Fast, Pro, Enterprise, Legacy)
|
|
355
|
+
// Fixes "Multiple tools" error (Vertex) and "JSON body validation failed" (v5.3.5 regression)
|
|
354
356
|
else if (actualModel.includes("gemini")) {
|
|
355
|
-
|
|
357
|
+
let hasFunctions = false;
|
|
358
|
+
if (proxyBody.tools && Array.isArray(proxyBody.tools)) {
|
|
359
|
+
hasFunctions = proxyBody.tools.some((t) => t.type === 'function' || t.function);
|
|
360
|
+
}
|
|
356
361
|
if (hasFunctions) {
|
|
357
|
-
// 1.
|
|
358
|
-
proxyBody.tools_config = { google_search_retrieval: { disable: true } };
|
|
359
|
-
// 2. Strict cleanup of 'google_search' tool from the functions list
|
|
360
|
-
// (If we send a function named 'google_search' AND tools_config, Vertex crashes)
|
|
362
|
+
// 1. Strict cleanup of 'google_search' tool
|
|
361
363
|
proxyBody.tools = proxyBody.tools.filter((t) => {
|
|
362
364
|
const isFunc = t.type === 'function' || t.function;
|
|
363
365
|
const name = t.function?.name || t.name;
|
|
364
366
|
return isFunc && name !== 'google_search';
|
|
365
367
|
});
|
|
366
|
-
//
|
|
367
|
-
proxyBody.tools
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
if (!proxyBody.stop) {
|
|
371
|
-
proxyBody.stop = ["<|endoftext|>", "User:", "\nUser", "User :", "Model:"];
|
|
368
|
+
// 2. If tools remain, sanitize them and DISABLE grounding
|
|
369
|
+
if (proxyBody.tools.length > 0) {
|
|
370
|
+
proxyBody.tools_config = { google_search_retrieval: { disable: true } };
|
|
371
|
+
proxyBody.tools = sanitizeToolsForVertex(proxyBody.tools);
|
|
372
372
|
}
|
|
373
|
+
else {
|
|
374
|
+
// 3. If no tools left (or only search was present), DELETE 'tools' entirely
|
|
375
|
+
// Sending tools: [] or tools_config without tools causes 400 Bad Request
|
|
376
|
+
delete proxyBody.tools;
|
|
377
|
+
if (proxyBody.tools_config)
|
|
378
|
+
delete proxyBody.tools_config;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
// 4. INJECT STOP SEQUENCES (Fixes "Boucle"/Loop issues) for ALL Gemini requests
|
|
382
|
+
// Gemini 2.5/Flash can be chatty or ignore standard stop tokens.
|
|
383
|
+
if (!proxyBody.stop) {
|
|
384
|
+
proxyBody.stop = ["<|endoftext|>", "User:", "\nUser", "User :", "Model:"];
|
|
373
385
|
}
|
|
374
|
-
log(`[Proxy] Gemini
|
|
386
|
+
log(`[Proxy] Gemini Logic: Tools=${proxyBody.tools ? proxyBody.tools.length : 'REMOVED'}, Stops Injected.`);
|
|
375
387
|
}
|
|
376
388
|
}
|
|
377
389
|
// C. GEMINI ID BACKTRACKING & SIGNATURE
|
package/package.json
CHANGED