fix(server): fetch filtered dashboard memories beyond default page (#5753)
This commit is contained in:
@@ -27,6 +27,8 @@ import { useApiQuery } from "@/hooks/use-api-query";
|
||||
import { Memory } from "@/types/api";
|
||||
|
||||
const PAGE_SIZE = 20;
|
||||
// Keep in sync with ALL_MEMORIES_LIMIT in server/main.py.
|
||||
const MEMORY_FETCH_LIMIT = 1000;
|
||||
|
||||
export default function MemoriesPage() {
|
||||
const [userId, setUserId] = useState("");
|
||||
@@ -41,7 +43,9 @@ export default function MemoriesPage() {
|
||||
refetch,
|
||||
} = useApiQuery<Memory[]>(
|
||||
async () => {
|
||||
const params = userId.trim() ? { user_id: userId.trim() } : undefined;
|
||||
const params = userId.trim()
|
||||
? { user_id: userId.trim(), top_k: MEMORY_FETCH_LIMIT }
|
||||
: { top_k: MEMORY_FETCH_LIMIT };
|
||||
const res = await api.get(MEMORY_ENDPOINTS.BASE, { params });
|
||||
const raw = res.data?.results ?? res.data ?? [];
|
||||
return Array.isArray(raw) ? raw : [];
|
||||
@@ -96,7 +100,7 @@ export default function MemoriesPage() {
|
||||
<div className="space-y-4">
|
||||
<h1 className="text-xl font-semibold font-fustat">Memories</h1>
|
||||
|
||||
{memories.length >= 1000 && (
|
||||
{memories.length >= MEMORY_FETCH_LIMIT && (
|
||||
<UpgradeBanner
|
||||
id="memories-1k"
|
||||
message="1,000+ memories stored. Categories can help organize them."
|
||||
|
||||
Reference in New Issue
Block a user