feat(server): add created timestamp to history (#6607)

This commit is contained in:
forehalo
2024-04-18 07:06:46 +00:00
parent 5fc56a20ac
commit d9e6561762
4 changed files with 8 additions and 1 deletions

View File

@@ -318,6 +318,7 @@ export class ChatSessionService {
select: {
id: true,
promptName: true,
createdAt: true,
messages: {
select: {
role: true,
@@ -335,7 +336,7 @@ export class ChatSessionService {
})
.then(sessions =>
Promise.all(
sessions.map(async ({ id, promptName, messages }) => {
sessions.map(async ({ id, promptName, messages, createdAt }) => {
try {
const ret = PromptMessageSchema.array().safeParse(messages);
if (ret.success) {
@@ -357,6 +358,7 @@ export class ChatSessionService {
sessionId: id,
action: prompt.action || undefined,
tokens,
createdAt,
messages: preload.concat(ret.data),
};
} else {