opencode-pollinations-plugin 5.4.5 → 5.4.6
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 +7 -13
- package/dist/server/generate-config.js +4 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as http from 'http';
|
|
2
2
|
import * as fs from 'fs';
|
|
3
|
-
import { execSync } from 'child_process';
|
|
4
3
|
import { generatePollinationsConfig } from './server/generate-config.js';
|
|
5
4
|
import { loadConfig } from './server/config.js';
|
|
6
5
|
import { handleChatCompletion } from './server/proxy.js';
|
|
@@ -14,15 +13,7 @@ function log(msg) {
|
|
|
14
13
|
}
|
|
15
14
|
catch (e) { }
|
|
16
15
|
}
|
|
17
|
-
|
|
18
|
-
// === ANTI-ZOMBIE (LINUX/MAC LEGACY STABLE) ===
|
|
19
|
-
try {
|
|
20
|
-
log(`[Init] Cleaning port ${TRACKING_PORT}...`);
|
|
21
|
-
execSync(`fuser -k ${TRACKING_PORT}/tcp || true`);
|
|
22
|
-
}
|
|
23
|
-
catch (e) {
|
|
24
|
-
// Ignore on non-Linux or if no process found
|
|
25
|
-
}
|
|
16
|
+
// Port killing removed: Using dynamic ports.
|
|
26
17
|
const startProxy = () => {
|
|
27
18
|
return new Promise((resolve) => {
|
|
28
19
|
const server = http.createServer(async (req, res) => {
|
|
@@ -69,9 +60,12 @@ const startProxy = () => {
|
|
|
69
60
|
res.writeHead(404);
|
|
70
61
|
res.end("Not Found");
|
|
71
62
|
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
63
|
+
// Listen on random port (0) to avoid conflicts (CLI/IDE)
|
|
64
|
+
server.listen(0, '127.0.0.1', () => {
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
const assignedPort = server.address().port;
|
|
67
|
+
log(`[Proxy] Started V5.4.5 (Dynamic Port) on port ${assignedPort}`);
|
|
68
|
+
resolve(assignedPort);
|
|
75
69
|
});
|
|
76
70
|
server.on('error', (e) => {
|
|
77
71
|
log(`[Proxy] Fatal Error: ${e}`);
|
|
@@ -79,7 +79,10 @@ export async function generatePollinationsConfig(forceApiKey) {
|
|
|
79
79
|
if (!hasGemini) {
|
|
80
80
|
log(`[ConfigGen] Force-injecting free/gemini.`);
|
|
81
81
|
modelsOutput.push({ id: "free/gemini", name: "[Free] Gemini Flash (Force)", object: "model", variants: {} });
|
|
82
|
-
|
|
82
|
+
}
|
|
83
|
+
// ALIAS for Full ID matching (Fix ProviderModelNotFoundError) - ALWAYS CHECK SEPARATELY
|
|
84
|
+
const hasGeminiAlias = modelsOutput.find(m => m.id === 'pollinations/free/gemini');
|
|
85
|
+
if (!hasGeminiAlias) {
|
|
83
86
|
modelsOutput.push({ id: "pollinations/free/gemini", name: "[Free] Gemini Flash (Alias)", object: "model", variants: {} });
|
|
84
87
|
}
|
|
85
88
|
// 2. ENTERPRISE UNIVERSE
|
package/package.json
CHANGED