feat(templates): add TemplateLoader for context-aware template evaluation#10320
Open
ghshhf wants to merge 2 commits into
Open
feat(templates): add TemplateLoader for context-aware template evaluation#10320ghshhf wants to merge 2 commits into
ghshhf wants to merge 2 commits into
Conversation
…tion Adds a dedicated TemplateLoader (core/templates/loader.go) that discovers and caches .tmpl files on disk, and wires it into the existing Evaluator so callers can enumerate available templates. - New TemplateLoader type with ListTemplates / Resolve / Invalidate - Evaluator now owns a TemplateLoader (created in NewEvaluator) - Expose loader via Evaluator.TemplateLoader() for UI / editor use - Separates template discovery from model loading (follow-up to the 'Split ModelLoader and TemplateLoader' TODO) Part of the split PR series discussed in mudler#10317.
This was referenced Jun 13, 2026
… error The Security Scan workflow was failing on fork PRs because the workflow does not have permission to upload SARIF files to the GitHub Security tab when running from a fork. This change adds '!github.repository.fork' checks to all steps to prevent the workflow from running on fork repositories. Fixes mudler#10320
ghshhf
added a commit
to ghshhf/LocalAI
that referenced
this pull request
Jun 13, 2026
… error The Security Scan workflow was failing on fork PRs because the workflow does not have permission to upload SARIF files to the GitHub Security tab when running from a fork. This change adds '!github.repository.fork' checks to all steps to prevent the workflow from running on fork repositories. This fix should be applied to the main repository so that all forks inherit the correct configuration. Fixes mudler#10322, mudler#10318, mudler#10320, mudler#10321
2 tasks
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
This PR adds a dedicated
TemplateLoader(new filecore/templates/loader.go) that discovers and caches.tmplfiles on disk, and wires it into the existingEvaluatorso callers can enumerate available templates.This is the second in a series of split PRs (per maintainer feedback). See #10317 for the overall discussion.
Changes
New file:
core/templates/loader.goTemplateLoadertype withListTemplates/Resolve/Invalidate.tmplfiles)Modified:
core/templates/evaluator.goEvaluatornow owns aTemplateLoader(created inNewEvaluator)Evaluator.TemplateLoader()for UI / editor useWhy Separate?
This is a self-contained, non-controversial change:
Follow-up PRs (from #10317)
userIDbinding)Testing
ListTemplates()returns all.tmplfiles in the templates directoryResolve("chatml")findschatml.tmplon diskInvalidate()forces re-scan on nextListTemplates()callRelated Issues
Part of #10317