Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions frontend/src/app/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"use client";

import { useEffect } from "react";

export default function Error({
error,
reset,
}: {
error: Error & { digest?: string };
reset: () => void;
}) {
useEffect(() => {
console.error(error);
}, [error]);

return (
<div className="premium-card m-6 rounded-[22px] border p-6">
<h2 className="text-base font-semibold">Something went wrong</h2>
<p className="mt-2 whitespace-pre-wrap text-sm text-muted-foreground">
{error.message || "An unexpected client-side error occurred."}
</p>
<button
onClick={reset}
className="mini-action mt-4"
>
Try again
</button>
</div>
);
}
6 changes: 3 additions & 3 deletions frontend/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export default function Dashboard() {
</span>
<span className="flex shrink-0 items-center gap-2">
{memory.pinned && <Pin className="h-3.5 w-3.5 text-amber-500" />}
<span className="score-chip">{memory.hscore === null ? "—" : memory.hscore.toFixed(2)}</span>
<span className="score-chip">{memory.hscore == null ? "—" : memory.hscore.toFixed(2)}</span>
</span>
</button>
))}
Expand Down Expand Up @@ -233,7 +233,7 @@ export default function Dashboard() {
<div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-4">
{people.map((person, index) => (
<Link key={person.key} href={`/people/?person=${encodeURIComponent(person.key)}`} className="identity-card">
<span className={`identity-avatar avatar-${index % 4}`}>{person.name.slice(0, 2).toUpperCase()}</span>
<span className={`identity-avatar avatar-${index % 4}`}>{(person.name || "?").slice(0, 2).toUpperCase()}</span>
<span className="min-w-0">
<strong className="block truncate text-sm">{person.name}</strong>
<small className="text-[10px] text-muted-foreground">{person.memory_count} memories</small>
Expand All @@ -242,7 +242,7 @@ export default function Dashboard() {
))}
{people.length === 0 && organizations.slice(0, 4).map((org, index) => (
<Link key={org.key} href="/organizations" className="identity-card">
<span className={`identity-avatar avatar-${index % 4}`}>{org.name.slice(0, 2).toUpperCase()}</span>
<span className={`identity-avatar avatar-${index % 4}`}>{(org.name || "?").slice(0, 2).toUpperCase()}</span>
<span className="min-w-0">
<strong className="block truncate text-sm">{org.name}</strong>
<small className="text-[10px] text-muted-foreground">{org.memory_count} memories</small>
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ async function fetchApi<T>(path: string, options?: RequestInit): Promise<T> {
} catch {}
throw new Error(`API error ${detail}`);
}
return res.json();
try {
return (await res.json()) as T;
} catch {
throw new Error(`API error: invalid response from ${path}`);
}
}

export function wsUrl(): string {
Expand Down
31 changes: 31 additions & 0 deletions server/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,29 @@ async def _run() -> dict:
return 0


def cmd_remove_demo(args: argparse.Namespace) -> int:
"""Remove all demo-tagged memories, leaving real data untouched."""
import asyncio

from server.core import engine_provider

async def _run() -> dict:
engine = engine_provider.get_engine()
await engine.initialize()
try:
return await engine.remove_demo_data()
finally:
await engine.shutdown()

result = asyncio.run(_run())
removed = result.get("removed", 0)
if removed == 0:
print(" No demo data found — nothing to remove.")
else:
print(f" Removed {removed} demo memories.")
return 0


# ── mcp config ───────────────────────────────────────────────────

def cmd_mcp_config(args: argparse.Namespace) -> int:
Expand Down Expand Up @@ -1576,6 +1599,12 @@ def main() -> int:
help="Seed even if the store already has memories",
)

# remove-demo (onboarding: strip the demo corpus back out)
sub.add_parser(
"remove-demo",
help="Remove demo-tagged memories, leaving real data untouched",
)

# entities (persistent entity knowledge graph)
ent_p = sub.add_parser("entities", help="Persistent entity knowledge graph")
ent_sub = ent_p.add_subparsers(dest="entities_command")
Expand Down Expand Up @@ -1654,6 +1683,8 @@ def main() -> int:
return cmd_purge(args)
elif args.command == "seed-demo":
return cmd_seed_demo(args)
elif args.command == "remove-demo":
return cmd_remove_demo(args)
elif args.command == "entities":
if args.entities_command in ("reindex", "list", "about"):
return cmd_entities(args)
Expand Down
Loading