separate routes
This commit is contained in:
parent
fd962a36e5
commit
8ea5e5e147
|
@ -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{
|
||||
|
|
Loading…
Reference in a new issue