Skip to content

Commit d784322

Browse files
committed
update requestFix code
1 parent c30fa2c commit d784322

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

app/(main)/chats/[id]/page.client.tsx

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
"use client";
22

3-
import {
4-
createMessage,
5-
getNextCompletionStreamPromise,
6-
} from "@/app/(main)/actions";
3+
import { createMessage } from "@/app/(main)/actions";
74
import LogoSmall from "@/components/icons/logo-small";
85
import { splitByFirstCodeFence } from "@/lib/utils";
96
import Link from "next/link";
@@ -153,11 +150,22 @@ export default function PageClient({ chat }: { chat: Chat }) {
153150
newMessageText,
154151
"user",
155152
);
156-
const { streamPromise } =
157-
await getNextCompletionStreamPromise(
158-
message.id,
159-
chat.model,
160-
);
153+
154+
const streamPromise = fetch(
155+
"/api/get-next-completion-stream-promise",
156+
{
157+
method: "POST",
158+
body: JSON.stringify({
159+
messageId: message.id,
160+
model: chat.model,
161+
}),
162+
},
163+
).then((res) => {
164+
if (!res.body) {
165+
throw new Error("No body on response");
166+
}
167+
return res.body;
168+
});
161169
setStreamPromise(streamPromise);
162170
router.refresh();
163171
});

0 commit comments

Comments
 (0)