mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-23 06:04:46 +08:00
feat: auto open artifact
This commit is contained in:
@@ -181,7 +181,7 @@ function ToolCall({
|
||||
result?: string | Record<string, unknown>;
|
||||
}) {
|
||||
const { t } = useI18n();
|
||||
const { select, setOpen } = useArtifacts();
|
||||
const { setOpen, autoOpen, selectedArtifact, select } = useArtifacts();
|
||||
if (name === "web_search") {
|
||||
let label: React.ReactNode = t.toolCalls.searchForRelatedInfo;
|
||||
if (typeof args.query === "string") {
|
||||
@@ -265,6 +265,18 @@ function ToolCall({
|
||||
description = t.toolCalls.writeFile;
|
||||
}
|
||||
const path: string | undefined = (args as { path: string })?.path;
|
||||
if (autoOpen && path) {
|
||||
setTimeout(() => {
|
||||
const url = new URL(
|
||||
`write-file:${path}?message_id=${messageId}&tool_call_id=${id}`,
|
||||
).toString();
|
||||
if (selectedArtifact === url) {
|
||||
return;
|
||||
}
|
||||
select(url);
|
||||
setOpen(true);
|
||||
}, 100);
|
||||
}
|
||||
return (
|
||||
<ChainOfThoughtStep
|
||||
key={id}
|
||||
|
||||
Reference in New Issue
Block a user