MCPcopy
hub / github.com/mudler/LocalAI / newRequestApp

Function newRequestApp

core/http/middleware/request_test.go:22–33  ·  view source on GitHub ↗

newRequestApp creates a minimal Echo app with SetModelAndConfig middleware.

(re *RequestExtractor)

Source from the content-addressed store, hash-verified

20
21// newRequestApp creates a minimal Echo app with SetModelAndConfig middleware.
22func newRequestApp(re *RequestExtractor) *echo.Echo {
23 e := echo.New()
24 e.POST("/v1/chat/completions",
25 func(c echo.Context) error {
26 return c.String(http.StatusOK, "ok")
27 },
28 re.SetModelAndConfig(func() schema.LocalAIRequest {
29 return new(schema.OpenAIRequest)
30 }),
31 )
32 return e
33}
34
35func postJSON(e *echo.Echo, path, body string) *httptest.ResponseRecorder {
36 req := httptest.NewRequest(http.MethodPost, path, strings.NewReader(body))

Callers 1

request_test.goFile · 0.85

Calls 2

SetModelAndConfigMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected