Fix generating title from messages (#442)

This commit is contained in:
Jeremy 2024-10-15 10:50:50 +05:30 committed by GitHub
parent 2705d83d6c
commit 00b125378c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 103 additions and 77 deletions

View file

@ -10,7 +10,7 @@ import { toast } from "sonner";
import useSWR from "swr";
import { Chat } from "@/db/schema";
import { fetcher } from "@/lib/utils";
import { fetcher, getTitleFromChat } from "@/lib/utils";
import {
InfoIcon,
@ -183,7 +183,7 @@ export const History = ({ user }: { user: User | undefined }) => {
href={`/chat/${chat.id}`}
className="text-ellipsis overflow-hidden text-left py-2 pl-2 rounded-lg outline-zinc-900"
>
{chat.messages[0].content as string}
{getTitleFromChat(chat)}
</Link>
</Button>