mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-29 08:44:48 +08:00
feat: add ToggleGroup
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
import type { UseStream } from "@langchain/langgraph-sdk/react";
|
||||
|
||||
import type { AgentThreadState } from "../threads";
|
||||
|
||||
import { urlOfArtifact } from "./utils";
|
||||
|
||||
export async function loadArtifactContent({
|
||||
@@ -12,3 +16,26 @@ export async function loadArtifactContent({
|
||||
const text = await response.text();
|
||||
return text;
|
||||
}
|
||||
|
||||
export function loadArtifactContentFromToolCall({
|
||||
url: urlString,
|
||||
thread,
|
||||
}: {
|
||||
url: string;
|
||||
thread: UseStream<AgentThreadState>;
|
||||
}) {
|
||||
const url = new URL(urlString);
|
||||
const toolCallId = url.searchParams.get("tool_call_id");
|
||||
const messageId = url.searchParams.get("message_id");
|
||||
if (messageId && toolCallId) {
|
||||
const message = thread.messages.find((message) => message.id === messageId);
|
||||
if (message?.type === "ai" && message.tool_calls) {
|
||||
const toolCall = message.tool_calls.find(
|
||||
(toolCall) => toolCall.id === toolCallId,
|
||||
);
|
||||
if (toolCall) {
|
||||
return toolCall.args.content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user