browser-assistant 2.9.41 → 2.9.42
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/extension/answer-requests.js +5 -3
- package/extension/manifest.json +1 -1
- package/package.json +1 -1
- package/server/.env.example +4 -0
- package/server/main.py +11 -6
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
return error;
|
|
19
19
|
}
|
|
20
20
|
function temporary(error) {
|
|
21
|
-
//
|
|
21
|
+
// Retry exhausted vision keys only after their explicit cooldown expires.
|
|
22
22
|
if (error.code === 'vision_rate_limited')
|
|
23
|
-
return
|
|
23
|
+
return Number.isFinite(error.retryAfterMs) && error.retryAfterMs > 0;
|
|
24
24
|
const text = error?.message || '';
|
|
25
25
|
if (/access denied|forbidden|unauthorized|invalid.api.key|not configured|validation|not.support|model.*(?:not found|not exist)|illustration changed|question changed|context invalidated|extension was reloaded|no readable|unparseable/i.test(text))
|
|
26
26
|
return false;
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
catch (error) {
|
|
49
49
|
if (!active())
|
|
50
50
|
return null;
|
|
51
|
-
if (attempt === attempts || !temporary(error) || error.retryAfterMs >
|
|
51
|
+
if (attempt === attempts || !temporary(error) || error.retryAfterMs > 300_000)
|
|
52
52
|
throw error;
|
|
53
53
|
onRetry({ attempt: attempt + 1, attempts, message: error.message });
|
|
54
54
|
// Short waits keep Stop/Pause responsive. Revalidate before the
|
|
@@ -57,6 +57,8 @@
|
|
|
57
57
|
for (let elapsed = 0; elapsed < delay; elapsed += 100) {
|
|
58
58
|
if (!active())
|
|
59
59
|
return null;
|
|
60
|
+
if (!current())
|
|
61
|
+
throw new Error('Question changed while requesting an answer. No answer was selected.');
|
|
60
62
|
await sleep(Math.min(100, delay - elapsed));
|
|
61
63
|
}
|
|
62
64
|
}
|
package/extension/manifest.json
CHANGED
package/package.json
CHANGED
package/server/.env.example
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
GROQ_API_KEY=
|
|
3
3
|
GROQ_API_KEY_2=
|
|
4
4
|
GROQ_API_KEY_3=
|
|
5
|
+
GROQ_API_KEY_4=
|
|
6
|
+
GROQ_API_KEY_5=
|
|
7
|
+
GROQ_API_KEY_6=
|
|
8
|
+
GROQ_API_KEY_7=
|
|
5
9
|
GROQ_TEXT_MODEL=openai/gpt-oss-120b
|
|
6
10
|
GROQ_VISION_MODEL=qwen/qwen3.8-27b
|
|
7
11
|
# Optional comma-separated vision models available on YOUR account; empty by default.
|
package/server/main.py
CHANGED
|
@@ -41,11 +41,16 @@ logger = logging.getLogger("browser-assistant")
|
|
|
41
41
|
load_dotenv(Path(__file__).with_name('.env'))
|
|
42
42
|
|
|
43
43
|
# Setup Groq — multiple API keys for rate-limit rotation
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
def load_groq_keys():
|
|
45
|
+
"""Load up to seven distinct configured credentials in stable order."""
|
|
46
|
+
keys = []
|
|
47
|
+
for env_var in ["GROQ_API_KEY", *[f"GROQ_API_KEY_{i}" for i in range(2, 8)]]:
|
|
48
|
+
key = os.getenv(env_var, "").strip()
|
|
49
|
+
if key and key != "your_groq_api_key_here" and key not in keys:
|
|
50
|
+
keys.append(key)
|
|
51
|
+
return keys
|
|
52
|
+
|
|
53
|
+
_groq_keys = load_groq_keys()
|
|
49
54
|
|
|
50
55
|
# Retry rotation is handled below. Disable the SDK's long exponential retry so
|
|
51
56
|
# a rate-limited key cannot hold up every next question before we try another.
|
|
@@ -195,7 +200,7 @@ async def lifespan(_app: FastAPI):
|
|
|
195
200
|
client.close()
|
|
196
201
|
|
|
197
202
|
|
|
198
|
-
app = FastAPI(title="Browser Assistant API", version="2.9.
|
|
203
|
+
app = FastAPI(title="Browser Assistant API", version="2.9.42", lifespan=lifespan)
|
|
199
204
|
install_local_guards(app)
|
|
200
205
|
|
|
201
206
|
@app.exception_handler(HTTPException)
|