newRequestApp creates a minimal Echo app with SetModelAndConfig middleware.
(re *RequestExtractor)
| 20 | |
| 21 | // newRequestApp creates a minimal Echo app with SetModelAndConfig middleware. |
| 22 | func 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 | |
| 35 | func postJSON(e *echo.Echo, path, body string) *httptest.ResponseRecorder { |
| 36 | req := httptest.NewRequest(http.MethodPost, path, strings.NewReader(body)) |
no test coverage detected