Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f581bc2788 | |||
| ae9e528ac0 | |||
| d4c1e31745 | |||
| d6d6263e3d | |||
| 3dac74cf4c | |||
| 018877d907 | |||
| 76aefa56e0 | |||
| 3c03e444d1 | |||
| 1ed156363d | |||
| 79eb20bcca |
@@ -1,5 +1,11 @@
|
||||
# CHANGELOG
|
||||
|
||||
## v1.0.1
|
||||
|
||||
- Removed langage
|
||||
- Added a button next to model to get the last ChatGPT version
|
||||
- Added update message
|
||||
|
||||
## v1.0.0
|
||||
|
||||
- Initial commit
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
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>
|
||||
|
||||
# Moodle-gpt
|
||||
# MoodleGPT v1.0.1
|
||||
|
||||
This extension allows you to hide CHAT-GPT in a Moodle quiz. You just need to enter <b>the code configured in the extension</b> on the keyboard and then 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.
|
||||
|
||||
@@ -20,7 +20,9 @@ If MoodleGPT cannot complete one of your moodle quiz please provide the html cod
|
||||
|
||||
## Set up
|
||||
|
||||
Go to <b>"Manage my extensions"</b> on your browser, then click on <b>"Load unpacked extension"</b> and select the <b>"extension"</b> folder. Afterwards, click on the extension icons and enter the apiKey obtained from [openai](https://platform.openai.com/). Finally, enter a code that will activate the extension on your moodle page and click on the save button (The extension need to be configured before entering the moodle quiz).
|
||||
> NOTE: This extension only works on Chromium-based browsers like Edge, Chrome, etc. Unfortunately, Firefox requires a click on the extension, which is not very discreet.
|
||||
|
||||
Go to <b>"Manage my extensions"</b> on your browser, then click on <b>"Load unpacked extension"</b> and select the <b>"extension"</b> folder. Afterwards, click on the extension icon and enter the apiKey obtained from [openai](https://platform.openai.com/) and enter a <b>code</b> that will activate the extension on your moodle page. Finally, click on the <b>reload button</b> next to model (it should give you the last ChatGPT version, otherwise enter it by your self) and click on the save button (The extension need to be configured before entering the moodle quiz).
|
||||
|
||||
## Inject the code into the moodle
|
||||
|
||||
@@ -36,22 +38,21 @@ Type back the <b>code</b> on the keyboard and the code will be removed from the
|
||||
<img src="./assets/popup.png" alt="Popup" height="300">
|
||||
</p>
|
||||
|
||||
- <b>Api key\*</b>: the openai api key.
|
||||
- <b>Code\*</b>: code that you will need to inject/remove the code.
|
||||
- <b>Langage</b>: the langage you want chatgpt reply (if it's not set it will take the question langage).
|
||||
- <b>GPT Model</b>: the gpt model you want to use (by default it's "gpt-3.5-turbo").
|
||||
- <b>Api key</b>: the openai api key.
|
||||
- <b>Code</b>: code that you will need to inject/remove the code.
|
||||
- <b>GPT Model</b>: the gpt model you want to use. You can click on the reload button to get the latest version of available gpt model for your account but you need to enter the api key first.
|
||||
- <b>Cursor indication</b>: show a pointer cursor and a hourglass to know when the request is finished.
|
||||
- <b>Title indication</b>: show some informations into the title to know for example if the code have been injected.
|
||||
<br/> 
|
||||
- <b>Console logs</b>: show logs into the console.
|
||||
<br/><img src="./assets/logs.png" alt="Logs" width="250">
|
||||
- <b>Request timeout</b>: If the request is too long it will be abort after 10seconds.
|
||||
- <b>Request timeout</b>: if the request is too long it will be abort after 10seconds.
|
||||
- <b>Typing effect</b>: create a typing effect for text. Type any text and it will be replaced by the correct one. If you want to stop it press <b>Backspace</b> key.
|
||||
<br/> 
|
||||
- <b>Mouseover effect</b>: you will need to hover (or click for select) the question response to complete it automaticaly.
|
||||
<br/> 
|
||||
<br/> 
|
||||
- <b>Table formatting</b>: Format table from the question to make it more readable for CHAT-GPT but cost most tokens (so if the question is too large it will make an error). Example of formatted table:
|
||||
- <b>Table formatting</b>: format table from the question to make it more readable for CHAT-GPT but cost most tokens (so if the question is too large it will make an error). Example of formatted table:
|
||||
|
||||
```
|
||||
| id | name | birthDate | cars |
|
||||
@@ -104,4 +105,4 @@ To know if the answer has been copied to the clipboard, you can look at the titl
|
||||
|
||||
## Test
|
||||
|
||||
To test the code, you can run the index.html file located in the <b>"test"</b> folder with a local server on localhost. Or a better solution is to install moodle locally.
|
||||
To test the code, you can run the index.html file located in the <b>"test"</b> folder. Or a better solution is to install moodle locally.
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 55 KiB |
@@ -13,29 +13,29 @@
|
||||
setTimeout(() => (document.title = backTitle), 3000);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
function __awaiter(thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
function __awaiter(thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
}
|
||||
|
||||
class Logs {
|
||||
@@ -87,7 +87,7 @@
|
||||
},
|
||||
signal: config.timeout ? controller.signal : null,
|
||||
body: JSON.stringify({
|
||||
model: config.model && config.model !== "" ? config.model : "gpt-3.5-turbo",
|
||||
model: config.model,
|
||||
messages: [{ role: "user", content: question }],
|
||||
temperature: 0.8,
|
||||
top_p: 1.0,
|
||||
@@ -147,10 +147,8 @@
|
||||
question = question.replace(table.textContent, "\n" + htmlTableToString(table) + "\n");
|
||||
}
|
||||
}
|
||||
const finalQuestion = `Give a short response as possible for this question, reply in ${config.langage && config.langage !== ""
|
||||
? 'this langage "' + config.langage + '"'
|
||||
: "the following question langage"} and only show the result:
|
||||
${question}
|
||||
const finalQuestion = `Give a short response as possible for this question, reply in the following question langage and only show the result:
|
||||
${question}
|
||||
(If you have to choose between multiple results only show the corrects one, separate them with new line and take the same text as the question)`;
|
||||
return normalizeText(finalQuestion);
|
||||
}
|
||||
@@ -460,4 +458,4 @@
|
||||
});
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=moodle-gpt.js.map
|
||||
//# sourceMappingURL=MoodleGPT.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "moddle-gpt",
|
||||
"version": "1.0",
|
||||
"description": "Hidden chat-gpt for moodle cheat",
|
||||
"name": "MoodleGPT",
|
||||
"version": "1.0.1",
|
||||
"description": "Hidden chat-gpt for your moodle quiz",
|
||||
"permissions": ["activeTab", "tabs", "storage"],
|
||||
"action": {
|
||||
"default_icon": "icon.png",
|
||||
@@ -19,11 +19,13 @@
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": [
|
||||
"*://*/**/mod/quiz/*",
|
||||
"*://*/mod/quiz/*",
|
||||
"http://localhost:*/*",
|
||||
"http://127.0.0.1:*/*"
|
||||
"http://127.0.0.1:*/*",
|
||||
"file:///*"
|
||||
],
|
||||
"js": ["moodle-gpt.js"],
|
||||
"js": ["MoodleGPT.js"],
|
||||
"run_at": "document_end"
|
||||
}
|
||||
]
|
||||
|
||||
File diff suppressed because one or more lines are too long
+23
-10
@@ -6,8 +6,16 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>MoodleGPT</title>
|
||||
<link rel="stylesheet" href="style.css" />
|
||||
<script src="index.js" defer></script>
|
||||
<script src="./js/index.js" defer></script>
|
||||
<script src="./js/version.js" defer></script>
|
||||
<link rel="icon" type="image/png" href="../icon.png" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
|
||||
integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw=="
|
||||
crossorigin="anonymous"
|
||||
referrerpolicy="no-referrer"
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
@@ -18,22 +26,27 @@
|
||||
title="Mortarboard icons created by itim2101 - Flaticon"
|
||||
><img src="../icon.png" alt="icon"
|
||||
/></a>
|
||||
<h1>MoodleGPT</h1>
|
||||
<div class="line center">
|
||||
<label for="apiKey" class="textLabel">Api Key*</label>
|
||||
<input id="apiKey" type="password" />
|
||||
<div class="col center title">
|
||||
<h1>MoodleGPT</h1>
|
||||
<p id="version"></p>
|
||||
</div>
|
||||
<div class="line center">
|
||||
<label for="code" class="textLabel">Code*</label>
|
||||
<label for="apiKey" class="textLabel">Api Key</label>
|
||||
<input id="apiKey" type="text" />
|
||||
</div>
|
||||
<div class="line center">
|
||||
<label for="code" class="textLabel">Code</label>
|
||||
<input id="code" type="text" />
|
||||
</div>
|
||||
<div class="line center">
|
||||
<label for="langage" class="textLabel">Langage</label>
|
||||
<input id="langage" type="text" />
|
||||
</div>
|
||||
<div class="line center">
|
||||
<label for="model" class="textLabel">GPT Model</label>
|
||||
<input id="model" type="text" />
|
||||
<i
|
||||
id="reloadModel"
|
||||
class="fa-solid fa-rotate-right"
|
||||
disabled
|
||||
title="Provide an api key first"
|
||||
></i>
|
||||
</div>
|
||||
<div class="line center" style="margin-top: 1rem">
|
||||
<div class="col">
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
const saveBtn = document.querySelector(".save");
|
||||
const message = document.querySelector("#message");
|
||||
|
||||
const inputsText = ["apiKey", "code", "langage", "model"];
|
||||
const inputsCheckbox = [
|
||||
"logs",
|
||||
"title",
|
||||
"cursor",
|
||||
"typing",
|
||||
"mouseover",
|
||||
"infinite",
|
||||
"table",
|
||||
"timeout",
|
||||
];
|
||||
|
||||
function showMessage(messageTxt, valide) {
|
||||
message.style.color = valide ? "limegreen" : "red";
|
||||
message.textContent = messageTxt;
|
||||
message.style.display = "block";
|
||||
setTimeout(() => (message.style.display = "none"), 5000);
|
||||
}
|
||||
|
||||
//save the configuration
|
||||
saveBtn.addEventListener("click", function () {
|
||||
const [apiKey, code, langage, model] = inputsText.map((selector) =>
|
||||
document.querySelector("#" + selector).value.trim()
|
||||
);
|
||||
const [logs, title, cursor, typing, mouseover, infinite, table, timeout] =
|
||||
inputsCheckbox.map(
|
||||
(selector) => document.querySelector("#" + selector).checked
|
||||
);
|
||||
|
||||
if (!apiKey || !code) {
|
||||
showMessage("Please comple all the form");
|
||||
return;
|
||||
}
|
||||
|
||||
if (code.length < 3) {
|
||||
showMessage("The code should at least contain 3 characters");
|
||||
return;
|
||||
}
|
||||
|
||||
chrome.storage.sync.set({
|
||||
moodleGPT: {
|
||||
apiKey,
|
||||
code,
|
||||
langage,
|
||||
model,
|
||||
logs,
|
||||
title,
|
||||
cursor,
|
||||
typing,
|
||||
mouseover,
|
||||
infinite,
|
||||
table,
|
||||
timeout,
|
||||
},
|
||||
});
|
||||
|
||||
showMessage("Configuration saved", true);
|
||||
});
|
||||
|
||||
//we load back the configuration
|
||||
chrome.storage.sync.get(["moodleGPT"]).then(function (storage) {
|
||||
if (storage.moodleGPT) {
|
||||
const config = storage.moodleGPT;
|
||||
inputsText.forEach(
|
||||
(key) => (document.querySelector("#" + key).value = config[key] || "")
|
||||
);
|
||||
inputsCheckbox.forEach(
|
||||
(key) => (document.querySelector("#" + key).checked = config[key] || "")
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,121 @@
|
||||
const saveBtn = document.querySelector(".save");
|
||||
const message = document.querySelector("#message");
|
||||
|
||||
const inputsText = ["apiKey", "code", "model"];
|
||||
const inputsCheckbox = [
|
||||
"logs",
|
||||
"title",
|
||||
"cursor",
|
||||
"typing",
|
||||
"mouseover",
|
||||
"infinite",
|
||||
"table",
|
||||
"timeout",
|
||||
];
|
||||
|
||||
function showMessage(messageTxt, valide) {
|
||||
message.style.color = valide ? "limegreen" : "red";
|
||||
message.textContent = messageTxt;
|
||||
message.style.display = "block";
|
||||
setTimeout(() => (message.style.display = "none"), 5000);
|
||||
}
|
||||
|
||||
//save the configuration
|
||||
saveBtn.addEventListener("click", function () {
|
||||
const [apiKey, code, model] = inputsText.map((selector) =>
|
||||
document.querySelector("#" + selector).value.trim()
|
||||
);
|
||||
const [logs, title, cursor, typing, mouseover, infinite, table, timeout] =
|
||||
inputsCheckbox.map(
|
||||
(selector) => document.querySelector("#" + selector).checked
|
||||
);
|
||||
|
||||
if (!apiKey || !code || !model) {
|
||||
showMessage("Please complete all the form");
|
||||
return;
|
||||
}
|
||||
|
||||
if (code.length < 3) {
|
||||
showMessage("The code should at least contain 3 characters");
|
||||
return;
|
||||
}
|
||||
|
||||
chrome.storage.sync.set({
|
||||
moodleGPT: {
|
||||
apiKey,
|
||||
code,
|
||||
model,
|
||||
logs,
|
||||
title,
|
||||
cursor,
|
||||
typing,
|
||||
mouseover,
|
||||
infinite,
|
||||
table,
|
||||
timeout,
|
||||
},
|
||||
});
|
||||
|
||||
showMessage("Configuration saved", true);
|
||||
});
|
||||
|
||||
//we load back the configuration
|
||||
chrome.storage.sync.get(["moodleGPT"]).then(function (storage) {
|
||||
const config = storage.moodleGPT;
|
||||
|
||||
if (config) {
|
||||
inputsText.forEach((key) =>
|
||||
config[key]
|
||||
? (document.querySelector("#" + key).value = config[key])
|
||||
: null
|
||||
);
|
||||
inputsCheckbox.forEach(
|
||||
(key) => (document.querySelector("#" + key).checked = config[key] || "")
|
||||
);
|
||||
}
|
||||
|
||||
getLastChatGPTVersion();
|
||||
});
|
||||
|
||||
//getting the last chatgpt version
|
||||
function getLastChatGPTVersion() {
|
||||
const apiKeySelector = document.querySelector("#apiKey");
|
||||
const reloadModel = document.querySelector("#reloadModel");
|
||||
|
||||
let apiKey = apiKeySelector.value;
|
||||
|
||||
function checkFiledApiKey() {
|
||||
if (apiKey) {
|
||||
reloadModel.removeAttribute("disabled");
|
||||
reloadModel.setAttribute("title", "Get last ChatGPT version");
|
||||
return;
|
||||
}
|
||||
|
||||
reloadModel.setAttribute("disabled", true);
|
||||
reloadModel.setAttribute("title", "Provide an api key first");
|
||||
}
|
||||
|
||||
checkFiledApiKey();
|
||||
|
||||
apiKeySelector.addEventListener("input", function () {
|
||||
apiKey = apiKeySelector.value.trim();
|
||||
checkFiledApiKey();
|
||||
});
|
||||
|
||||
reloadModel.addEventListener("click", async function () {
|
||||
if (!apiKey) return;
|
||||
try {
|
||||
const req = await fetch("https://api.openai.com/v1/models", {
|
||||
headers: {
|
||||
Authorization: `Bearer ${apiKey}`,
|
||||
},
|
||||
});
|
||||
const rep = await req.json();
|
||||
const model = rep.data.find((model) => model.id.includes("gpt"));
|
||||
document.querySelector("#model").value = model.root;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
showMessage("Failed to fetch last ChatGPT version");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
const currentVersion = "1.0.1";
|
||||
const versionDisplay = document.querySelector("#version");
|
||||
|
||||
async function getLastVersion() {
|
||||
const req = await fetch(
|
||||
"https://raw.githubusercontent.com/yoannchb-pro/MoodleGPT/main/package.json"
|
||||
);
|
||||
const rep = await req.json();
|
||||
return rep.version;
|
||||
}
|
||||
|
||||
function setVersion(version, isCurrent = true) {
|
||||
if (isCurrent) {
|
||||
versionDisplay.textContent = "v" + version;
|
||||
return;
|
||||
}
|
||||
|
||||
const link = document.createElement("a");
|
||||
link.href = "https://github.com/yoannchb-pro/MoodleGPT";
|
||||
link.rel = "noopener noreferrer";
|
||||
link.target = "_blank";
|
||||
link.textContent = "v" + version;
|
||||
versionDisplay.appendChild(link);
|
||||
versionDisplay.appendChild(document.createTextNode(" is now available !"));
|
||||
}
|
||||
|
||||
async function notifyUpdate() {
|
||||
const lastVersion = await getLastVersion().catch((err) => {
|
||||
console.error(err);
|
||||
return currentVersion;
|
||||
});
|
||||
if (currentVersion !== lastVersion) {
|
||||
setVersion(lastVersion, false);
|
||||
} else {
|
||||
setVersion(currentVersion);
|
||||
}
|
||||
}
|
||||
|
||||
notifyUpdate();
|
||||
@@ -40,7 +40,7 @@ img {
|
||||
margin-top: 0.75rem;
|
||||
}
|
||||
|
||||
h1 {
|
||||
.title {
|
||||
margin-top: 0.75rem;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
@@ -98,8 +98,21 @@ a {
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
#version {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
#message {
|
||||
display: none;
|
||||
margin-top: 0.75rem;
|
||||
margin-bottom: -0.25rem;
|
||||
}
|
||||
|
||||
#reloadModel {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#reloadModel[disabled] {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.75;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "moodle-gpt",
|
||||
"version": "1.0.0",
|
||||
"name": "moodlegpt",
|
||||
"version": "1.0.1",
|
||||
"description": "This extension allows you to hide CHAT-GPT in a Moodle quiz.",
|
||||
"scripts": {
|
||||
"build": "rollup -c"
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ module.exports = {
|
||||
input: "./src/index.ts",
|
||||
output: [
|
||||
{
|
||||
file: "./extension/moodle-gpt.js",
|
||||
file: "./extension/MoodleGPT.js",
|
||||
format: "umd",
|
||||
sourcemap: true,
|
||||
},
|
||||
|
||||
@@ -21,8 +21,7 @@ async function getChatGPTResponse(
|
||||
},
|
||||
signal: config.timeout ? controller.signal : null,
|
||||
body: JSON.stringify({
|
||||
model:
|
||||
config.model && config.model !== "" ? config.model : "gpt-3.5-turbo",
|
||||
model: config.model,
|
||||
messages: [{ role: "user", content: question }],
|
||||
temperature: 0.8,
|
||||
top_p: 1.0,
|
||||
|
||||
@@ -23,11 +23,7 @@ function normalizeQuestion(config: Config, questionContainer: HTMLElement) {
|
||||
}
|
||||
}
|
||||
|
||||
const finalQuestion = `Give a short response as possible for this question, reply in ${
|
||||
config.langage && config.langage !== ""
|
||||
? 'this langage "' + config.langage + '"'
|
||||
: "the following question langage"
|
||||
} and only show the result:
|
||||
const finalQuestion = `Give a short response as possible for this question, reply in the following question langage and only show the result:
|
||||
${question}
|
||||
(If you have to choose between multiple results only show the corrects one, separate them with new line and take the same text as the question)`;
|
||||
return normalizeText(finalQuestion);
|
||||
|
||||
Vendored
-1
@@ -1,7 +1,6 @@
|
||||
type Config = {
|
||||
apiKey: string;
|
||||
code: string;
|
||||
langage?: string;
|
||||
model?: string;
|
||||
infinite?: boolean;
|
||||
typing?: boolean;
|
||||
|
||||
Reference in New Issue
Block a user