mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-18 07:05:08 +08:00
Fixbug test typing
This commit is contained in:
@@ -4,29 +4,19 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"testing"
|
"testing"
|
||||||
|
"strings"
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ollamaTestSurface struct {
|
type ollamaTestSurface struct {
|
||||||
Store shared.ConfigReader
|
Store ConfigReader
|
||||||
handler *Handler
|
handler *Handler
|
||||||
}
|
}
|
||||||
|
|
||||||
GetVersion(w http.ResponseWriter, r *http.Request) {
|
|
||||||
w.Header().Set("Content-Type", "application/json")
|
|
||||||
w.WriteHeader(http.StatusOK)
|
|
||||||
_, _ = w.Write([]byte(`{"version":"0.23.1"}`))
|
|
||||||
}
|
|
||||||
func (h *Handler) ListOllamaModels(w http.ResponseWriter, r *http.Request) {
|
|
||||||
WriteJSON(w, http.StatusOK, config.OllamaModelsResponse())
|
|
||||||
}
|
|
||||||
func (h *Handler) GetOllamaModel
|
|
||||||
|
|
||||||
func registerOllamaTestRoutes(r chi.Router, h *ollamaTestSurface) {
|
func registerOllamaTestRoutes(r chi.Router, h *ollamaTestSurface) {
|
||||||
r.Get("/api/version", h.handler().GetVersion)
|
r.Get("/api/version", h.handler().GetVersion)
|
||||||
r.Get("/api/tags", h.modelsHandler().ListOllamaModels)
|
r.Get("/api/tags", h.handler().ListOllamaModels)
|
||||||
r.Post("/api/show", h.chatHandler().GetOllamaModel)
|
r.Post("/api/show", h.handler().GetOllamaModel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user