feat: implement memos chat backend function (#1934)

* feat: implment backend function

* eslint

* eslint

* eslint
This commit is contained in:
CorrectRoadH
2023-07-13 11:25:59 +08:00
committed by GitHub
parent 6adbb7419c
commit d8b6e92813
6 changed files with 172 additions and 0 deletions

View File

@ -64,6 +64,11 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store
}))
e.Use(middleware.TimeoutWithConfig(middleware.TimeoutConfig{
Skipper: func(c echo.Context) bool {
// this is a hack to skip timeout for openai chat streaming
// because streaming require to flush response. But the timeout middleware will break it.
return c.Request().URL.Path == "/api/openai/chat-streaming"
},
ErrorMessage: "Request timeout",
Timeout: 30 * time.Second,
}))