special prompts temperature is now saved per prompt. see #561

This commit is contained in:
mic 2025-12-28 22:33:25 +01:00
parent 17f73936ea
commit 12e846739e
4 changed files with 25 additions and 14 deletions

View file

@ -80,6 +80,11 @@ export const prefs_default = {
add_tags_openai_comp_model: '', add_tags_openai_comp_model: '',
add_tags_google_gemini_model: '', add_tags_google_gemini_model: '',
add_tags_anthropic_model: '', add_tags_anthropic_model: '',
add_tags_chatgpt_api_temperature: '',
add_tags_ollama_temperature: '',
add_tags_openai_comp_temperature: '',
add_tags_google_gemini_temperature: '',
add_tags_anthropic_temperature: '',
get_calendar_event: true, get_calendar_event: true,
get_task: true, get_task: true,
calendar_enforce_timezone: false, calendar_enforce_timezone: false,
@ -95,4 +100,9 @@ export const prefs_default = {
spamfilter_openai_comp_model: '', spamfilter_openai_comp_model: '',
spamfilter_google_gemini_model: '', spamfilter_google_gemini_model: '',
spamfilter_anthropic_model: '', spamfilter_anthropic_model: '',
spamfilter_chatgpt_api_temperature: '',
spamfilter_ollama_temperature: '',
spamfilter_openai_comp_temperature: '',
spamfilter_google_gemini_temperature: '',
spamfilter_anthropic_temperature: '',
} }

View file

