temperature added to Google Gemini. see #572

This commit is contained in:
mic 2025-12-26 23:35:42 +01:00
parent 3c089fc04e
commit f95fbeb00e
4 changed files with 29 additions and 1 deletions

View file

@ -1685,6 +1685,14 @@
"message": "Define the number of tokens to be used for thinking. Leave this field blank if the selected model does not support thinking or if you want to use the default method. Enter 0 to disable thinking, or -1 to enable dynamic thinking.",
"description": ""
},
"prefs_google_gemini_temperature": {
"message": "Temperature",
"description": ""
},
"prefs_google_gemini_temperature_Info": {
"message": "This parameter must be a number between 0.0 and 2.0. It controls the randomness of the output. The default value varies depending on the model. Leave it empty to avoid setting the parameter in the API call.",
"description": ""
},
"SelectAll": {
"message": "Select All",
"description": ""

View file

@ -119,6 +119,7 @@ switch (llm) {
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_temperature: prefs_default.google_gemini_temperature,
google_gemini_thinking_budget: prefs_default.google_gemini_thinking_budget,
do_debug: prefs_default.do_debug,
});
@ -131,7 +132,12 @@ switch (llm) {
if(prefs_api.google_gemini_system_instruction && prefs_api.google_gemini_system_instruction.length > 0) {
additional_text_elements.push({label: browser.i18n.getMessage("GoogleGemini_SystemInstruction"), value: prefs_api.google_gemini_system_instruction});
}
additional_text_elements.push({label: 'Thinking Budget', value: prefs_api.google_gemini_thinking_budget});
if(prefs_api.google_gemini_temperature.length > 0){
additional_text_elements.push({label: browser.i18n.getMessage("prefs_google_gemini_temperature"), value: prefs_api.google_gemini_temperature});
}
if(prefs_api.google_gemini_thinking_budget.length > 0){
additional_text_elements.push({label: browser.i18n.getMessage("prefs_google_gemini_thinking_budget"), value: prefs_api.google_gemini_thinking_budget});
}
additional_text_elements.push({label: "Prompt", value: '[' + prompt_id + '] ' + decodeURIComponent(prompt_name)});
worker.postMessage({
type: 'init',

View file

@ -46,6 +46,7 @@ export const prefs_default = {
google_gemini_model: '',
google_gemini_system_instruction: '',
google_gemini_thinking_budget: '',
google_gemini_temperature: '',
anthropic_api_key: '',
anthropic_model: '',
anthropic_version: '2023-06-01',

View file

@ -208,6 +208,19 @@ export async function injectConnectionUI({
</label>
</td>
</tr>
<tr class="conntype_google_gemini_api${tr_class ? ` ${tr_class}` : ''}">
<td>
<label>
<span class="opt_title">__MSG_prefs_google_gemini_temperature__</span>
</label>
</td>
<td>
<label>
<input type="text" id="google_gemini_temperature" name="google_gemini_temperature" class="option-input"/>
<br>__MSG_prefs_google_gemini_temperature_Info__
</label>
</td>
</tr>
<tr class="conntype_google_gemini_api${tr_class ? ` ${tr_class}` : ''}">
<td>
<label>