plumbing for cli context and loader, stash before picking up initializers

This commit is contained in:
Dave Lee 2023-06-01 23:43:34 -04:00
parent 45285bb5d8
commit 1ef6ba2b52
No known key found for this signature in database
6 changed files with 139 additions and 34 deletions

View file

@ -1,16 +1,21 @@
package apiv2
import "net/http"
import (
"net/http"
func NewLocalAINetHTTPServer(configManager *ConfigManager) *LocalAIServer {
"github.com/go-skynet/LocalAI/pkg/model"
)
func NewLocalAINetHTTPServer(configManager *ConfigManager, loader *model.ModelLoader, address string) *LocalAIServer {
localAI := LocalAIServer{
configManager: configManager,
loader: loader,
}
var middlewares []StrictMiddlewareFunc
http.Handle("/", Handler(NewStrictHandler(&localAI, middlewares)))
http.ListenAndServe(":8085", nil)
http.ListenAndServe(address, nil)
return &localAI
}