code formatted for clarity
This commit is contained in:
parent
944138a0c2
commit
7f9ee613ab
1 changed files with 69 additions and 10 deletions
|
|
@ -60,28 +60,87 @@
|
|||
async initWorker() {
|
||||
switch (this.llm) {
|
||||
case "chatgpt_api": {
|
||||
let prefs_api = await browser.storage.sync.get({chatgpt_api_key: '', chatgpt_model: '', chatgpt_developer_messages: ''});
|
||||
this.worker.postMessage({ type: 'init', chatgpt_api_key: prefs_api.chatgpt_api_key, chatgpt_model: prefs_api.chatgpt_model, chatgpt_developer_messages: prefs_api.chatgpt_developer_messages, do_debug: this.do_debug, i18nStrings: ''});
|
||||
let prefs_api = await browser.storage.sync.get({
|
||||
chatgpt_api_key: '',
|
||||
chatgpt_model: '',
|
||||
chatgpt_developer_messages: ''
|
||||
});
|
||||
this.worker.postMessage({
|
||||
type: 'init',
|
||||
chatgpt_api_key: prefs_api.chatgpt_api_key,
|
||||
chatgpt_model: prefs_api.chatgpt_model,
|
||||
chatgpt_developer_messages: prefs_api.chatgpt_developer_messages,
|
||||
do_debug: this.do_debug,
|
||||
i18nStrings: ''
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "google_gemini_api": {
|
||||
let prefs_api = await browser.storage.sync.get({google_gemini_api_key: '', google_gemini_model: '', google_gemini_system_instruction: ''});
|
||||
this.worker.postMessage({ type: 'init', google_gemini_api_key: prefs_api.google_gemini_api_key, google_gemini_model: prefs_api.google_gemini_model, google_gemini_system_instruction: prefs_api.google_gemini_system_instruction, do_debug: this.do_debug, i18nStrings: ''});
|
||||
let prefs_api = await browser.storage.sync.get({
|
||||
google_gemini_api_key: '',
|
||||
google_gemini_model: '',
|
||||
google_gemini_system_instruction: ''
|
||||
});
|
||||
this.worker.postMessage({
|
||||
type: 'init',
|
||||
google_gemini_api_key: prefs_api.google_gemini_api_key,
|
||||
google_gemini_model: prefs_api.google_gemini_model,
|
||||
google_gemini_system_instruction: prefs_api.google_gemini_system_instruction,
|
||||
do_debug: this.do_debug,
|
||||
i18nStrings: ''
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "ollama_api": {
|
||||
let prefs_api = await browser.storage.sync.get({ollama_host: '', ollama_model: ''});
|
||||
this.worker.postMessage({ type: 'init', ollama_host: prefs_api.ollama_host, ollama_model: prefs_api.ollama_model, do_debug: this.do_debug, i18nStrings: ''});
|
||||
let prefs_api = await browser.storage.sync.get({
|
||||
ollama_host: '',
|
||||
ollama_model: '',
|
||||
});
|
||||
this.worker.postMessage({
|
||||
type: 'init',
|
||||
ollama_host: prefs_api.ollama_host,
|
||||
ollama_model: prefs_api.ollama_model,
|
||||
do_debug: this.do_debug,
|
||||
i18nStrings: ''
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "openai_comp_api": {
|
||||
let prefs_api = await browser.storage.sync.get({openai_comp_host: '', openai_comp_model: '', openai_comp_api_key: '', openai_comp_use_v1: true, openai_comp_chat_name: '', do_debug: false});
|
||||
this.worker.postMessage({ type: 'init', openai_comp_host: prefs_api.openai_comp_host, openai_comp_model: prefs_api.openai_comp_model, openai_comp_api_key: prefs_api.openai_comp_api_key, openai_comp_use_v1: prefs_api.openai_comp_use_v1, do_debug: this.do_debug, i18nStrings: ''});
|
||||
let prefs_api = await browser.storage.sync.get({
|
||||
openai_comp_host: '',
|
||||
openai_comp_model: '',
|
||||
openai_comp_api_key: '',
|
||||
openai_comp_use_v1: true,
|
||||
openai_comp_chat_name: '',
|
||||
do_debug: false,
|
||||
});
|
||||
this.worker.postMessage({
|
||||
type: 'init',
|
||||
openai_comp_host: prefs_api.openai_comp_host,
|
||||
openai_comp_model: prefs_api.openai_comp_model,
|
||||
openai_comp_api_key: prefs_api.openai_comp_api_key,
|
||||
openai_comp_use_v1: prefs_api.openai_comp_use_v1,
|
||||
do_debug: this.do_debug,
|
||||
i18nStrings: ''
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "anthropic_api": {
|
||||
let prefs_api = await browser.storage.sync.get({anthropic_api_key: '', anthropic_model: '', anthropic_version: '2023-06-01', anthropic_max_tokens: 4096});
|
||||
this.worker.postMessage({ type: 'init', anthropic_api_key: prefs_api.anthropic_api_key, anthropic_model: prefs_api.anthropic_model, anthropic_version: prefs_api.anthropic_version, anthropic_max_tokens: prefs_api.anthropic_max_tokens, do_debug: this.do_debug, i18nStrings: ''});
|
||||
let prefs_api = await browser.storage.sync.get({
|
||||
anthropic_api_key: '',
|
||||
anthropic_model: '',
|
||||
anthropic_version: '2023-06-01',
|
||||
anthropic_max_tokens: 4096,
|
||||
});
|
||||
this.worker.postMessage({
|
||||
type: 'init',
|
||||
anthropic_api_key: prefs_api.anthropic_api_key,
|
||||
anthropic_model: prefs_api.anthropic_model,
|
||||
anthropic_version: prefs_api.anthropic_version,
|
||||
anthropic_max_tokens: prefs_api.anthropic_max_tokens,
|
||||
do_debug: this.do_debug,
|
||||
i18nStrings: ''
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue