pipeworks_mud_mapper.callbacks.ollama_template_callbacks

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

load_template_options(n_clicks)

Load available templates for the dropdown.

load_prompt_prefix_options(n_clicks)

Load prompt prefix presets from JSON config.

load_param_preset_options(n_clicks)

Load parameter presets from JSON files.

apply_param_preset(n_clicks, preset_id, target_words, ...)

Apply a parameter preset to the tuning controls.

apply_prompt_prefix(prefix_id, current_prompt)

Prepend a selected prompt prefix to the user prompt.

handle_template_selection(template_id, target_words)

Handle template selection and target word count changes.

update_target_words_hint(target_words)

Update helper text to show the effective word target behavior.

toggle_system_prompt_collapse(n_clicks, is_open)

Toggle the system prompt collapse open/closed.

toggle_params_collapse(n_clicks, is_open)

Toggle the parameters section collapse open/closed.

handle_seed_controls(decrease_clicks, increase_clicks, ...)

Handle seed control interactions (buttons and checkbox).

Module Contents

pipeworks_mud_mapper.callbacks.ollama_template_callbacks.load_template_options(n_clicks)[source]

Load available templates for the dropdown.

Called on app startup and when the refresh button is clicked. Templates are loaded from data/ollama/templates/.

pipeworks_mud_mapper.callbacks.ollama_template_callbacks.load_prompt_prefix_options(n_clicks)[source]

Load prompt prefix presets from JSON config.

We reload on refresh to allow authors to edit the JSON and refresh without restarting the app.

pipeworks_mud_mapper.callbacks.ollama_template_callbacks.load_param_preset_options(n_clicks)[source]

Load parameter presets from JSON files.

pipeworks_mud_mapper.callbacks.ollama_template_callbacks.apply_param_preset(n_clicks, preset_id, target_words, temperature, top_p, top_k, num_predict)[source]

Apply a parameter preset to the tuning controls.

pipeworks_mud_mapper.callbacks.ollama_template_callbacks.apply_prompt_prefix(prefix_id, current_prompt)[source]

Prepend a selected prompt prefix to the user prompt.

pipeworks_mud_mapper.callbacks.ollama_template_callbacks.handle_template_selection(template_id, target_words)[source]

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.

pipeworks_mud_mapper.callbacks.ollama_template_callbacks.update_target_words_hint(target_words)[source]

Update helper text to show the effective word target behavior.

pipeworks_mud_mapper.callbacks.ollama_template_callbacks.toggle_system_prompt_collapse(n_clicks, is_open)[source]

Toggle the system prompt collapse open/closed.

pipeworks_mud_mapper.callbacks.ollama_template_callbacks.toggle_params_collapse(n_clicks, is_open)[source]

Toggle the parameters section collapse open/closed.

pipeworks_mud_mapper.callbacks.ollama_template_callbacks.handle_seed_controls(decrease_clicks, increase_clicks, random_checked, current_seed)[source]

Handle seed control interactions (buttons and checkbox).