Spaces:
Sleeping
Sleeping
Update server.js with Qwen router fallbacks
Browse files
server.js
CHANGED
|
@@ -120,14 +120,21 @@ Rules:
|
|
| 120 |
deepseek: "You are DeepSeek-Coder, a highly advanced AI developed by DeepSeek. You are an expert in all programming languages and software engineering. Provide clean, efficient, and well-documented code."
|
| 121 |
};
|
| 122 |
|
| 123 |
-
//
|
| 124 |
const DEFAULT_MODEL = process.env.HF_MODEL || "Qwen/Qwen3.8-27B-Uncensored-MXL";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
const MODELS = [
|
| 126 |
-
DEFAULT_MODEL
|
|
|
|
| 127 |
];
|
| 128 |
|
| 129 |
const DEEPSEEK_MODELS = [
|
| 130 |
-
DEFAULT_MODEL
|
|
|
|
| 131 |
];
|
| 132 |
|
| 133 |
// Worker-Local Queue (Scales with number of workers)
|
|
@@ -275,7 +282,7 @@ Rules:
|
|
| 275 |
let messages = [{ role: "system", content: systemContent }, ...history, { role: "user", content: prompt }];
|
| 276 |
|
| 277 |
let activeModel = requestedModel || DEFAULT_MODEL;
|
| 278 |
-
let currentModelList = [activeModel];
|
| 279 |
let lastError = null;
|
| 280 |
|
| 281 |
for (let i = 0; i < currentModelList.length; i++) {
|
|
|
|
| 120 |
deepseek: "You are DeepSeek-Coder, a highly advanced AI developed by DeepSeek. You are an expert in all programming languages and software engineering. Provide clean, efficient, and well-documented code."
|
| 121 |
};
|
| 122 |
|
| 123 |
+
// Configurable Qwen Model (Can be overridden via HF_MODEL env var or UI settings)
|
| 124 |
const DEFAULT_MODEL = process.env.HF_MODEL || "Qwen/Qwen3.8-27B-Uncensored-MXL";
|
| 125 |
+
const FALLBACK_MODELS = [
|
| 126 |
+
"Qwen/Qwen3.6-27B",
|
| 127 |
+
"Qwen/Qwen3.5-27B",
|
| 128 |
+
"Qwen/Qwen2.5-72B-Instruct"
|
| 129 |
+
];
|
| 130 |
const MODELS = [
|
| 131 |
+
DEFAULT_MODEL,
|
| 132 |
+
...FALLBACK_MODELS
|
| 133 |
];
|
| 134 |
|
| 135 |
const DEEPSEEK_MODELS = [
|
| 136 |
+
DEFAULT_MODEL,
|
| 137 |
+
...FALLBACK_MODELS
|
| 138 |
];
|
| 139 |
|
| 140 |
// Worker-Local Queue (Scales with number of workers)
|
|
|
|
| 282 |
let messages = [{ role: "system", content: systemContent }, ...history, { role: "user", content: prompt }];
|
| 283 |
|
| 284 |
let activeModel = requestedModel || DEFAULT_MODEL;
|
| 285 |
+
let currentModelList = [activeModel, ...FALLBACK_MODELS.filter(m => m !== activeModel)];
|
| 286 |
let lastError = null;
|
| 287 |
|
| 288 |
for (let i = 0; i < currentModelList.length; i++) {
|