Update environment configuration for production, refactor WebRTC components, and enhance chat functionality. Replace deprecated SessionUsersPanel with SessionPage, integrate chat history loading, and improve audio/video toggle handling. Remove unused SessionUsersPanel2 component and update related socket event handling in the server.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { Elysia, t } from "elysia";
|
||||
import { getChatHistory } from "../services/chat";
|
||||
|
||||
export const chatController = new Elysia({ prefix: "/sessions" })
|
||||
.get(
|
||||
"/:id/messages",
|
||||
async ({ params, query }) => {
|
||||
const { id } = params;
|
||||
const limit = query.limit ? parseInt(query.limit) : 100;
|
||||
|
||||
try {
|
||||
const messages = await getChatHistory(id, limit);
|
||||
|
||||
return {
|
||||
success: true,
|
||||
messages,
|
||||
count: messages.length,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("[Chat API] Error fetching chat history:", error);
|
||||
return {
|
||||
success: false,
|
||||
error: "Failed to fetch chat history",
|
||||
messages: [],
|
||||
count: 0,
|
||||
};
|
||||
}
|
||||
},
|
||||
{
|
||||
params: t.Object({
|
||||
id: t.String(),
|
||||
}),
|
||||
query: t.Object({
|
||||
limit: t.Optional(t.String()),
|
||||
}),
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user