User talk:Polygnotus/Scripts/AI Proofreader

support in different language

edit

When I use this in English, it works well. And I could see "AI" button in after talk page. But in Malayalam wikipedia, I am unable to see this. Could you guide to fix this error. Akbarali (talk) 12:20, 6 August 2025 (UTC)Reply

@Akbarali I see you added it to your common.js over there.
Try removing the line that contains the word "Polygnotus" and adding the following:
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Polygnotus/Scripts/AI Proofreader.js&action=raw&ctype=text/javascript');
Hope that helps, Polygnotus (talk) 12:33, 6 August 2025 (UTC)Reply

Thanks

edit

I ran your script in couple of article I started, and it managed to catch many undetected prose errors.

One suggestion I have is to update the models to the latest ones, particularly the GPT model. Ca talk to me! 06:09, 1 December 2025 (UTC)Reply

@Ca Thank you! Good idea I will add it to the list. Polygnotus (talk) 06:19, 1 December 2025 (UTC)Reply
@Ca  Done Polygnotus (talk) 06:38, 1 December 2025 (UTC)Reply

How to use it?

edit

This sounds like a nice tool, but it desparately needs documentation on how to use it. Right now it terrible. Maybe AI can help write up the doc :P The best hint is, sigh, here, in the first post that says something about "AI" button "in after the talk page". It took me five minutes to notice it. This needs to be spelled out on the main script doc page, preferably with a screenshot. Piotr Konieczny aka Prokonsul Piotrus| reply here 13:29, 10 December 2025 (UTC)Reply

Agreed. I added a screenshot and resisted the temptation to add a huge red blinking rotating arrow. Polygnotus (talk) 11:08, 11 December 2025 (UTC)Reply
I'd add the arrow :P Piotr Konieczny aka Prokonsul Piotrus| reply here 11:21, 11 December 2025 (UTC)Reply

Broken?

edit

I tried using this and get: "Error: API request failed (400): {"type":"error","error":{"type":"invalid_request_error","message":"Your credit balance is too low to access the Anthropic API. Please go to Plans & Billing to upgrade or purchase credits."},"request_id":"req_011CVy67fEGhCVtDkkSCQCrb"}" Piotr Konieczny aka Prokonsul Piotrus| reply here 13:32, 10 December 2025 (UTC)Reply

Ah, it seems this is not a free service (and it's even separate from my paid ChatGPT account). So... yeah, nice script idea, but the tool is useless for 99% of the editors, sigh. Piotr Konieczny aka Prokonsul Piotrus| reply here 13:37, 10 December 2025 (UTC)Reply
@Piotrus I already responded here. Polygnotus (talk) 13:58, 10 December 2025 (UTC)Reply

Tested on pl wiki

edit

In just one article. Overall, pretty good, caught a few small errors and made some good style suggestions, and made two reasonable comments about parts of the article that could use clarification. One minor error, however - somehow it also falsely saw (hallicinated) a grammar error/typo which was not in the article. But overall, seems useful :) Piotr Konieczny aka Prokonsul Piotrus| reply here 10:38, 11 December 2025 (UTC)Reply

@Piotrus Well, try a bunch more. As the kids say, one datapoint is no datapoint. Polygnotus (talk) 10:54, 11 December 2025 (UTC)Reply
Will do, time permitting. Piotr Konieczny aka Prokonsul Piotrus| reply here 11:05, 11 December 2025 (UTC)Reply

Some comments

edit

Hi Polygnotus, I gave your script User:Polygnotus/Scripts/AI Proofreader.js a try. I like the layout with the proofreading suggestions on the side next to the text, and its nice to be able to choose from several LLMs. I saw that the script asks the LLMs to review the wikicode/wikitext of articles. Is there a specific reason for this approach? An alternative would be to provide regular text, for example, by extracting it from the article HTML using the innerText property (e.g. $('#mw-content-text').text(); this runs into some issues so it may be a little more complicated than that). The idea is that LLMs have more training on regular text than wikitext, so they should handle it better. It's also shorter and more focused: for the purpose of proofreading, most relevant information should be contained in the regular text. Phlsph7 (talk) 15:19, 29 December 2025 (UTC)Reply

@Phlsph7 Sorry for the late reply.
In my testing, the LLMs did susprisingly well with wikitext. Probably because they were trained on so much of it.
I mostly use Claude and, while it struggles with some more esoteric computer languages, it does great with wikitext. For the record I would also struggle with trying to recall, for example, Delphi; there is just no reason to use it these days. I don't exactly know how large the full revision history is but I imagine it is very very large. And CommonCrawl also contains many other wikis, even the horrible fandom and the like.
Are there situations in which you find it struggles with wikitext? Polygnotus (talk) 06:23, 23 February 2026 (UTC)Reply
I had issues when trying modify wikitext. For example, when telling an LLM to fix spelling mistakes, it would also make unrelated changes to templates. With earlier models, I also had an issue where references were removed. Maybe these issues are not relevant in your case since the script reads wikitext but does not suggest wikitext changes. I presume wikitext makes the task more complicated since it includes information not directly relevant to the proofreading. However, if it works, then it may not matter much. Phlsph7 (talk) 13:45, 25 February 2026 (UTC)Reply

