Merge branch 'main' into issue_350
This commit is contained in:
commit
1907739f8b
9 changed files with 46 additions and 8 deletions
|
|
@ -6,8 +6,9 @@
|
||||||
|
|
||||||
<h2>Version 3.3.5 - 17/04/2025</h2>
|
<h2>Version 3.3.5 - 17/04/2025</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Using a prompt from the compose window with a "Do reply" action is changed in "Substitute Text" [<a href="https://github.com/micz/ThunderAI/issues/353">#353</a>].</li>
|
<li>Using a prompt from the compose window with a "Do reply" action is changed in "Substitute Text", asking also to insert text if none is selected [<a href="https://github.com/micz/ThunderAI/issues/353">#353</a>].</li>
|
||||||
<li>Added an option when composing in plain text to remove the extra empty lines [<a href="https://github.com/micz/ThunderAI/issues/350">#350</a>].</li>
|
<li>Added an option when composing in plain text to remove the extra empty lines [<a href="https://github.com/micz/ThunderAI/issues/350">#350</a>].</li>
|
||||||
|
<li><i>[Ollama API]</i> It's now possibile to define the default context length (the <i>num_ctx</i> parameter) in the options page [<a href="https://github.com/micz/ThunderAI/issues/351">#351</a>].</li>
|
||||||
<li><i>[ChatGPT Web]</i> Updated the list of available models in the option page.</li>
|
<li><i>[ChatGPT Web]</i> Updated the list of available models in the option page.</li>
|
||||||
<li><i>[ChatGPT Web]</i> Opening the ChatGPT webpage from the options now enforce the selected model, if any.</li>
|
<li><i>[ChatGPT Web]</i> Opening the ChatGPT webpage from the options now enforce the selected model, if any.</li>
|
||||||
<li><i>[All APIs]</i> Fix: Really correctly getting the message body even in multilevel subpart messages when processing incoming messages for tags or spam [<a href="https://github.com/micz/ThunderAI/issues/335">#335</a>].</li>
|
<li><i>[All APIs]</i> Fix: Really correctly getting the message body even in multilevel subpart messages when processing incoming messages for tags or spam [<a href="https://github.com/micz/ThunderAI/issues/335">#335</a>].</li>
|
||||||
|
|
|
||||||
|
|
@ -1279,4 +1279,16 @@
|
||||||
"message": "Check this option if you're composing the emails in plain text format.",
|
"message": "Check this option if you're composing the emails in plain text format.",
|
||||||
"description": ""
|
"description": ""
|
||||||
}
|
}
|
||||||
|
"Replace_No_Selected_Text": {
|
||||||
|
"message": "No text selected, would you like to insert the AI's response at the beginning of the email?",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
"prefs_ollama_num_ctx": {
|
||||||
|
"message": "Number of context tokens",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
"prefs_ollama_num_ctx_Info": {
|
||||||
|
"message": "The number of context tokens to use for the Ollama API. Set to 0 if you don't want to pass it as a parameter to the server.",
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -90,13 +90,13 @@ switch (llm) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "ollama_api": {
|
case "ollama_api": {
|
||||||
let prefs_api = await browser.storage.sync.get({ollama_host: '', ollama_model: '', do_debug: false});
|
let prefs_api = await browser.storage.sync.get({ollama_host: '', ollama_model: '', ollama_num_ctx: 0, do_debug: false});
|
||||||
let i18nStrings = {};
|
let i18nStrings = {};
|
||||||
i18nStrings["ollama_api_request_failed"] = browser.i18n.getMessage('ollama_api_request_failed');
|
i18nStrings["ollama_api_request_failed"] = browser.i18n.getMessage('ollama_api_request_failed');
|
||||||
i18nStrings["error_connection_interrupted"] = browser.i18n.getMessage('error_connection_interrupted');
|
i18nStrings["error_connection_interrupted"] = browser.i18n.getMessage('error_connection_interrupted');
|
||||||
messageInput.setModel(prefs_api.ollama_model);
|
messageInput.setModel(prefs_api.ollama_model);
|
||||||
messagesArea.setLLMName("Ollama Local");
|
messagesArea.setLLMName("Ollama Local");
|
||||||
worker.postMessage({ type: 'init', ollama_host: prefs_api.ollama_host, ollama_model: prefs_api.ollama_model, do_debug: prefs_api.do_debug, i18nStrings: i18nStrings});
|
worker.postMessage({ type: 'init', ollama_host: prefs_api.ollama_host, ollama_model: prefs_api.ollama_model, ollama_num_ctx: prefs_api.ollama_num_ctx, do_debug: prefs_api.do_debug, i18nStrings: i18nStrings});
|
||||||
browser.runtime.sendMessage({command: "ollama_api_ready_" + call_id, window_id: (await browser.windows.getCurrent()).id});
|
browser.runtime.sendMessage({command: "ollama_api_ready_" + call_id, window_id: (await browser.windows.getCurrent()).id});
|
||||||
messagesArea.appendUserMessage(browser.i18n.getMessage("ollama_api_connecting") + " \"" + prefs_api.ollama_host + "\" " +browser.i18n.getMessage("AndModel") + " \"" + prefs_api.ollama_model + "\"...", "info");
|
messagesArea.appendUserMessage(browser.i18n.getMessage("ollama_api_connecting") + " \"" + prefs_api.ollama_host + "\" " +browser.i18n.getMessage("AndModel") + " \"" + prefs_api.ollama_model + "\"...", "info");
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,13 @@ export class Ollama {
|
||||||
host = '';
|
host = '';
|
||||||
model = '';
|
model = '';
|
||||||
stream = false;
|
stream = false;
|
||||||
|
num_ctx = 0;
|
||||||
|
|
||||||
constructor(host, model, stream = false) {
|
constructor(host, model, stream = false, num_ctx = 0) {
|
||||||
this.host = host.trim().replace(/\/+$/, "");
|
this.host = host.trim().replace(/\/+$/, "");
|
||||||
this.model = model;
|
this.model = model;
|
||||||
this.stream = stream;
|
this.stream = stream;
|
||||||
|
this.num_ctx = num_ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchModels = async () => {
|
fetchModels = async () => {
|
||||||
|
|
@ -78,6 +80,7 @@ export class Ollama {
|
||||||
model: this.model,
|
model: this.model,
|
||||||
messages: messages,
|
messages: messages,
|
||||||
stream: this.stream,
|
stream: this.stream,
|
||||||
|
...(this.num_ctx > 0 ? { num_ctx: parseInt(this.num_ctx) } : {})
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
return response;
|
return response;
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,19 @@ switch (message.command) {
|
||||||
|
|
||||||
case "replaceSelectedText": {
|
case "replaceSelectedText": {
|
||||||
const selectedText = window.getSelection().toString();
|
const selectedText = window.getSelection().toString();
|
||||||
|
let force_insert = false;
|
||||||
if (selectedText === '') {
|
if (selectedText === '') {
|
||||||
return Promise.resolve(false);
|
if(!confirm(browser.i18n.getMessage("Replace_No_Selected_Text"))) {
|
||||||
|
return Promise.resolve(false);
|
||||||
|
}else{
|
||||||
|
force_insert = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const sel = window.getSelection();
|
const sel = window.getSelection();
|
||||||
if (!sel || sel.type !== "Range" || !sel.rangeCount) {
|
if (!sel || sel.type !== "Range" || !sel.rangeCount) {
|
||||||
return Promise.resolve(false);
|
if(!force_insert) {
|
||||||
|
return Promise.resolve(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const r = sel.getRangeAt(0);
|
const r = sel.getRangeAt(0);
|
||||||
r.deleteContents();
|
r.deleteContents();
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import { taLogger } from '../mzta-logger.js';
|
||||||
|
|
||||||
let ollama_host = null;
|
let ollama_host = null;
|
||||||
let ollama_model = '';
|
let ollama_model = '';
|
||||||
|
let ollama_num_ctx = 0;
|
||||||
let ollama = null;
|
let ollama = null;
|
||||||
let stopStreaming = false;
|
let stopStreaming = false;
|
||||||
let i18nStrings = null;
|
let i18nStrings = null;
|
||||||
|
|
@ -39,8 +40,9 @@ self.onmessage = async function(event) {
|
||||||
case 'init':
|
case 'init':
|
||||||
ollama_host = event.data.ollama_host;
|
ollama_host = event.data.ollama_host;
|
||||||
ollama_model = event.data.ollama_model;
|
ollama_model = event.data.ollama_model;
|
||||||
|
ollama_num_ctx = event.data.ollama_num_ctx;
|
||||||
//console.log(">>>>>>>>>>> ollama_host: " + ollama_host);
|
//console.log(">>>>>>>>>>> ollama_host: " + ollama_host);
|
||||||
ollama = new Ollama(ollama_host, ollama_model, true);
|
ollama = new Ollama(ollama_host, ollama_model, true, ollama_num_ctx);
|
||||||
do_debug = event.data.do_debug;
|
do_debug = event.data.do_debug;
|
||||||
i18nStrings = event.data.i18nStrings;
|
i18nStrings = event.data.i18nStrings;
|
||||||
taLog = new taLogger('model-worker-ollama', do_debug);
|
taLog = new taLogger('model-worker-ollama', do_debug);
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ export const prefs_default = {
|
||||||
chatgpt_developer_messages: '',
|
chatgpt_developer_messages: '',
|
||||||
ollama_host: '',
|
ollama_host: '',
|
||||||
ollama_model: '',
|
ollama_model: '',
|
||||||
|
ollama_num_ctx: 0,
|
||||||
openai_comp_host: '', // For OpenAI Compatible API as LM-Studio
|
openai_comp_host: '', // For OpenAI Compatible API as LM-Studio
|
||||||
openai_comp_model: '',
|
openai_comp_model: '',
|
||||||
openai_comp_api_key: '',
|
openai_comp_api_key: '',
|
||||||
|
|
|
||||||
|
|
@ -261,6 +261,17 @@
|
||||||
<br><br><button id="btnGiveAllUrlsPermission_ollama_api">__MSG_CORS_give_allurls_perm__</button>
|
<br><br><button id="btnGiveAllUrlsPermission_ollama_api">__MSG_CORS_give_allurls_perm__</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="conntype_ollama_api">
|
||||||
|
<td><label>
|
||||||
|
<span>__MSG_prefs_ollama_num_ctx__</span>
|
||||||
|
</label></td>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input type="number" id="ollama_num_ctx" name="ollama_num_ctx" class="option-input"/>
|
||||||
|
<br>__MSG_prefs_ollama_num_ctx_Info__
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr class="conntype_ollama_api">
|
<tr class="conntype_ollama_api">
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,9 @@
|
||||||
<div id="miczRelNotes"><h1>ThunderAI Release Notes</h1>
|
<div id="miczRelNotes"><h1>ThunderAI Release Notes</h1>
|
||||||
<h2>Version 3.3.5 - 17/04/2025</h2>
|
<h2>Version 3.3.5 - 17/04/2025</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Using a prompt from the compose window with a "Do reply" action is changed in "Substitute Text" [<a href="https://github.com/micz/ThunderAI/issues/353">#353</a>].</li>
|
<li>Using a prompt from the compose window with a "Do reply" action is changed in "Substitute Text", asking also to insert text if none is selected [<a href="https://github.com/micz/ThunderAI/issues/353">#353</a>].</li>
|
||||||
<li>Added an option when composing in plain text to remove the extra empty lines [<a href="https://github.com/micz/ThunderAI/issues/350">#350</a>].</li>
|
<li>Added an option when composing in plain text to remove the extra empty lines [<a href="https://github.com/micz/ThunderAI/issues/350">#350</a>].</li>
|
||||||
|
<li><i>[Ollama API]</i> It's now possibile to define the default context length (the <i>num_ctx</i> parameter) in the options page [<a href="https://github.com/micz/ThunderAI/issues/351">#351</a>].</li>
|
||||||
<li><i>[ChatGPT Web]</i> Updated the list of available models in the option page.</li>
|
<li><i>[ChatGPT Web]</i> Updated the list of available models in the option page.</li>
|
||||||
<li><i>[ChatGPT Web]</i> Opening the ChatGPT webpage from the options now enforce the selected model, if any.</li>
|
<li><i>[ChatGPT Web]</i> Opening the ChatGPT webpage from the options now enforce the selected model, if any.</li>
|
||||||
<li><i>[All APIs]</i> Fix: Really correctly getting the message body even in multilevel subpart messages when processing incoming messages for tags or spam [<a href="https://github.com/micz/ThunderAI/issues/335">#335</a>].</li>
|
<li><i>[All APIs]</i> Fix: Really correctly getting the message body even in multilevel subpart messages when processing incoming messages for tags or spam [<a href="https://github.com/micz/ThunderAI/issues/335">#335</a>].</li>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue