feat: add memory settings page

This commit is contained in:
Henry Li
2026-02-03 18:18:56 +08:00
parent 4d650f35f8
commit 6b53456b39
13 changed files with 411 additions and 17 deletions

View File

@@ -0,0 +1,9 @@
import { getBackendBaseURL } from "../config";
import type { UserMemory } from "./types";
export async function loadMemory() {
const memory = await fetch(`${getBackendBaseURL()}/api/memory`);
const json = await memory.json();
return json as UserMemory;
}

View File

@@ -0,0 +1,11 @@
import { useQuery } from "@tanstack/react-query";
import { loadMemory } from "./api";
export function useMemory() {
const { data, isLoading, error } = useQuery({
queryKey: ["memory"],
queryFn: () => loadMemory(),
});
return { memory: data ?? null, isLoading, error };
}

View File

@@ -0,0 +1,2 @@
export * from "./api";
export * from "./types";

View File

@@ -0,0 +1,40 @@
export interface UserMemory {
version: string;
lastUpdated: string;
user: {
workContext: {
summary: string;
updatedAt: string;
};
personalContext: {
summary: string;
updatedAt: string;
};
topOfMind: {
summary: string;
updatedAt: string;
};
};
history: {
recentMonths: {
summary: string;
updatedAt: string;
};
earlierContext: {
summary: string;
updatedAt: string;
};
longTermBackground: {
summary: string;
updatedAt: string;
};
};
facts: {
id: string;
content: string;
category: string;
confidence: number;
createdAt: string;
source: string;
}[];
}