Spaces:
Running
Running
Add assistant instructions to first system message (#1023)
Browse files
src/routes/conversation/+server.ts
CHANGED
@@ -95,6 +95,10 @@ export const POST: RequestHandler = async ({ locals, request }) => {
|
|
95 |
values.preprompt ??= model?.preprompt ?? "";
|
96 |
}
|
97 |
|
|
|
|
|
|
|
|
|
98 |
const res = await collections.conversations.insertOne({
|
99 |
_id: new ObjectId(),
|
100 |
title: title || "New Chat",
|
|
|
95 |
values.preprompt ??= model?.preprompt ?? "";
|
96 |
}
|
97 |
|
98 |
+
if (messages && messages.length > 0 && messages[0].from === "system") {
|
99 |
+
messages[0].content = values.preprompt;
|
100 |
+
}
|
101 |
+
|
102 |
const res = await collections.conversations.insertOne({
|
103 |
_id: new ObjectId(),
|
104 |
title: title || "New Chat",
|