using logger class in mzta-options

This commit is contained in:
mic 2024-08-19 17:30:05 +02:00
parent a25df4281e
commit 3f2862a571

View file

@ -18,8 +18,11 @@
import { prefs_default } from './mzta-options-default.js'; import { prefs_default } from './mzta-options-default.js';
import { taLogger } from '../js/mzta-logger.js';
import { OpenAI } from '../js/api/openai.js'; import { OpenAI } from '../js/api/openai.js';
let taLog = new taLogger("mzta-options",true);
function saveOptions(e) { function saveOptions(e) {
e.preventDefault(); e.preventDefault();
let options = {}; let options = {};
@ -49,7 +52,7 @@ function saveOptions(e) {
async function restoreOptions() { async function restoreOptions() {
function setCurrentChoice(result) { function setCurrentChoice(result) {
document.querySelectorAll(".option-input").forEach(element => { document.querySelectorAll(".option-input").forEach(element => {
//console.log("[ThunderAI] Options restoring " + element.id + " = " + result[element.id]); taLog.log("Options restoring " + element.id + " = " + result[element.id]);
switch (element.type) { switch (element.type) {
case 'checkbox': case 'checkbox':
element.checked = result[element.id] || false; element.checked = result[element.id] || false;
@ -179,7 +182,7 @@ document.addEventListener('DOMContentLoaded', async () => {
alert(browser.i18n.getMessage("ChatGPT_Models_Error_fetching")+": " + errorDetail.error.message); alert(browser.i18n.getMessage("ChatGPT_Models_Error_fetching")+": " + errorDetail.error.message);
return; return;
} }
//console.log(">>>>>>>>> ChatGPT models: " + JSON.stringify(data)); taLog.log("ChatGPT models: " + JSON.stringify(data));
data.response.forEach(model => { data.response.forEach(model => {
if (!Array.from(select_chatgpt_model.options).some(option => option.value === model.id)) { if (!Array.from(select_chatgpt_model.options).some(option => option.value === model.id)) {
const option = document.createElement('option'); const option = document.createElement('option');