User:Polygnotus/Scripts/GeminiProofreaderOld.js: Difference between revisions

Content deleted Content added
Cramulator (talk | contribs)
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1:
// based on User:Polygnotus/Scripts/Claude6.js
// instructions: add the following to your User/common.js file
(function() {
'use strict';
Line 592 ⟶ 593:
if (!wikicode) {
throw new Error('Could not fetch article wikicode');
}
 
if (wikicode.length > 100000) { // Gemini models have input limits, e.g. 1.5 Pro has large context
const confirmed = await new Promise(resolve => {
OO.ui.confirm(`This article is quite long (${wikicode.length} characters). Processing may take a while and use significant API credits. Continue?`)
.done(resolve);
});
 
if (!confirmed) {
this.updateStatus('Operation cancelled by user.');
this.buttons.proofread.setDisabled(false);
return;
}
}
 
Line 612 ⟶ 600:
 
this.updateStatus('Proofreading complete!');
const finalOutput = `${articleTitle}:\n${result}`; // Prepend title to proofreading
this.updateOutput(result, true); // Assume Gemini returns markdown-like text
this.updateOutput(finalOutput, true);
 
} catch (error) {
Line 701 ⟶ 690:
contents: [{
parts: [{ "text": wikicode }],
// role: "user" // role is optional for single turn if not doing multi-turn chat
}],
systemInstruction: {
Line 707 ⟶ 696:
},
generationConfig: {
maxOutputTokens: 409665536, // Maxshould forbe Geminienough 1.0given Pro,1M 2.5 Pro might betoken higherwindow
temperature: 0.30, // For more factual, less creative output
// topP: 0.9}, // Adjust as needed
}tools: [
{urlContext: {}},
{googleSearch: {}},
],
};