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 available templates for the dropdown. |
|
Load prompt prefix presets from JSON config. |
|
Load parameter presets from JSON files. |
|
Apply a parameter preset to the tuning controls. |
|
Prepend a selected prompt prefix to the user prompt. |
|
Handle template selection and target word count changes. |
|
Update helper text to show the effective word target behavior. |
|
Toggle the system prompt collapse open/closed. |
|
Toggle the parameters section collapse open/closed. |
|
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.