feat: init

This commit is contained in:
Joel
2023-04-14 20:35:08 +08:00
parent 8acd8f6fbd
commit 97d3a6277d
77 changed files with 5299 additions and 0 deletions

View 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)
}