kafox-cli 0.9.6 → 0.9.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/package.json +1 -1
- package/src/gateway.js +3 -1
package/package.json
CHANGED
package/src/gateway.js
CHANGED
|
@@ -258,13 +258,15 @@ async function chat({ messages, model, tools, onDelta, onReasoning, onRetry, sig
|
|
|
258
258
|
const maxAttempts = Math.max(1, Number(retries) || RETRY_MAX);
|
|
259
259
|
let attempt = 0;
|
|
260
260
|
let last = null;
|
|
261
|
+
let clearedKey = false;
|
|
261
262
|
|
|
262
263
|
while (attempt < maxAttempts) {
|
|
263
264
|
attempt += 1;
|
|
264
265
|
const result = await attemptChat({ messages, model, tools, onDelta, onReasoning, signal });
|
|
265
266
|
|
|
266
267
|
if (result.ok || result.code === "aborted") return result;
|
|
267
|
-
if (result.code === "invalid_api_key") {
|
|
268
|
+
if (result.code === "invalid_api_key" && !clearedKey) {
|
|
269
|
+
clearedKey = true;
|
|
268
270
|
storage.clearApiKey();
|
|
269
271
|
continue;
|
|
270
272
|
}
|