Support web search (#1370)
<!-- This is an auto-generated description by cubic. --> ## Summary by cubic Adds web search to Dyad Pro chats with a new UI, tag parsing, and a Pro Mode toggle that wires through to the engine. - **New Features** - Pro Mode toggle: “Web Search” (settings.enableProWebSearch). - New custom tags: dyad-web-search, dyad-web-search-result, dyad-read. - Collapsible Web Search Result UI with in-progress badge and markdown rendering. - Engine integration: passes enable_web_search and activates DyadEngine when web search is on. <!-- End of auto-generated description by cubic. -->
This commit is contained in:
31
src/components/chat/DyadWebSearch.tsx
Normal file
31
src/components/chat/DyadWebSearch.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import type React from "react";
|
||||
import type { ReactNode } from "react";
|
||||
import { Globe } from "lucide-react";
|
||||
|
||||
interface DyadWebSearchProps {
|
||||
children?: ReactNode;
|
||||
node?: any;
|
||||
query?: string;
|
||||
}
|
||||
|
||||
export const DyadWebSearch: React.FC<DyadWebSearchProps> = ({
|
||||
children,
|
||||
node: _node,
|
||||
query: queryProp,
|
||||
}) => {
|
||||
const query = queryProp || (typeof children === "string" ? children : "");
|
||||
|
||||
return (
|
||||
<div className="bg-(--background-lightest) rounded-lg px-4 py-2 border my-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<Globe size={16} className="text-blue-600" />
|
||||
<div className="text-xs text-blue-600 font-medium">Web Search</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-sm italic text-gray-600 dark:text-gray-300 mt-2">
|
||||
{query || children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user