opencode-pollinations-plugin 5.4.14 → 5.4.15
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/server/proxy.js +19 -1
- package/package.json +1 -1
package/dist/server/proxy.js
CHANGED
|
@@ -260,7 +260,25 @@ export async function handleChatCompletion(req, res, bodyRaw) {
|
|
|
260
260
|
// B. SAFETY NETS (The Core V5 Logic)
|
|
261
261
|
if (config.mode === 'alwaysfree') {
|
|
262
262
|
if (isEnterprise) {
|
|
263
|
-
|
|
263
|
+
// NEW: Paid Only Check for Always Free
|
|
264
|
+
// If the user asks for a 💎 Paid Only model while in Always Free, we BLOCK it to save wallet
|
|
265
|
+
// and fallback to free specific message.
|
|
266
|
+
try {
|
|
267
|
+
const homedir = process.env.HOME || '/tmp';
|
|
268
|
+
const standardPaidPath = path.join(homedir, '.pollinations', 'pollinations-paid-models.json');
|
|
269
|
+
if (fs.existsSync(standardPaidPath)) {
|
|
270
|
+
const paidModels = JSON.parse(fs.readFileSync(standardPaidPath, 'utf-8'));
|
|
271
|
+
if (paidModels.includes(actualModel)) {
|
|
272
|
+
log(`[SafetyNet] alwaysfree Mode: Request for Paid Only Model (${actualModel}). FALLBACK.`);
|
|
273
|
+
actualModel = config.fallbacks.free.main.replace('free/', '');
|
|
274
|
+
isEnterprise = false;
|
|
275
|
+
isFallbackActive = true;
|
|
276
|
+
fallbackReason = "Mode AlwaysFree actif: Ce modèle payant consomme du wallet. Passez en mode PRO.";
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
catch (e) { }
|
|
281
|
+
if (!isFallbackActive && quota.tier === 'error') {
|
|
264
282
|
log(`[SafetyNet] AlwaysFree Mode: Quota Check Failed. Switching to Free Fallback.`);
|
|
265
283
|
actualModel = config.fallbacks.free.main.replace('free/', '');
|
|
266
284
|
isEnterprise = false;
|
package/package.json
CHANGED