pipeworks_mud_mapper.callbacks.ollama_template_callbacks ======================================================== .. py:module:: pipeworks_mud_mapper.callbacks.ollama_template_callbacks .. autoapi-nested-parse:: Callbacks for Ollama template, prompt, and control UI. This module handles template dropdown population, system prompt compilation, prompt prefix presets, collapse toggles, and seed control logic. Functions --------- .. autoapisummary:: pipeworks_mud_mapper.callbacks.ollama_template_callbacks.load_template_options pipeworks_mud_mapper.callbacks.ollama_template_callbacks.load_prompt_prefix_options pipeworks_mud_mapper.callbacks.ollama_template_callbacks.load_param_preset_options pipeworks_mud_mapper.callbacks.ollama_template_callbacks.apply_param_preset pipeworks_mud_mapper.callbacks.ollama_template_callbacks.apply_prompt_prefix pipeworks_mud_mapper.callbacks.ollama_template_callbacks.handle_template_selection pipeworks_mud_mapper.callbacks.ollama_template_callbacks.update_target_words_hint pipeworks_mud_mapper.callbacks.ollama_template_callbacks.toggle_system_prompt_collapse pipeworks_mud_mapper.callbacks.ollama_template_callbacks.toggle_params_collapse pipeworks_mud_mapper.callbacks.ollama_template_callbacks.handle_seed_controls Module Contents --------------- .. py:function:: load_template_options(n_clicks) Load available templates for the dropdown. Called on app startup and when the refresh button is clicked. Templates are loaded from ``data/ollama/templates/``. .. py:function:: load_prompt_prefix_options(n_clicks) Load prompt prefix presets from JSON config. We reload on refresh to allow authors to edit the JSON and refresh without restarting the app. .. py:function:: load_param_preset_options(n_clicks) Load parameter presets from JSON files. .. py:function:: apply_param_preset(n_clicks, preset_id, target_words, temperature, top_p, top_k, num_predict) Apply a parameter preset to the tuning controls. .. py:function:: apply_prompt_prefix(prefix_id, current_prompt) Prepend a selected prompt prefix to the user prompt. .. py:function:: handle_template_selection(template_id, target_words) Handle template selection and target word count changes. When a template is selected or target words change, compiles the template into a system prompt with the specified word count guidance and updates the display. The system prompt remains read-only. .. py:function:: update_target_words_hint(target_words) Update helper text to show the effective word target behavior. .. py:function:: toggle_system_prompt_collapse(n_clicks, is_open) Toggle the system prompt collapse open/closed. .. py:function:: toggle_params_collapse(n_clicks, is_open) Toggle the parameters section collapse open/closed. .. py:function:: handle_seed_controls(decrease_clicks, increase_clicks, random_checked, current_seed) Handle seed control interactions (buttons and checkbox).