mirror of
https://github.com/langgenius/webapp-conversation.git
synced 2025-12-21 05:16:38 +08:00
feat: support steaming
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
import { type NextRequest } from 'next/server'
|
||||
import { client, getInfo } from '@/app/api/utils/common'
|
||||
import { OpenAIStream } from '@/app/api/utils/stream'
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
const body = await request.json()
|
||||
@ -12,6 +11,5 @@ export async function POST(request: NextRequest) {
|
||||
} = body
|
||||
const { user } = getInfo(request)
|
||||
const res = await client.createChatMessage(inputs, query, user, responseMode, conversationId)
|
||||
const stream = await OpenAIStream(res as any)
|
||||
return new Response(stream as any)
|
||||
return new Response(res.data as any)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user