using thinking_budget in gemini. see #494

This commit is contained in:
Mic 2025-09-08 22:00:00 +02:00
parent 2b794690d8
commit 59758a76c0
4 changed files with 46 additions and 6 deletions

View file

@ -138,6 +138,7 @@ switch (llm) {
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,
google_gemini_thinking_budget: prefs_api.google_gemini_thinking_budget,
do_debug: prefs_api.do_debug,
i18nStrings: i18nStrings
});

View file

@ -66,7 +66,14 @@
chatgpt_model: prefs_default.chatgpt_model,
chatgpt_developer_messages: prefs_default.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: ''});
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": {
@ -74,8 +81,17 @@
google_gemini_api_key: prefs_default.google_gemini_api_key,
google_gemini_model: prefs_default.google_gemini_model,
google_gemini_system_instruction: prefs_default.google_gemini_system_instruction,
google_gemini_thinking_budget: prefs_default.google_gemini_thinking_budget,
});
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,
google_gemini_thinking_budget: prefs_api.google_gemini_thinking_budget,
do_debug: this.do_debug,
i18nStrings: ''
});
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": {
@ -83,7 +99,13 @@
ollama_host: prefs_default.ollama_host,
ollama_model: prefs_default.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: ''});
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": {
@ -95,7 +117,15 @@
openai_comp_chat_name: prefs_default.openai_comp_chat_name,
do_debug: prefs_default.do_debug,
});
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: ''});
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": {
@ -105,7 +135,15 @@
anthropic_version: prefs_default.anthropic_version,
anthropic_max_tokens: prefs_default.anthropic_max_tokens,
});
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: ''});
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;
}
}

View file

@ -42,6 +42,7 @@ self.onmessage = async function(event) {
apiKey: google_gemini_api_key,
model: google_gemini_model,
system_instruction: event.data.google_gemini_system_instruction,
thinking_budget: event.data.google_gemini_thinking_budget,
stream: true
});
do_debug = event.data.do_debug;

View file

@ -45,7 +45,7 @@ export const prefs_default = {
google_gemini_api_key: '',
google_gemini_model: '',
google_gemini_system_instruction: '',
google_gemini_thinking_budget: 0,
google_gemini_thinking_budget: '',
anthropic_api_key: '',
anthropic_model: '',
anthropic_version: '2023-06-01',