qwenproxy-cli 1.3.6 → 1.4.0
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/bin/qwenproxy.js +26 -8
- package/dist/clean-cache.js +5076 -0
- package/dist/delete-chats.js +9859 -0
- package/dist/index.js +33946 -0
- package/dist/login.js +6421 -0
- package/dist/reset-cooldowns.js +5462 -0
- package/dist/sync-clients.js +2824 -0
- package/package.json +7 -3
- package/src/api/server.ts +27 -10
- package/src/core/accounts.ts +2 -1
- package/src/core/config.ts +1 -1
- package/src/core/database.ts +139 -0
- package/src/core/paths.ts +0 -6
- package/src/core/version.ts +22 -0
- package/src/routes/chat/retry-policy.ts +4 -0
- package/src/routes/upload.ts +31 -10
- package/src/services/playwright.ts +393 -90
- package/src/services/qwen-chat-pool.ts +26 -0
- package/src/services/qwen-headers.ts +8 -0
- package/src/services/qwen.ts +105 -37
- package/src/tools/parser.ts +7 -1
- package/src/tui/app.ts +2 -12
- package/src/tui/server-manager.ts +3 -1
package/bin/qwenproxy.js
CHANGED
|
@@ -107,14 +107,24 @@ if (firstArg === "start" || rawArgs.includes("--server")) {
|
|
|
107
107
|
scriptArgs = ["--tui", ...rawArgs];
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
const
|
|
110
|
+
const distFile = scriptFile.replace(/^src[\\/]/, "dist/").replace(/\.ts$/, ".js");
|
|
111
|
+
const distPath = path.resolve(packageRoot, distFile);
|
|
112
|
+
let targetPath = path.resolve(packageRoot, scriptFile);
|
|
113
|
+
let runWithTsx = true;
|
|
114
|
+
|
|
115
|
+
if (fs.existsSync(distPath)) {
|
|
116
|
+
targetPath = distPath;
|
|
117
|
+
runWithTsx = false;
|
|
118
|
+
}
|
|
111
119
|
|
|
112
120
|
// Resolve tsx loader relative to the package installation rather than cwd
|
|
113
121
|
let tsxLoaderArg = "tsx";
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
122
|
+
if (runWithTsx) {
|
|
123
|
+
try {
|
|
124
|
+
const tsxEntry = require.resolve("tsx");
|
|
125
|
+
tsxLoaderArg = pathToFileURL(tsxEntry).href;
|
|
126
|
+
} catch {}
|
|
127
|
+
}
|
|
118
128
|
|
|
119
129
|
// Ensure Playwright Chromium is installed only for commands that need the browser
|
|
120
130
|
const browserCommands = ["start", "tui", "login"];
|
|
@@ -183,15 +193,23 @@ if (isBrowserCommand) {
|
|
|
183
193
|
console.log("✓ [QwenProxy] Navegador instalado com sucesso!\n");
|
|
184
194
|
// Automatically prune older, unused browser builds to free up disk space
|
|
185
195
|
try {
|
|
186
|
-
const
|
|
187
|
-
|
|
196
|
+
const cleanModule = fs.existsSync(path.resolve(packageRoot, "dist/clean-cache.js"))
|
|
197
|
+
? await import("../dist/clean-cache.js")
|
|
198
|
+
: await import("../src/clean-cache.ts");
|
|
199
|
+
if (cleanModule.cleanPlaywrightBrowsers) {
|
|
200
|
+
await cleanModule.cleanPlaywrightBrowsers(true);
|
|
201
|
+
}
|
|
188
202
|
} catch {}
|
|
189
203
|
}
|
|
190
204
|
}
|
|
191
205
|
} catch {}
|
|
192
206
|
}
|
|
193
207
|
|
|
194
|
-
const
|
|
208
|
+
const nodeArgs = runWithTsx
|
|
209
|
+
? ["--import", tsxLoaderArg, targetPath, ...scriptArgs]
|
|
210
|
+
: [targetPath, ...scriptArgs];
|
|
211
|
+
|
|
212
|
+
const child = spawn(process.execPath, nodeArgs, {
|
|
195
213
|
stdio: "inherit",
|
|
196
214
|
cwd: process.cwd(),
|
|
197
215
|
env: process.env,
|