mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-06-25 03:08:53 +00:00
fetch chats with userid
This commit is contained in:
@ -20,8 +20,8 @@ const Page = () => {
|
||||
useEffect(() => {
|
||||
const fetchChats = async () => {
|
||||
setLoading(true);
|
||||
|
||||
const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/chats`, {
|
||||
let userId = localStorage.getItem("userId");
|
||||
const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/chats?userId=` + userId, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@ -65,14 +65,14 @@ const Page = () => {
|
||||
</div>
|
||||
<hr className="border-t border-[#2B2C2C] my-4 w-full"/>
|
||||
</div>
|
||||
{chats.length === 0 && (
|
||||
{chats && chats.length === 0 && (
|
||||
<div className="flex flex-row items-center justify-center min-h-screen">
|
||||
<p className="text-black/70 dark:text-white/70 text-sm">
|
||||
No chats found.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
{chats.length > 0 && (
|
||||
{chats && chats.length > 0 && (
|
||||
<div className="flex flex-col pb-20 lg:pb-2">
|
||||
{chats.map((chat, i) => (
|
||||
<div
|
||||
|
@ -525,7 +525,7 @@ const ChatWindow = ({id}: { id?: string }) => {
|
||||
focusMode: focusMode,
|
||||
copilotEnabled: copilotEnabled,
|
||||
optimizationMode: optimizationMode,
|
||||
history: [...chatHistory, ['human', message]],
|
||||
history: [],
|
||||
}),
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user