diff --git a/core/src/browser/extensions/engines/OAIEngine.ts b/core/src/browser/extensions/engines/OAIEngine.ts index df51d37bb0..0ed34c8db3 100644 --- a/core/src/browser/extensions/engines/OAIEngine.ts +++ b/core/src/browser/extensions/engines/OAIEngine.ts @@ -80,8 +80,8 @@ export abstract class OAIEngine extends AIEngine { role: ChatCompletionRole.Assistant, content: [], status: MessageStatus.Pending, - created: timestamp, - updated: timestamp, + created_at: timestamp, + completed_at: timestamp, object: 'thread.message', } diff --git a/core/src/node/api/restful/helper/builder.ts b/core/src/node/api/restful/helper/builder.ts index 230eb64ab0..31eb649a3c 100644 --- a/core/src/node/api/restful/helper/builder.ts +++ b/core/src/node/api/restful/helper/builder.ts @@ -194,8 +194,8 @@ export const createMessage = async (threadId: string, message: any) => { id: msgId, thread_id: threadId, status: MessageStatus.Ready, - created: createdAt, - updated: createdAt, + created_at: createdAt, + completed_at: createdAt, object: 'thread.message', role: message.role, content: [ diff --git a/core/src/types/message/messageEntity.ts b/core/src/types/message/messageEntity.ts index 7c2774da6d..302b824ee5 100644 --- a/core/src/types/message/messageEntity.ts +++ b/core/src/types/message/messageEntity.ts @@ -27,9 +27,9 @@ export type ThreadMessage = { /** The status of this message. **/ status: MessageStatus /** The timestamp indicating when this message was created. Represented in Unix time. **/ - created: number + created_at: number /** The timestamp indicating when this message was updated. Represented in Unix time. **/ - updated: number + completed_at: number /** The additional metadata of this message. **/ metadata?: Record diff --git a/web/hooks/useSendChatMessage.ts b/web/hooks/useSendChatMessage.ts index bbe5e3cd71..68db97c2a8 100644 --- a/web/hooks/useSendChatMessage.ts +++ b/web/hooks/useSendChatMessage.ts @@ -181,7 +181,7 @@ export default function useSendChatMessage() { // Update thread state const updatedThread: Thread = { ...activeThreadRef.current, - updated: newMessage.created, + updated: newMessage.created_at, metadata: { ...activeThreadRef.current.metadata, lastMessage: prompt, diff --git a/web/screens/Thread/ThreadCenterPanel/TextMessage/index.tsx b/web/screens/Thread/ThreadCenterPanel/TextMessage/index.tsx index 0af9b128e1..ddd82590bc 100644 --- a/web/screens/Thread/ThreadCenterPanel/TextMessage/index.tsx +++ b/web/screens/Thread/ThreadCenterPanel/TextMessage/index.tsx @@ -91,7 +91,7 @@ const MessageContainer: React.FC< : (activeAssistant?.assistant_name ?? props.role)}

- {props.created && displayDate(props.created ?? new Date())} + {props.created_at && displayDate(props.created_at ?? new Date())}

diff --git a/web/utils/datetime.ts b/web/utils/datetime.ts index e596f08418..aec1c92ab8 100644 --- a/web/utils/datetime.ts +++ b/web/utils/datetime.ts @@ -6,7 +6,10 @@ export const isToday = (timestamp: number) => { export const displayDate = (timestamp?: string | number | Date) => { if (!timestamp) return 'N/A' - const date = new Date(timestamp) + const date = + typeof timestamp === 'number' + ? new Date(timestamp * 1000) + : new Date(timestamp) let displayDate = `${date.toLocaleDateString(undefined, { day: '2-digit',