mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
Add streaming to AI
This commit is contained in:
17
dashboard/server/api/ai/[chat_id]/status.ts
Normal file
17
dashboard/server/api/ai/[chat_id]/status.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
import { AiChatModel } from "@schema/ai/AiChatSchema";
|
||||
|
||||
export default defineEventHandler(async event => {
|
||||
const data = await getRequestData(event);
|
||||
if (!data) return;
|
||||
|
||||
const { project_id } = data;
|
||||
|
||||
if (!event.context.params) return;
|
||||
const chat_id = event.context.params['chat_id'];
|
||||
|
||||
const chat = await AiChatModel.findOne({ _id: chat_id, project_id }, { status: 1, completed: 1 });
|
||||
if (!chat) return;
|
||||
|
||||
return { status: chat.status, completed: chat.completed || false }
|
||||
});
|
||||
Reference in New Issue
Block a user