feat(scheduler): per-task model preset override#1462
Open
SinisterMinister wants to merge 7 commits intoagent0ai:mainfrom
Open
feat(scheduler): per-task model preset override#1462SinisterMinister wants to merge 7 commits intoagent0ai:mainfrom
SinisterMinister wants to merge 7 commits intoagent0ai:mainfrom
Conversation
Allows specifying a model preset (e.g. Haiku, Cost Efficient) on individual scheduled, ad-hoc, and planned tasks. When set, the chat model override is applied to the task agent context before the monologue runs, keeping utility/embedding models unchanged. Changes: - BaseTask: add optional model field (preset name string) - _run_task_wrapper: apply chat_model_override before monologue - serialize/deserialize: include model field - scheduler_task_create API: accept model param - scheduler_task_update API: accept model param - scheduler tool: all create methods accept model kwarg - scheduler-store.js: fetch presets, include model in payload - scheduler-task-editor.html: add Model Preset dropdown to forms
- Normalize model field from null to empty string in composeEditingTask so it correctly matches the empty <option value=''> in the select - Add :selected binding to each option in x-for so Alpine.js correctly reflects the saved model value even if x-model evaluates before x-for options are rendered (Alpine rendering order race condition)
…enders Alpine.js evaluates x-model on <select> before x-for creates the dynamic <option> elements. Even with correct editingTask.model, no matching option exists in DOM yet so the select falls back to global default. Adding x-effect with defers the value assignment until AFTER Alpine finishes rendering all child elements, at which point the x-for options exist and .value correctly selects the saved preset.
fetchModelPresets was calling /model_presets which doesn't exist. Plugin API endpoints follow the path /plugins/<plugin>/<handler>. Correct URL is /plugins/_model_config/model_presets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a per-task model preset override to the Task Scheduler, allowing each scheduled, ad-hoc, or planned task to run with a specific model preset instead of always using the global default.
Changes
Backend
helpers/task_scheduler.py— addsmodel: str | Nonefield toBaseTask; update method uses an ellipsis sentinel soNoneis a valid explicit value; serialization/deserialization includes the field; applieschat_model_overrideon the agent context before running a taskapi/scheduler_task_create.py— reads optionalmodelfrom the create payload and sets it on the new taskapi/scheduler_task_update.py— reads optionalmodelfrom the update payload (empty string →None)tools/scheduler.py— passesmodelkwarg through all three task creation helpers (create_scheduled_task,create_adhoc_task,create_planned_task)Frontend
webui/components/modals/scheduler/scheduler-store.js— addsmodelto the default editing-task shape and tocomposeEditingTask/buildPayloadFromEditingTask; fetches available model presets from the_model_configplugin on store initwebui/components/modals/scheduler/scheduler-task-editor.html— adds a Model Preset<select>dropdown to both the scheduled and ad-hoc/planned task editor panels, populated from the fetched presetsBehaviour
chat_model_overrideon the task's agent context before callingmonologue(), overriding the model for that run only— Global default —as the first option and lists all configured presets below itTesting