Commit 8ea5e5e1 authored by Bruce MacDonald's avatar Bruce MacDonald Committed by Jeffrey Morgan
Browse files

separate routes

parent fd962a36
......@@ -14,15 +14,17 @@ import (
"github.com/jmorganca/ollama/api"
)
func Serve(ln net.Listener) error {
r := gin.Default()
func pull(c *gin.Context) {
// TODO
c.JSON(http.StatusOK, gin.H{"message": "ok"})
}
func generate(c *gin.Context) {
// TODO: these should be request parameters
gpulayers := 0
tokens := 512
threads := runtime.NumCPU()
r.POST("/api/generate", func(c *gin.Context) {
// TODO: set prompt from template
fmt.Println("Generating text...")
......@@ -61,7 +63,14 @@ func Serve(ln net.Listener) error {
c.SSEvent("token", tok)
return true
})
})
}
func Serve(ln net.Listener) error {
r := gin.Default()
r.POST("api/pull", pull)
r.POST("/api/generate", generate)
log.Printf("Listening on %s", ln.Addr())
s := &http.Server{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment