forked from tuvn86/webapp-conversation
feat: init
This commit is contained in:
parent
8acd8f6fbd
commit
97d3a6277d
77 changed files with 5299 additions and 0 deletions
17
app/api/chat-messages/route.ts
Normal file
17
app/api/chat-messages/route.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { type NextRequest } from 'next/server'
|
||||
import { getInfo, client } from '@/app/api/utils/common'
|
||||
import { OpenAIStream } from '@/app/api/utils/stream'
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
const body = await request.json()
|
||||
const {
|
||||
inputs,
|
||||
query,
|
||||
conversation_id: conversationId,
|
||||
response_mode: responseMode
|
||||
} = 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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue