ollama options added. see #79

This commit is contained in:
mic 2024-08-20 15:16:48 +02:00
parent 19342cbced
commit 4f7a018f67
8 changed files with 69 additions and 7 deletions

View file

@ -411,7 +411,7 @@
"message": "Fehler beim Abrufen der ChatGPT-Modelle",
"description": ""
},
"ChatGPT_Models_Loading": {
"Loading": {
"message": "Laden...",
"description": ""
},

View file

@ -411,7 +411,7 @@
"message": "Error trying to fetch ChatGPT models",
"description": ""
},
"ChatGPT_Models_Loading": {
"Loading": {
"message": "Loading...",
"description": ""
},
@ -442,5 +442,25 @@
"prefs_OptionText_do_debug_info": {
"message": "Activate the debug system",
"description": ""
},
"prefs_Connection_type_Ollama_API": {
"message": "Ollama API (Local LLM)",
"description": ""
},
"prefs_Ollama_Host": {
"message": "Host Address",
"description": ""
},
"Ollama_Models": {
"message": "Ollama Models",
"description": ""
},
"Ollama_Models_Fetch": {
"message": "Update Ollama Models list",
"description": ""
},
"Ollama_Models_Error_fetching": {
"message": "Error trying to fetch Ollama models",
"description": ""
}
}

View file

@ -411,7 +411,7 @@
"message": "Erreur lors de la récupération des modèles ChatGPT",
"description": ""
},
"ChatGPT_Models_Loading": {
"Loading": {
"message": "Chargement...",
"description": ""
},

View file

@ -411,7 +411,7 @@
"message": "Errore durante il recupero dei modelli di ChatGPT",
"description": ""
},
"ChatGPT_Models_Loading": {
"Loading": {
"message": "Caricamento in corso...",
"description": ""
},

View file

@ -22,7 +22,9 @@ export const prefs_default = {
chatgpt_win_width: 700,
chatpgt_use_gpt4: false,
default_chatgpt_lang: '',
connection_type: 'chatgpt_web', //Other values: 'chatgpt_api'
connection_type: 'chatgpt_web', //Other values: 'chatgpt_api', 'ollama_api'
chatgpt_api_key: '',
chatgpt_model: '',
ollama_host: '',
ollama_model: '',
}

View file

@ -126,6 +126,10 @@ tr.conntype_chatgpt_web, tr.conntype_chatgpt_web2{
background-color: rgb(39, 11, 0);
}
tr.conntype_ollama_api, tr.conntype_ollama_api2{
background-color: rgb(7, 58, 0);
}
/* color to be used for a local LLM
.conntype_chatgpt_web,.conntype_local_llm{
background-color: rgb(0, 39, 0);

View file

@ -70,6 +70,7 @@
<select id="connection_type" name="connection_type" class="option-input">
<option value="chatgpt_web">__MSG_prefs_Connection_type_ChatGTP_Web__</option>
<option value="chatgpt_api">__MSG_prefs_Connection_type_ChatGTP_API__</option>
<option value="ollama_api">__MSG_prefs_Connection_type_Ollama_API__</option>
</select>
</label>
</td>
@ -104,13 +105,38 @@
</label>
</td>
<td>
<button id="btnUpdateChatGPTModels">__MSG_ChatGPT_Models_Fetch__</button> <span id="model_fetch_loading">__MSG_ChatGPT_Models_Loading__</span><br>
<button id="btnUpdateChatGPTModels">__MSG_ChatGPT_Models_Fetch__</button> <span id="model_fetch_loading">__MSG_Loading__</span><br>
<label>
<select id="chatgpt_model" name="chatgpt_model" class="option-input">
</select>
</label>
</td>
</tr>
<tr class="conntype_ollama_api">
<td><label>
<span>__MSG_prefs_Ollama_Host__</span>
</label></td>
<td>
<label>
<input type="text" id="ollama_host" name="ollama_host" class="option-input" style="width:28em" />
&nbsp;<span></span>
</label>
</td>
</tr>
<tr class="conntype_ollama_api">
<td>
<label>
<span>__MSG_Ollama_Models__</span>
</label>
</td>
<td>
<button id="btnUpdateChatGPTModels">__MSG_Ollama_Models_Fetch__</button> <span id="model_fetch_loading">__MSG_Loading__</span><br>
<label>
<select id="ollama_model" name="ollama_model" class="option-input">
</select>
</label>
</td>
</tr>
<tr>
<td><label>
<span>__MSG_Debug__</span>

View file

@ -91,10 +91,12 @@ async function restoreOptions() {
function showConnectionOptions() {
let chatgpt_web_display = 'table-row';
let chatgpt_api_display = 'none';
let ollama_api_display = 'none';
let conntype_select = document.getElementById("connection_type");
let parent = conntype_select.parentElement.parentElement.parentElement;
parent.classList.toggle("conntype_chatgpt_web", (conntype_select.value === "chatgpt_web"));
parent.classList.toggle("conntype_chatgpt_api", (conntype_select.value === "chatgpt_api"));
parent.classList.toggle("conntype_chatgpt_web", (conntype_select.value === "chatgpt_web"));
parent.classList.toggle("conntype_ollama_api", (conntype_select.value === "ollama_api"));
if (conntype_select.value === "chatgpt_web") {
chatgpt_web_display = 'table-row';
}else{
@ -105,12 +107,20 @@ function showConnectionOptions() {
}else{
chatgpt_api_display = 'none';
}
if (conntype_select.value === "ollama_api") {
ollama_api_display = 'table-row';
}else{
ollama_api_display = 'none';
}
document.querySelectorAll(".conntype_chatgpt_web").forEach(element => {
element.style.display = chatgpt_web_display;
});
document.querySelectorAll(".conntype_chatgpt_api").forEach(element => {
element.style.display = chatgpt_api_display;
});
document.querySelectorAll(".conntype_ollama_api").forEach(element => {
element.style.display = ollama_api_display;
});
}
function warnAPIKeyEmpty() {