OpenConceptLab/ocl_issues#2383 | AI Assistant Drop Down for Prompt + model#15
OpenConceptLab/ocl_issues#2383 | AI Assistant Drop Down for Prompt + model#15snyaggarwal wants to merge 3 commits intomainfrom
Conversation
There was a problem hiding this comment.
Prompt Template Persistence & Version Resolution
The UI selection work looks good, but there's a significant gap: the prompt template + model selection is not persisted on the project. Currently it's ephemeral React state that resets on reload. The intended behavior:
1. Project config should persist prompt_template_key + default model
The MapProject needs to store which prompt template key (e.g. match-recommend) and model the user selected as defaults for that project. This likely requires an API-side field on MapProject in oclapi2. On page load, the project's saved key should be the initial selection — not just falling back to PROMPTS_KEY_DEFAULT every time. The global default for this is -- including for map projects that do not have their project default defined -- is match-recommend (no prompt template version is resolved as latest at runtime) using the default model for the match-recommend template. This global default value does not actually need to be set for each project, since the Mapper should be able to handle this runtime. For sysadmins, the ability to change the default template might be useful, so that should be a global config value.
2. Version resolution should happen at invocation time, not page load
Currently the version comes from whatever /prompts/ returned when the page loaded. Instead:
- Config stores only the key (no version) — so when an OCL admin publishes an improved prompt template, users automatically get it without changing their config.
- At invocation time (when AI assistant is called, or at the start of an auto-match run), resolve the current version from the API. This ensures a single auto-match run uses a consistent prompt template version throughout, even if the template is updated on the backend mid-run.
- Log the fully-resolved
prompt_template_uri(e.g./prompts/match-recommend/v3/) with each AI response for full auditability.
3. Summary of expected data flow
| Layer | What's stored | When |
|---|---|---|
| Project config | prompt_template_key + model_id |
User saves config; Optional with fallback to global default |
| Runtime (per run) | Resolved prompt_template_uri (key + version) |
Start of auto-match |
| AI response log | Full prompt_template_uri + model |
Each AI response |
Version pinning (letting users pick a specific version) is not MVP — future feature.
Dead code: AIPromptTemplateSelector.jsx
AIPromptTemplateSelector.jsx is added in this PR but never imported or used anywhere. Should be removed, or if it's planned for a future integration point, defer it to that ticket.
Linked Issue
Ref OpenConceptLab/ocl_issues#2383