Merge pull request #45 from jmorganca/go-embed

embed templates
This commit is contained in:
Michael Yang 2023-07-06 11:36:25 -07:00 committed by GitHub
commit 39e543447f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package server
import (
"embed"
"encoding/json"
"fmt"
"io"
@ -19,7 +20,9 @@ import (
"github.com/jmorganca/ollama/llama"
)
var templates = template.Must(template.ParseGlob("templates/*.prompt"))
//go:embed templates/*
var templatesFS embed.FS
var templates = template.Must(template.ParseFS(templatesFS, "templates/*.prompt"))
func generate(c *gin.Context) {
// TODO: these should be request parameters