Explicit thinking (#183)

This commit is contained in:
Will Chen
2025-05-16 22:35:08 -07:00
committed by GitHub
parent f9f33596bd
commit 63e41454c7
3 changed files with 144 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ import { DyadExecuteSql } from "./DyadExecuteSql";
import { DyadAddIntegration } from "./DyadAddIntegration";
import { DyadEdit } from "./DyadEdit";
import { DyadCodebaseContext } from "./DyadCodebaseContext";
import { DyadThink } from "./DyadThink";
import { CodeHighlight } from "./CodeHighlight";
import { useAtomValue } from "jotai";
import { isStreamingAtom } from "@/atoms/chatAtoms";
@@ -119,6 +120,7 @@ function preprocessUnclosedTags(content: string): {
"dyad-chat-summary",
"dyad-edit",
"dyad-codebase-context",
"think",
];
let processedContent = content;
@@ -183,6 +185,7 @@ function parseCustomTags(content: string): ContentPiece[] {
"dyad-chat-summary",
"dyad-edit",
"dyad-codebase-context",
"think",
];
const tagPattern = new RegExp(
@@ -268,6 +271,18 @@ function renderCustomTag(
const { tag, attributes, content, inProgress } = tagInfo;
switch (tag) {
case "think":
return (
<DyadThink
node={{
properties: {
state: getState({ isStreaming, inProgress }),
},
}}
>
{content}
</DyadThink>
);
case "dyad-write":
return (
<DyadWrite