hf-Chat-ui / src /routes /r /[id] /+page.server.ts
DaFujaTyping's picture
Duplicate from huggingchat/chat-ui
0260a08
raw
history blame contribute delete
476 Bytes
import type { PageServerLoad } from "./$types";
import { collections } from "$lib/server/database";
import { error } from "@sveltejs/kit";
export const load: PageServerLoad = async ({ params }) => {
const conversation = await collections.sharedConversations.findOne({
_id: params.id,
});
if (!conversation) {
throw error(404, "Conversation not found");
}
return {
messages: conversation.messages,
title: conversation.title,
model: conversation.model,
};
};