Adding user session for history
Adding max record limt in settings
This commit is contained in:
parent
8dc54efbdd
commit
dce3a9eca0
5 changed files with 115 additions and 4 deletions
|
|
@ -25,6 +25,7 @@ type Message = {
|
|||
messageId: string;
|
||||
chatId: string;
|
||||
content: string;
|
||||
userSessionId: string;
|
||||
};
|
||||
|
||||
type ChatModel = {
|
||||
|
|
@ -135,7 +136,7 @@ const handleHistorySave = async (
|
|||
});
|
||||
|
||||
const fileData = files.map(getFileDetails);
|
||||
|
||||
let currentDate = new Date();
|
||||
if (!chat) {
|
||||
await db
|
||||
.insert(chats)
|
||||
|
|
@ -145,6 +146,8 @@ const handleHistorySave = async (
|
|||
createdAt: new Date().toString(),
|
||||
focusMode: focusMode,
|
||||
files: fileData,
|
||||
userSessionId: message.userSessionId,
|
||||
timestamp: currentDate.toISOString(),
|
||||
})
|
||||
.execute();
|
||||
} else if (JSON.stringify(chat.files ?? []) != JSON.stringify(fileData)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue