mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00
fix: save chat
This commit is contained in:
@@ -51,7 +51,7 @@ export async function saveChat({
|
|||||||
userId
|
userId
|
||||||
}: Props & { userId: string }) {
|
}: Props & { userId: string }) {
|
||||||
await connectToDatabase();
|
await connectToDatabase();
|
||||||
await authModel({ modelId, userId, authOwner: false });
|
const { model } = await authModel({ modelId, userId, authOwner: false });
|
||||||
|
|
||||||
const content = prompts.map((item) => ({
|
const content = prompts.map((item) => ({
|
||||||
_id: item._id ? new mongoose.Types.ObjectId(item._id) : undefined,
|
_id: item._id ? new mongoose.Types.ObjectId(item._id) : undefined,
|
||||||
@@ -89,9 +89,14 @@ export async function saveChat({
|
|||||||
latestChat: content[1].value
|
latestChat: content[1].value
|
||||||
}).then((res) => res._id)
|
}).then((res) => res._id)
|
||||||
]),
|
]),
|
||||||
Model.findByIdAndUpdate(modelId, {
|
// update model
|
||||||
updateTime: new Date()
|
...(String(model.userId) === userId
|
||||||
}) // update model
|
? [
|
||||||
|
Model.findByIdAndUpdate(modelId, {
|
||||||
|
updateTime: new Date()
|
||||||
|
})
|
||||||
|
]
|
||||||
|
: [])
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Reference in New Issue
Block a user