does this conflict with other js?

edit

because the AI button is not showing, even if i switched to vector 2010. im using vector 2022. 203N7HN6 (talk) 10:24, 20 February 2026 (UTC)Reply

@203N7HN6 Should work now, please try again. Polygnotus (talk) 06:08, 23 February 2026 (UTC)Reply
works now, thanks lots! 203N7HN6 (talk) 06:10, 23 February 2026 (UTC)Reply

Script error console output

edit

Hello, how should I fix this critical error that prevents the script from working? Here is the console output:

Uncaught (in promise) TypeError: can't access property "addEventListener", aiLink is null

   createAITab index.php:380
   createUI index.php:93
   init index.php:41
   promise callback*init index.php:40
   WikipediaAIProofreader index.php:36
   <anonymous> index.php:977
   jQuery 11
   <anonymous> index.php:976
   jQuery 9
   using mediawiki.base.js:904
   doPropagation startup.js:769
   requestIdleCallback handler*setAndPropagate startup.js:826
   markModuleReady startup.js:1246
   runScript startup.js:1280
   cssHandle startup.js:1356
   flushCssBuffer startup.js:602
   addEmbeddedCSS startup.js:633
   execute startup.js:1370
   doPropagation startup.js:753
   requestIdleCallback handler*setAndPropagate startup.js:826
   impl startup.js:2015
   <anonymous> load.php:1 Pietrus1 (talk) 05:30, 23 February 2026 (UTC)Reply
@Pietrus1 Which skin are you using? Polygnotus (talk) 05:35, 23 February 2026 (UTC)Reply
Legacy Vector. It seems that was indeed the issue, thanks! Pietrus1 (talk) 05:41, 23 February 2026 (UTC)Reply
@Pietrus1 Try it again please and let me know if it works now. Polygnotus (talk) 05:40, 23 February 2026 (UTC)Reply
It works in 2022 Vector, but not legacy Vector still. The only issue appears to be the AI tab itself. The proofreader itself works when forced open in legacy Vector view. Pietrus1 (talk) 05:42, 23 February 2026 (UTC)Reply
@Pietrus1 Can you check again? Polygnotus (talk) 06:04, 23 February 2026 (UTC)Reply
You took care of the issue. Thanks a million. Pietrus1 (talk) 06:07, 23 February 2026 (UTC)Reply

Support for different prompt languages

edit

Hello @Polygnotus: thanks a lot for providing this script! As a result of

I found the AI proofreader, which has been presented at

  • One result was, that users would prefer non commercial / open source LLMs or a LLM operated by WMF and en:Explainable Artificial Intelligence instead of commercial LLMs.
  • Another question concerns the language of the prompt. Would it be possible to have a drop down to select the prompt language, so the prompt could be for example in German?

Thanks a lot! --M2k~dewiki (talk) 21:22, 30 April 2026 (UTC)Reply

@M2k~dewiki Hiya! Thank you!
I'll ping @Alaexis: who rewrote User:Polygnotus/Scripts/AI Source Verification.
I think we should make a helper script for "add a sidebar next to Wikipedia that can be opened and closed".
And I think we can abstract away the whole "contact external LLM provider"-bit in another re-usable helper.
As an example I have User:Polygnotus/Helpers/Sidebar.js which is used by both User:Polygnotus/Scripts/RFCTracker.js and User:Polygnotus/Scripts/Editwars.js.
What do you think? Polygnotus (talk) 22:26, 30 April 2026 (UTC)Reply
Hi, thanks for pinging me. @M2k~dewiki, we actually have an informal partnership with PublicAI.co and the Source Verifier tool uses a model hosted there as the default free option. @Polygnotus, if you ever decide to start using it too you know where to get the keys :) You can also use my existing proxy. Abstracting it as a "contact external LLM provider" helper script would be very helpful. Note that you'd still need to have *something* outside of en:wiki to, e.g., manage secrets. Toolforge, perhaps? Alaexis¿question? 08:02, 1 May 2026 (UTC)Reply
@DaWalda: A german language version has been translated at de:Benutzer:DaWalda/Scripts/KI Korrekturleser.js M2k~dewiki (talk) 11:05, 1 May 2026 (UTC)Reply