File size: 476 Bytes
5da61b4
 
 
fc15a4c
76d4779
 
5da61b4
fc15a4c
 
 
5da61b4
fc15a4c
 
 
5da61b4
9405a81
2606dde
fc15a4c
76d4779
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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,
	};
};