feat: add web URL content fetcher for chat context

Add ability to fetch and inject web page content into chat as context.
Includes SSRF protection (blocks private IPs, localhost), content
extraction (strips scripts/styles/nav), and a clean popover UI.

Reimplements the concept from PR #1703 without the issues (duplicated
ChatBox, dual API routes, SSRF vulnerability, window.prompt UX).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Stijnus
2026-02-05 22:55:17 +01:00
parent b7ef2247b8
commit 2e254ac19a
6 changed files with 330 additions and 0 deletions

View File

@@ -81,6 +81,7 @@ interface BaseChatProps {
selectedElement?: ElementInfo | null;
setSelectedElement?: (element: ElementInfo | null) => void;
addToolResult?: ({ toolCallId, result }: { toolCallId: string; result: any }) => void;
onWebSearchResult?: (result: string) => void;
}
export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
@@ -130,6 +131,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
addToolResult = () => {
throw new Error('addToolResult not implemented');
},
onWebSearchResult,
},
ref,
) => {
@@ -465,6 +467,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
setDesignScheme={setDesignScheme}
selectedElement={selectedElement}
setSelectedElement={setSelectedElement}
onWebSearchResult={onWebSearchResult}
/>
</div>
</StickToBottom>