Merge pull request #61 from yoannchb-pro/dev

Dev
This commit is contained in:
yoannchb-pro
2025-07-30 11:14:23 -04:00
committed by GitHub
14 changed files with 694 additions and 836 deletions
+6
View File
@@ -1,5 +1,11 @@
# CHANGELOG # CHANGELOG
## v1.1.4
- Support for all `o` models
- Removed `Clear my choice` in the api call
- Code dependencies update
## v1.1.3 ## v1.1.3
- Added `base url` and `max token` in config (by dmunozv04) - Added `base url` and `max token` in config (by dmunozv04)
+2 -2
View File
@@ -2,7 +2,7 @@
href="https://www.flaticon.com/free-icons/mortarboard" target="_blank" rel="noopener noreferrer" href="https://www.flaticon.com/free-icons/mortarboard" target="_blank" rel="noopener noreferrer"
title="Mortarboard icons created by itim2101 - Flaticon" ><img src="./extension/icon.png" alt="Mortarboard icons created by itim2101 - Flaticon" width="150" style="display:block; margin:auto;"></a></p> title="Mortarboard icons created by itim2101 - Flaticon" ><img src="./extension/icon.png" alt="Mortarboard icons created by itim2101 - Flaticon" width="150" style="display:block; margin:auto;"></a></p>
# MoodleGPT 1.1.3 # MoodleGPT 1.1.4
This extension allows you to hide CHAT-GPT in a Moodle quiz. You just need to click on the question you want to solve, and CHAT-GPT will automatically provide the answer. However, one needs to be careful because as we know, CHAT-GPT can make errors especially in calculations. This extension allows you to hide CHAT-GPT in a Moodle quiz. You just need to click on the question you want to solve, and CHAT-GPT will automatically provide the answer. However, one needs to be careful because as we know, CHAT-GPT can make errors especially in calculations.
@@ -12,7 +12,7 @@ Find the extension on the Chrome Webstore right [here](https://chrome.google.com
## Summary ## Summary
- [MoodleGPT 1.1.3](#moodlegpt-113) - [MoodleGPT 1.1.4](#moodlegpt-114)
- [Chrome Webstore](#chrome-webstore) - [Chrome Webstore](#chrome-webstore)
- [Summary](#summary) - [Summary](#summary)
- [Disclaimer !](#disclaimer-) - [Disclaimer !](#disclaimer-)
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"manifest_version": 3, "manifest_version": 3,
"name": "MoodleGPT", "name": "MoodleGPT",
"version": "1.1.3", "version": "1.1.4",
"description": "Hidden chat-gpt for your moodle quiz", "description": "Hidden chat-gpt for your moodle quiz",
"permissions": ["storage"], "permissions": ["storage"],
"action": { "action": {
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+657 -810
View File
File diff suppressed because it is too large Load Diff
+14 -13
View File
@@ -1,6 +1,6 @@
{ {
"name": "moodlegpt", "name": "moodlegpt",
"version": "1.1.3", "version": "1.1.4",
"description": "This extension allows you to hide CHAT-GPT in a Moodle quiz.", "description": "This extension allows you to hide CHAT-GPT in a Moodle quiz.",
"scripts": { "scripts": {
"build": "npm run prettier && npm run lint && npm run fastBuild", "build": "npm run prettier && npm run lint && npm run fastBuild",
@@ -26,21 +26,22 @@
}, },
"homepage": "https://github.com/yoannchb-pro/MoodleGPT#readme", "homepage": "https://github.com/yoannchb-pro/MoodleGPT#readme",
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.22.0", "@eslint/js": "^9.32.0",
"@rollup/plugin-commonjs": "^28.0.2", "@rollup/plugin-commonjs": "^28.0.6",
"@rollup/plugin-node-resolve": "^16.0.0", "@rollup/plugin-node-resolve": "^16.0.0",
"@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.2", "@rollup/plugin-typescript": "^12.1.4",
"@types/chrome": "^0.0.309", "@types/chrome": "^0.1.1",
"@types/node": "^24.1.0",
"@typescript-eslint/eslint-plugin": "^8.26.1", "@typescript-eslint/eslint-plugin": "^8.26.1",
"@typescript-eslint/parser": "^8.26.1", "@typescript-eslint/parser": "^8.38.0",
"eslint": "^9.22.0", "eslint": "^9.32.0",
"eslint-config-prettier": "^10.1.1", "eslint-config-prettier": "^10.1.8",
"openai": "^4.78.1", "openai": "^5.11.0",
"prettier": "^3.2.5", "prettier": "^3.6.2",
"rollup": "^4.13.0", "rollup": "^4.46.2",
"rollup-plugin-ts": "^3.2.0", "rollup-plugin-ts": "^3.2.0",
"typescript": "^5.4.2", "typescript": "^5.8.3",
"typescript-eslint": "^8.26.1" "typescript-eslint": "^8.38.0"
} }
} }
+2
View File
@@ -20,6 +20,8 @@ function createAndNormalizeQuestion(questionContainer: HTMLElement) {
if (attoText) { if (attoText) {
question = question.replace((attoText as HTMLElement).innerText, ''); question = question.replace((attoText as HTMLElement).innerText, '');
} }
const clearMyChoice = questionContainer.querySelector('[role="button"]');
if (clearMyChoice) question = question.replace((clearMyChoice as HTMLElement).innerText, '');
// Make tables more readable for chat-gpt // Make tables more readable for chat-gpt
const tables: NodeListOf<HTMLTableElement> = questionContainer.querySelectorAll('.qtext table'); const tables: NodeListOf<HTMLTableElement> = questionContainer.querySelectorAll('.qtext table');
+2 -2
View File
@@ -3,7 +3,7 @@ import type GPTAnswer from '../types/gpt-answer';
import normalizeText from 'background/utils/normalize-text'; import normalizeText from 'background/utils/normalize-text';
import getContentWithHistory from './get-content-with-history'; import getContentWithHistory from './get-content-with-history';
import OpenAI from 'openai'; import OpenAI from 'openai';
import { fixeO1 } from '../utils/fixe-o1'; import { fixeO } from '../utils/fixe-o';
/** /**
* Get the response from chatGPT api * Get the response from chatGPT api
@@ -30,7 +30,7 @@ async function getChatGPTResponse(
}); });
const req = await client.chat.completions.create( const req = await client.chat.completions.create(
fixeO1(config.model, { fixeO(config.model, {
model: config.model, model: config.model,
messages: contentHandler.messages, messages: contentHandler.messages,
@@ -6,8 +6,8 @@ import { ChatCompletionCreateParamsNonStreaming } from 'openai/resources/chat/co
* @param data * @param data
* @returns * @returns
*/ */
export function fixeO1(model: string, data: ChatCompletionCreateParamsNonStreaming) { export function fixeO(model: string, data: ChatCompletionCreateParamsNonStreaming) {
if (!model.startsWith('o1')) return data; if (model.search(/^o\d+/gi) === -1) return data;
if (data.max_tokens) { if (data.max_tokens) {
data.max_completion_tokens = data.max_tokens; data.max_completion_tokens = data.max_tokens;
+3 -1
View File
@@ -40,7 +40,9 @@ export async function populateDatalistWithGptVersions() {
const models = rep.data.filter( const models = rep.data.filter(
model => model =>
model.id.startsWith('gpt') || model.id.startsWith('o1') || model.id.startsWith('chatgpt') model.id.startsWith('gpt') ||
model.id.search(/^o\d+/gi) !== -1 ||
model.id.startsWith('chatgpt')
); );
models.sort((a, b) => b.id.localeCompare(a.id)); // we sort the model to get the best chatgpt version first models.sort((a, b) => b.id.localeCompare(a.id)); // we sort the model to get the best chatgpt version first
+1 -1
View File
@@ -1,4 +1,4 @@
const CURRENT_VERSION = '1.1.3'; const CURRENT_VERSION = '1.1.4';
const versionDisplay = document.querySelector('#version')!; const versionDisplay = document.querySelector('#version')!;
/** /**