Skip to content

Commit

Permalink
update timestamp in chat prompt (#1008)
Browse files Browse the repository at this point in the history
  • Loading branch information
an-lee authored Aug 23, 2024
1 parent d8afb2f commit 6304b89
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions enjoy/src/renderer/context/chat-session-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ import { ChatPromptTemplate } from "@langchain/core/prompts";
import { ChevronDownIcon } from "lucide-react";
import { AudioPlayer, RecordingDetail } from "@renderer/components";
import { CHAT_SYSTEM_PROMPT_TEMPLATE } from "@/constants";
import { formatDateTime } from "@renderer/lib/utils";
import dayjs from "dayjs";
import relativeTime from "dayjs/plugin/relativeTime";

dayjs.extend(relativeTime);

type ChatSessionProviderState = {
chatMessages: ChatMessageType[];
Expand Down Expand Up @@ -219,7 +222,7 @@ export const ChatSessionProvider = ({
(message) =>
`- ${(message.member.user || message.member.agent).name}: ${
message.content
}(${formatDateTime(message.createdAt)})`
}(${dayjs(message.createdAt).fromNow()})`
)
.join("\n"),
input: chatMessages.length > 0 ? "Continue" : "Start the conversation",
Expand Down

0 comments on commit 6304b89

Please sign in to comment.