fix: resolve runtime crashes in tool-ui components and backend import errors

Backend:
- Remove dead imports (display_image, link_preview, knowledge_base) from tools registry and __init__
- Delete orphaned elif chain (lines 784-1046) in knowledge_base.py left after asyncio.gather refactor
- Add missing NotionAPIError class to notion_history.py

Frontend:
- Add display-image.tsx, link-preview.tsx, scrape-webpage.tsx tool UI components
- Fix GeneratePodcastToolUI: add null guard for no-props render + optional chaining on status/args
- Fix SaveMemoryToolUI/RecallMemoryToolUI: add null guard when rendered without props in provider
- Update launch.json to use pnpm on port 3999

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Vonic 2026-04-14 13:42:31 +07:00
parent 67429c287f
commit dc545f8028
10 changed files with 236 additions and 273 deletions

View file

@ -85,6 +85,57 @@ export const UpdateMemoryToolUI = ({
return null;
};
// ============================================================================
// Save Memory Tool UI (stub tool not yet in backend)
// ============================================================================
export const SaveMemoryToolUI = ({
status,
}: ToolCallMessagePartProps<{ content: string }, { status: string }>) => {
if (!status) return null;
const isRunning = status.type === "running" || status.type === "requires-action";
return (
<div className="my-3 flex items-center gap-3 rounded-lg border bg-card/60 px-4 py-3">
<div className="flex size-8 items-center justify-center rounded-full bg-primary/10">
{isRunning ? (
<Loader2Icon className="size-4 animate-spin text-primary" />
) : (
<BrainIcon className="size-4 text-primary" />
)}
</div>
<p className="text-sm font-medium">
{isRunning ? "Saving to memory..." : "Memory saved"}
</p>
{!isRunning && <CheckIcon className="ml-auto size-4 text-green-500" />}
</div>
);
};
// ============================================================================
// Recall Memory Tool UI (stub tool not yet in backend)
// ============================================================================
export const RecallMemoryToolUI = ({
status,
}: ToolCallMessagePartProps<{ query: string }, { memories: string[] }>) => {
if (!status) return null;
const isRunning = status.type === "running" || status.type === "requires-action";
return (
<div className="my-3 flex items-center gap-3 rounded-lg border bg-card/60 px-4 py-3">
<div className="flex size-8 items-center justify-center rounded-full bg-primary/10">
{isRunning ? (
<Loader2Icon className="size-4 animate-spin text-primary" />
) : (
<BrainIcon className="size-4 text-primary" />
)}
</div>
<p className="text-sm font-medium">
{isRunning ? "Recalling from memory..." : "Memory recalled"}
</p>
</div>
);
};
// ============================================================================
// Exports
// ============================================================================