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:
@@ -19,6 +19,9 @@ import { DyadProblemSummary } from "./DyadProblemSummary";
|
||||
import { IpcClient } from "@/ipc/ipc_client";
|
||||
import { DyadMcpToolCall } from "./DyadMcpToolCall";
|
||||
import { DyadMcpToolResult } from "./DyadMcpToolResult";
|
||||
import { DyadWebSearchResult } from "./DyadWebSearchResult";
|
||||
import { DyadWebSearch } from "./DyadWebSearch";
|
||||
import { DyadRead } from "./DyadRead";
|
||||
|
||||
interface DyadMarkdownParserProps {
|
||||
content: string;
|
||||
@@ -124,6 +127,9 @@ function preprocessUnclosedTags(content: string): {
|
||||
"dyad-chat-summary",
|
||||
"dyad-edit",
|
||||
"dyad-codebase-context",
|
||||
"dyad-web-search-result",
|
||||
"dyad-web-search",
|
||||
"dyad-read",
|
||||
"think",
|
||||
"dyad-command",
|
||||
"dyad-mcp-tool-call",
|
||||
@@ -193,6 +199,9 @@ function parseCustomTags(content: string): ContentPiece[] {
|
||||
"dyad-chat-summary",
|
||||
"dyad-edit",
|
||||
"dyad-codebase-context",
|
||||
"dyad-web-search-result",
|
||||
"dyad-web-search",
|
||||
"dyad-read",
|
||||
"think",
|
||||
"dyad-command",
|
||||
"dyad-mcp-tool-call",
|
||||
@@ -282,6 +291,40 @@ function renderCustomTag(
|
||||
const { tag, attributes, content, inProgress } = tagInfo;
|
||||
|
||||
switch (tag) {
|
||||
case "dyad-read":
|
||||
return (
|
||||
<DyadRead
|
||||
node={{
|
||||
properties: {
|
||||
path: attributes.path || "",
|
||||
},
|
||||
}}
|
||||
>
|
||||
{content}
|
||||
</DyadRead>
|
||||
);
|
||||
case "dyad-web-search":
|
||||
return (
|
||||
<DyadWebSearch
|
||||
node={{
|
||||
properties: {},
|
||||
}}
|
||||
>
|
||||
{content}
|
||||
</DyadWebSearch>
|
||||
);
|
||||
case "dyad-web-search-result":
|
||||
return (
|
||||
<DyadWebSearchResult
|
||||
node={{
|
||||
properties: {
|
||||
state: getState({ isStreaming, inProgress }),
|
||||
},
|
||||
}}
|
||||
>
|
||||
{content}
|
||||
</DyadWebSearchResult>
|
||||
);
|
||||
case "think":
|
||||
return (
|
||||
<DyadThink
|
||||
|
||||
Reference in New Issue
Block a user