Skip to content

Commit d615739

Browse files
committed
chore: add createdAt and updatedAt to session
1 parent 37492c4 commit d615739

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/config/localSession.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export const getSession = async (sessionId) => {
5151
}
5252

5353
export const updateSession = async (newSession) => {
54+
newSession.updatedAt = new Date().toISOString()
5455
const currentSessions = await getSessions()
5556
currentSessions[
5657
currentSessions.findIndex((session) => session.sessionId === newSession.sessionId)

src/utils/init-session.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { v4 as uuidv4 } from 'uuid'
77
* @property {Object[]|null} conversationRecords
88
* @property {string|null} sessionName
99
* @property {string|null} sessionId
10+
* @property {string|null} createdAt
11+
* @property {string|null} updatedAt
1012
* @property {string|null} aiName
1113
* @property {string|null} modelName
1214
* @property {boolean|null} autoClean
@@ -45,6 +47,8 @@ export function initSession({
4547

4648
sessionName,
4749
sessionId: uuidv4(),
50+
createdAt: new Date().toISOString(),
51+
updatedAt: new Date().toISOString(),
4852

4953
aiName: modelName ? Models[modelName].desc : null,
5054
modelName,

0 commit comments

Comments
 (0)