Spaces:
Running
Running
Save user message on request (#337) (#492)
Browse files
src/routes/conversation/[id]/+server.ts
CHANGED
|
@@ -129,6 +129,19 @@ export async function POST({ request, fetch, locals, params, getClientAddress })
|
|
| 129 |
}
|
| 130 |
}
|
| 131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
// we now build the stream
|
| 133 |
const stream = new ReadableStream({
|
| 134 |
async start(controller) {
|
|
|
|
| 129 |
}
|
| 130 |
}
|
| 131 |
|
| 132 |
+
await collections.conversations.updateOne(
|
| 133 |
+
{
|
| 134 |
+
_id: convId,
|
| 135 |
+
},
|
| 136 |
+
{
|
| 137 |
+
$set: {
|
| 138 |
+
messages,
|
| 139 |
+
title: conv.title,
|
| 140 |
+
updatedAt: new Date(),
|
| 141 |
+
},
|
| 142 |
+
}
|
| 143 |
+
);
|
| 144 |
+
|
| 145 |
// we now build the stream
|
| 146 |
const stream = new ReadableStream({
|
| 147 |
async start(controller) {
|