@ -152,7 +152,7 @@ export async function injectConnectionUI({
<td> <td>
<button id="btnUpdateChatGPTModels">__MSG_ChatGPT_Models_Fetch__</button> <span id="chatgpt_model_fetch_loading">__MSG_Loading__</span><br> <button id="btnUpdateChatGPTModels">__MSG_ChatGPT_Models_Fetch__</button> <span id="chatgpt_model_fetch_loading">__MSG_Loading__</span><br>
<label> <label>
<select id="${modelId_prefix ? `${modelId_prefix}` : ''}chatgpt_model" name="${modelId_prefix ? `${modelId_prefix}` : ''}chatgpt_model" class="option-input option-input-model"></select> <select id="${modelId_prefix ? `${modelId_prefix}` : ''}chatgpt_model" name="${modelId_prefix ? `${modelId_prefix}` : ''}chatgpt_model" class="option-input option-input-specific"></select>
</label> </label>
</td> </td>
</tr> </tr>
@ -164,7 +164,7 @@ export async function injectConnectionUI({
</td> </td>
<td> <td>
<label> <label>
<input type="text" id="chatgpt_api_temperature" name="chatgpt_api_temperature" class="option-input" /> <input type="text" id="${modelId_prefix ? `${modelId_prefix}` : ''}chatgpt_api_temperature" name="${modelId_prefix ? `${modelId_prefix}` : ''}chatgpt_api_temperature" class="option-input option-input-specific" />
<br>__MSG_prefs_chatgpt_api_temperature_Info__ <br>__MSG_prefs_chatgpt_api_temperature_Info__
</label> </label>
</td> </td>
@ -217,7 +217,7 @@ export async function injectConnectionUI({
<td> <td>
<button id="btnUpdateGoogleGeminiModels">__MSG_GoogleGemini_Models_Fetch__</button> <span id="google_gemini_model_fetch_loading">__MSG_Loading__</span><br> <button id="btnUpdateGoogleGeminiModels">__MSG_GoogleGemini_Models_Fetch__</button> <span id="google_gemini_model_fetch_loading">__MSG_Loading__</span><br>
<label> <label>
<select id="${modelId_prefix ? `${modelId_prefix}` : ''}google_gemini_model" name="${modelId_prefix ? `${modelId_prefix}` : ''}google_gemini_model" class="option-input option-input-model"></select> <select id="${modelId_prefix ? `${modelId_prefix}` : ''}google_gemini_model" name="${modelId_prefix ? `${modelId_prefix}` : ''}google_gemini_model" class="option-input option-input-specific"></select>
</label> </label>
</td> </td>
</tr> </tr>
@ -229,7 +229,7 @@ export async function injectConnectionUI({
</td> </td>
<td> <td>
<label> <label>
<input type="text" id="google_gemini_temperature" name="google_gemini_temperature" class="option-input"/> <input type="text" id="${modelId_prefix ? `${modelId_prefix}` : ''}google_gemini_temperature" name="${modelId_prefix ? `${modelId_prefix}` : ''}google_gemini_temperature" class="option-input option-input-specific"/>
<br>__MSG_prefs_google_gemini_temperature_Info__ <br>__MSG_prefs_google_gemini_temperature_Info__
</label> </label>
</td> </td>
@ -289,7 +289,7 @@ export async function injectConnectionUI({
<td> <td>
<button id="btnUpdateOllamaModels">__MSG_Ollama_Models_Fetch__</button> <span id="ollama_model_fetch_loading">__MSG_Loading__</span><br> <button id="btnUpdateOllamaModels">__MSG_Ollama_Models_Fetch__</button> <span id="ollama_model_fetch_loading">__MSG_Loading__</span><br>
<label> <label>
<select id="${modelId_prefix ? `${modelId_prefix}` : ''}ollama_model" name="${modelId_prefix ? `${modelId_prefix}` : ''}ollama_model" class="option-input option-input-model"></select> <select id="${modelId_prefix ? `${modelId_prefix}` : ''}ollama_model" name="${modelId_prefix ? `${modelId_prefix}` : ''}ollama_model" class="option-input option-input-specific"></select>
</label> </label>
</td> </td>
</tr> </tr>
@ -301,7 +301,7 @@ export async function injectConnectionUI({
</td> </td>
<td> <td>
<label> <label>
<input type="text" id="ollama_temperature" name="ollama_temperature" class="option-input" /> <input type="text" id="${modelId_prefix ? `${modelId_prefix}` : ''}ollama_temperature" name="${modelId_prefix ? `${modelId_prefix}` : ''}ollama_temperature" class="option-input option-input-specific" />
<br>__MSG_prefs_ollama_temperature_Info__ <br>__MSG_prefs_ollama_temperature_Info__
</label> </label>
</td> </td>
@ -395,7 +395,7 @@ export async function injectConnectionUI({
<td> <td>
<button id="btnUpdateOpenAICompModels">__MSG_OpenAIComp_Models_Fetch__</button> <span id="openai_comp_model_fetch_loading">__MSG_Loading__</span><br> <button id="btnUpdateOpenAICompModels">__MSG_OpenAIComp_Models_Fetch__</button> <span id="openai_comp_model_fetch_loading">__MSG_Loading__</span><br>
<label> <label>
<select id="${modelId_prefix ? `${modelId_prefix}` : ''}openai_comp_model" name="${modelId_prefix ? `${modelId_prefix}` : ''}openai_comp_model" class="option-input option-input-model"></select> <select id="${modelId_prefix ? `${modelId_prefix}` : ''}openai_comp_model" name="${modelId_prefix ? `${modelId_prefix}` : ''}openai_comp_model" class="option-input option-input-specific"></select>
</label> </label>
</td> </td>
</tr> </tr>
@ -418,7 +418,7 @@ export async function injectConnectionUI({
</td> </td>
<td> <td>
<label> <label>
<input type="text" id="openai_comp_temperature" name="openai_comp_temperature" class="option-input" /> <input type="text" id="${modelId_prefix ? `${modelId_prefix}` : ''}openai_comp_temperature" name="${modelId_prefix ? `${modelId_prefix}` : ''}openai_comp_temperature" class="option-input option-input-specific" />
<br>__MSG_prefs_openai_comp_temperature_Info__ <br>__MSG_prefs_openai_comp_temperature_Info__
</label> </label>
</td> </td>
@ -445,7 +445,7 @@ export async function injectConnectionUI({
<td> <td>
<button id="btnUpdateAnthropicModels">__MSG_Anthropic_Models_Fetch__</button> <span id="anthropic_model_fetch_loading">__MSG_Loading__</span><br> <button id="btnUpdateAnthropicModels">__MSG_Anthropic_Models_Fetch__</button> <span id="anthropic_model_fetch_loading">__MSG_Loading__</span><br>
<label> <label>
<select id="${modelId_prefix ? `${modelId_prefix}` : ''}anthropic_model" name="${modelId_prefix ? `${modelId_prefix}` : ''}anthropic_model" class="option-input option-input-model"></select> <select id="${modelId_prefix ? `${modelId_prefix}` : ''}anthropic_model" name="${modelId_prefix ? `${modelId_prefix}` : ''}anthropic_model" class="option-input option-input-specific"></select>
</label> </label>
</td> </td>
</tr> </tr>
@ -457,7 +457,7 @@ export async function injectConnectionUI({
</td> </td>
<td> <td>
<label> <label>
<input type="text" id="anthropic_temperature" name="anthropic_temperature" class="option-input" /> <input type="text" id="${modelId_prefix ? `${modelId_prefix}` : ''}anthropic_temperature" name="${modelId_prefix ? `${modelId_prefix}` : ''}anthropic_temperature" class="option-input option-input-specific" />
<br>__MSG_prefs_anthropic_temperature_Info__ <br>__MSG_prefs_anthropic_temperature_Info__
</label> </label>
</td> </td>

View file

@ -70,7 +70,7 @@ document.addEventListener('DOMContentLoaded', async () => {
element.addEventListener("change", saveOptions); element.addEventListener("change", saveOptions);
}); });
document.querySelectorAll(".option-input-model").forEach(element => { document.querySelectorAll(".option-input-specific").forEach(element => {
element.addEventListener("change", updatePromptAPIInfo); element.addEventListener("change", updatePromptAPIInfo);
}); });
@ -296,12 +296,13 @@ async function updateAdditionalPromptStatements(){
async function updatePromptAPIInfo(){ async function updatePromptAPIInfo(){
let conntype = document.getElementById(conntype_select_id).value; let conntype = document.getElementById(conntype_select_id).value;
let model_value = conntype.substring(0, conntype.length - 4) + '_model'; let model_value = conntype.substring(0, conntype.length - 4) + '_model';
let model = document.getElementById(model_prefix + model_value).value; let temperature_value = conntype.substring(0, conntype.length - 4) + '_temperature';
// console.log(">>>>>>>>>>> updatePromptAPIInfo: conntype: " + conntype + " - model: " + model + " - model_value: " + model_value); // console.log(">>>>>>>>>>> updatePromptAPIInfo: conntype: " + conntype + " - model: " + model + " - model_value: " + model_value);
let add_tags_prompt = await loadPrompt('prompt_add_tags'); let add_tags_prompt = await loadPrompt('prompt_add_tags');
// console.log(">>>>>>>>>>> updatePromptAPIInfo: BEFORE add_tags_prompt: " + JSON.stringify(add_tags_prompt)); // console.log(">>>>>>>>>>> updatePromptAPIInfo: BEFORE add_tags_prompt: " + JSON.stringify(add_tags_prompt));
add_tags_prompt.api = conntype; add_tags_prompt.api = conntype;
add_tags_prompt.model = model; add_tags_prompt.model = document.getElementById(model_prefix + model_value).value;
add_tags_prompt.temperature = document.getElementById(model_prefix + temperature_value).value;
// console.log(">>>>>>>>>>> updatePromptAPIInfo: AFTER add_tags_prompt: " + JSON.stringify(add_tags_prompt)); // console.log(">>>>>>>>>>> updatePromptAPIInfo: AFTER add_tags_prompt: " + JSON.stringify(add_tags_prompt));
await savePrompt(add_tags_prompt); await savePrompt(add_tags_prompt);
} }

View file

@ -65,7 +65,7 @@ document.addEventListener('DOMContentLoaded', async () => {
check_spamfilter_threshold({target: document.getElementById("spamfilter_threshold")}); check_spamfilter_threshold({target: document.getElementById("spamfilter_threshold")});
// Bind prompt API updates to connection type and model selects // Bind prompt API updates to connection type and model selects
document.querySelectorAll(".option-input-model").forEach(element => { document.querySelectorAll(".option-input-specific").forEach(element => {
element.addEventListener("change", updatePromptAPIInfo); element.addEventListener("change", updatePromptAPIInfo);
}); });
const conntype_el = document.getElementById(conntype_select_id); const conntype_el = document.getElementById(conntype_select_id);