1
0
mirror of https://github.com/coalaura/whiskr.git synced 2025-09-09 17:29:54 +00:00

title generation

This commit is contained in:
Laura
2025-08-25 22:45:03 +02:00
parent 3eac1a0795
commit 82e91cfc3e
14 changed files with 392 additions and 31 deletions

View File

@@ -31,11 +31,18 @@ var (
//go:embed internal/tools.txt
InternalToolsPrompt string
//go:embed internal/title.txt
InternalTitlePrompt string
InternalTitleTmpl *template.Template
Prompts []Prompt
Templates = make(map[string]*template.Template)
)
func init() {
InternalTitleTmpl = NewTemplate("internal-title", InternalTitlePrompt)
var err error
Prompts, err = LoadPrompts()
@@ -43,6 +50,8 @@ func init() {
}
func NewTemplate(name, text string) *template.Template {
text = strings.ReplaceAll(text, "\r", "")
return template.Must(template.New(name).Parse(text))
}