File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"use client" ;
22
3- import {
4- createMessage ,
5- getNextCompletionStreamPromise ,
6- } from "@/app/(main)/actions" ;
3+ import { createMessage } from "@/app/(main)/actions" ;
74import LogoSmall from "@/components/icons/logo-small" ;
85import { splitByFirstCodeFence } from "@/lib/utils" ;
96import 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 } ) ;
You can’t perform that action at this time.
0 commit comments