giving error to user and console on model fetch if needed. see #92
This commit is contained in:
parent
acb1dd8629
commit
9787db321d
2 changed files with 10 additions and 2 deletions
|
|
@ -406,10 +406,13 @@
|
||||||
"ChatGPT_Models": {
|
"ChatGPT_Models": {
|
||||||
"message": "ChatGPT Models",
|
"message": "ChatGPT Models",
|
||||||
"description": ""
|
"description": ""
|
||||||
}
|
},
|
||||||
,
|
|
||||||
"ChatGPT_Models_Fetch": {
|
"ChatGPT_Models_Fetch": {
|
||||||
"message": "Update ChatGPT Models list",
|
"message": "Update ChatGPT Models list",
|
||||||
"description": ""
|
"description": ""
|
||||||
|
},
|
||||||
|
"ChatGPT_Models_Error_fetching": {
|
||||||
|
"message": "Error trying to fetch ChatGPT models",
|
||||||
|
"description": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -164,6 +164,11 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
|
|
||||||
document.getElementById('btnUpdateChatGPTModels').addEventListener('click', () => {
|
document.getElementById('btnUpdateChatGPTModels').addEventListener('click', () => {
|
||||||
openai.fetchModels().then((data) => {
|
openai.fetchModels().then((data) => {
|
||||||
|
if(!data){
|
||||||
|
console.error("[ThunderAI] " + browser.i18n.getMessage("ChatGPT_Models_Error_fetching"));
|
||||||
|
alert(browser.i18n.getMessage("ChatGPT_Models_Error_fetching"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
console.log(">>>>>>>>> ChatGPT models: " + JSON.stringify(data));
|
console.log(">>>>>>>>> ChatGPT models: " + JSON.stringify(data));
|
||||||
data.forEach(model => {
|
data.forEach(model => {
|
||||||
if (!Array.from(select_model_chatgpt.options).some(option => option.value === model.id)) {
|
if (!Array.from(select_model_chatgpt.options).some(option => option.value === model.id)) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue