The code is not required anymore

This commit is contained in:
yoannchb-pro
2024-01-08 15:58:50 -05:00
parent 5826cd35c8
commit b41ec54a82
5 changed files with 17 additions and 10 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+6 -4
View File
@@ -2,11 +2,13 @@ import Config from "../types/config";
import titleIndications from "../utils/title-indications";
import reply from "./reply";
const pressedKeys: string[] = [];
const listeners: {
type Listener = {
element: HTMLElement;
fn: (this: HTMLElement, ev: MouseEvent) => any;
}[] = [];
};
const pressedKeys: string[] = [];
const listeners: Listener[] = [];
/**
* Create a listener on the keyboard to inject the code
@@ -80,4 +82,4 @@ function removeListener(element: HTMLElement) {
}
}
export { codeListener, removeListener };
export { codeListener, removeListener, setUpMoodleGpt };
+8 -3
View File
@@ -1,9 +1,14 @@
import { codeListener } from "./core/code-listener";
import { codeListener, setUpMoodleGpt } from "./core/code-listener";
import type Config from "./types/config";
chrome.storage.sync.get(["moodleGPT"]).then(function (storage) {
const config = storage.moodleGPT;
const config: Config = storage.moodleGPT;
if (!config) throw new Error("Please configure MoodleGPT into the extension");
codeListener(config);
if (config.code) {
codeListener(config);
} else {
setUpMoodleGpt(config);
}
});
+1 -1
View File
@@ -1,6 +1,6 @@
type Config = {
apiKey: string;
code: string;
code?: string;
model?: string;
infinite?: boolean;
typing?: boolean;