browser-assistant 2.9.45 → 2.9.46
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/content.js +10 -7
- package/extension/manifest.json +1 -1
- package/package.json +1 -1
- package/server/main.py +1 -1
package/extension/content.js
CHANGED
|
@@ -2844,7 +2844,7 @@ function mountJournalCountdown(signal) {
|
|
|
2844
2844
|
practice_type: context.question ? 'mcq' : practiceType,
|
|
2845
2845
|
language: context.question ? undefined : requestedLanguage,
|
|
2846
2846
|
verify_answer: true,
|
|
2847
|
-
require_answer_agreement: context.question?.selectionType === 'multiple' || context.question?.type === 'short-answer',
|
|
2847
|
+
require_answer_agreement: context.question?.selectionType === 'single' || context.question?.selectionType === 'multiple' || context.question?.type === 'short-answer',
|
|
2848
2848
|
allow_overview: !context.question && practiceType === 'auto' && !requestedLanguage,
|
|
2849
2849
|
});
|
|
2850
2850
|
if (!res.ok) {
|
|
@@ -2863,7 +2863,7 @@ function mountJournalCountdown(signal) {
|
|
|
2863
2863
|
}
|
|
2864
2864
|
if (!Array.isArray(parsed) || !parsed.length)
|
|
2865
2865
|
throw new Error('The complete question could not be read. No guessed answer was returned.');
|
|
2866
|
-
assertVerifiedScanAnswers(parsed, data.answer_verified, context.question, data.selection_set_verified);
|
|
2866
|
+
assertVerifiedScanAnswers(parsed, data.answer_verified, context.question, data.selection_set_verified, data.answer_agreement);
|
|
2867
2867
|
if (parsed.some(item => item?.type === 'code') && data.code_reviewed !== true) {
|
|
2868
2868
|
throw new Error('The code has not passed review against the screenshot.');
|
|
2869
2869
|
}
|
|
@@ -2890,7 +2890,7 @@ function mountJournalCountdown(signal) {
|
|
|
2890
2890
|
}
|
|
2891
2891
|
}
|
|
2892
2892
|
}
|
|
2893
|
-
function assertVerifiedScanAnswers(results, verified, question, selectionSetVerified = false) {
|
|
2893
|
+
function assertVerifiedScanAnswers(results, verified, question, selectionSetVerified = false, answerAgreement = false) {
|
|
2894
2894
|
if (question && (!Array.isArray(results) || results.length !== 1 || results[0]?.type !== 'mcq')) {
|
|
2895
2895
|
throw new Error('Expected one verified answer for the current question.');
|
|
2896
2896
|
}
|
|
@@ -2899,6 +2899,9 @@ function mountJournalCountdown(signal) {
|
|
|
2899
2899
|
if (verified !== true) {
|
|
2900
2900
|
throw new Error('Answer verification is required. Restart the updated Browser Assistant backend.');
|
|
2901
2901
|
}
|
|
2902
|
+
if (question?.selectionType === 'single' && answerAgreement !== true) {
|
|
2903
|
+
throw new Error('Independent answer agreement is required. No unconfirmed answer was displayed. Update the backend or review the complete question.');
|
|
2904
|
+
}
|
|
2902
2905
|
if (question?.selectionType === 'multiple' && selectionSetVerified !== true) {
|
|
2903
2906
|
throw new Error('The complete checkbox answer could not be verified.');
|
|
2904
2907
|
}
|
|
@@ -2943,7 +2946,7 @@ function mountJournalCountdown(signal) {
|
|
|
2943
2946
|
}
|
|
2944
2947
|
const question = context.question;
|
|
2945
2948
|
const ordering = question.type === 'ordering';
|
|
2946
|
-
context.text = `${question.identityText || question.text}\n${sources.length ? 'Complete code snippets:\n' + sources.join('\n\n') + '\n' : ''}`
|
|
2949
|
+
context.text = `${sources.length ? question.identityText || question.text : question.text}\n${sources.length ? 'Complete code snippets:\n' + sources.join('\n\n') + '\n' : ''}`
|
|
2947
2950
|
+ (ordering ? 'Reorder ALL items. Return the complete permutation as a JSON array of 1-based item numbers.'
|
|
2948
2951
|
: question.type === 'short-answer' ? 'Free response: return only the exact value.'
|
|
2949
2952
|
: question.selectionType === 'multiple' ? 'Select ALL correct options.' : 'Select one answer.')
|
|
@@ -3006,14 +3009,14 @@ function mountJournalCountdown(signal) {
|
|
|
3006
3009
|
image: snapshot.images[0], images: snapshot.images.slice(1),
|
|
3007
3010
|
text: context.text,
|
|
3008
3011
|
url: location.href, practice_type: 'mcq', verify_answer: true,
|
|
3009
|
-
require_answer_agreement: question.selectionType === 'multiple' || question.type === 'short-answer',
|
|
3012
|
+
require_answer_agreement: question.selectionType === 'single' || question.selectionType === 'multiple' || question.type === 'short-answer',
|
|
3010
3013
|
});
|
|
3011
3014
|
}
|
|
3012
3015
|
else {
|
|
3013
3016
|
res = await apiRequest('/solve', 'POST', {
|
|
3014
3017
|
text: question ? context.text : extractSmartText(), url: context.url,
|
|
3015
3018
|
practice_type: question ? 'mcq' : practiceType, verify_answer: Boolean(question) || practiceType !== 'code',
|
|
3016
|
-
require_answer_agreement: question?.selectionType === 'multiple' || question?.type === 'short-answer',
|
|
3019
|
+
require_answer_agreement: question?.selectionType === 'single' || question?.selectionType === 'multiple' || question?.type === 'short-answer',
|
|
3017
3020
|
review_before_submit: !question && practiceType === 'code',
|
|
3018
3021
|
});
|
|
3019
3022
|
}
|
|
@@ -3052,7 +3055,7 @@ function mountJournalCountdown(signal) {
|
|
|
3052
3055
|
parsed = [{ type: "mcq", question: "Result", reasoning: "", answer: raw.substring(0, 200) }];
|
|
3053
3056
|
}
|
|
3054
3057
|
}
|
|
3055
|
-
assertVerifiedScanAnswers(parsed, data.answer_verified, question, data.selection_set_verified);
|
|
3058
|
+
assertVerifiedScanAnswers(parsed, data.answer_verified, question, data.selection_set_verified, data.answer_agreement);
|
|
3056
3059
|
displayResults(parsed, data.provider);
|
|
3057
3060
|
}
|
|
3058
3061
|
catch (error) {
|
package/extension/manifest.json
CHANGED
package/package.json
CHANGED
package/server/main.py
CHANGED
|
@@ -201,7 +201,7 @@ async def lifespan(_app: FastAPI):
|
|
|
201
201
|
client.close()
|
|
202
202
|
|
|
203
203
|
|
|
204
|
-
app = FastAPI(title="Browser Assistant API", version="2.9.
|
|
204
|
+
app = FastAPI(title="Browser Assistant API", version="2.9.46", lifespan=lifespan)
|
|
205
205
|
install_local_guards(app)
|
|
206
206
|
|
|
207
207
|
@app.exception_handler(HTTPException)
|