diff --git a/_locales/en/messages.json b/_locales/en/messages.json
index 93e0555e..0459dd39 100644
--- a/_locales/en/messages.json
+++ b/_locales/en/messages.json
@@ -462,5 +462,9 @@
"Ollama_Models_Error_fetching": {
"message": "Error trying to fetch Ollama models",
"description": ""
+ },
+ "Ollama_Models_Error_NoModels": {
+ "message": "No models found",
+ "description": ""
}
}
\ No newline at end of file
diff --git a/js/api/ollama.js b/js/api/ollama.js
new file mode 100644
index 00000000..85085a80
--- /dev/null
+++ b/js/api/ollama.js
@@ -0,0 +1,58 @@
+/*
+ * ThunderAI [https://micz.it/thunderbird-addon-thunderai/]
+ * Copyright (C) 2024 Mic (m@micz.it)
+
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+
+export class Ollama {
+ host = '';
+ model = '';
+ stream = false;
+
+ constructor(host, model, stream = false) {
+ this.host = host.trim().replace(/\/+$/, "");
+ this.model = model;
+ this.stream = stream;
+ }
+
+ fetchModels = async () => {
+ const response = await fetch(this.host + "/api/tags", {
+ method: "GET",
+ headers: {
+ "Content-Type": "application/json"
+ },
+ });
+
+ if (!response.ok) {
+ const errorDetail = await response.text();
+ let err_msg = "[ThunderAI] Ollama API request failed: " + response.status + " " + response.statusText + ", Detail: " + errorDetail;
+ console.error(err_msg);
+ let output = {};
+ output.ok = false;
+ output.error = errorDetail;
+ return output;
+ }
+
+ let output = {};
+ output.ok = true;
+ let output_response = await response.json();
+ output.response = output_response;
+
+ //console.log(">>>>>>>>>> output_response: " + JSON.stringify(output_response));
+
+ return output;
+ }
+}
\ No newline at end of file
diff --git a/options/mzta-options.css b/options/mzta-options.css
index 572fdd05..3f61ae19 100644
--- a/options/mzta-options.css
+++ b/options/mzta-options.css
@@ -102,7 +102,12 @@ tr.conntype_chatgpt_web, tr.conntype_chatgpt_web2{
}
*/
-#model_fetch_loading{
+#chatgpt_model_fetch_loading{
+ display: none;
+ font-style: italic;
+}
+
+#ollama_model_fetch_loading{
display: none;
font-style: italic;
}
diff --git a/options/mzta-options.html b/options/mzta-options.html
index 2141c0e8..fda5f5fe 100644
--- a/options/mzta-options.html
+++ b/options/mzta-options.html
@@ -105,7 +105,7 @@