We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 100c9a3 commit 4d6cd77Copy full SHA for 4d6cd77
1 file changed
src/routes/chat-completions/route.ts
@@ -9,18 +9,19 @@ import { handlerStreaming } from "./handler-streaming"
9
10
export const completionRoutes = new Hono()
11
12
-completionRoutes.post("/chat/completions", (c) => {
+completionRoutes.post("/chat/completions", async (c) => {
13
try {
14
if (ENV.EMULATE_STREAMING) {
15
- return handler(c)
16
- } else {
17
- return handlerStreaming(c)
+ return await handler(c)
18
}
+
+ return await handlerStreaming(c)
19
} catch (error) {
20
if (error instanceof FetchError) {
21
consola.error(`Request failed: ${error.message}`, error.response?._data)
22
+ } else {
23
+ consola.error("Error:", error)
24
- consola.error(error)
25
26
throw error
27
0 commit comments