mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-04-25 11:18:22 +00:00
fix(frontend): resolve /mnt/ links in markdown to artifact API URLs (#2243)
* fix(gateway): forward agent_name and is_bootstrap from context to configurable The frontend sends agent_name and is_bootstrap via the context field in run requests, but services.py only forwards a hardcoded whitelist of keys (_CONTEXT_CONFIGURABLE_KEYS) into the agent's configurable dict. Since agent_name was missing, custom agents never received their name — make_lead_agent always fell back to the default lead agent, skipping SOUL.md, per-agent config and skill filtering. Similarly, is_bootstrap was dropped, so the bootstrap creation flow could never activate the setup_agent tool path. Add both keys to the whitelist so they reach make_lead_agent. Fixes #2222 * fix(frontend): resolve /mnt/ links in markdown to artifact API URLs AI agent messages contain links like /mnt/user-data/outputs/file.pdf which were rendered as-is in the browser, resulting in 404 errors. Images already got the correct treatment via MessageImage and resolveArtifactURL, but anchor tags (<a>) were passed through unchanged. Add an 'a' component override in MessageContent_ that rewrites /mnt/-prefixed hrefs to the artifact API endpoint, matching the existing image handling pattern. Fixes #2232 --------- Co-authored-by: JasonOA888 <JasonOA888@users.noreply.github.com> Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
This commit is contained in:
parent
692f79452d
commit
35fb3dd65a
@ -1,6 +1,6 @@
|
|||||||
import type { Message } from "@langchain/langgraph-sdk";
|
import type { Message } from "@langchain/langgraph-sdk";
|
||||||
import { FileIcon, Loader2Icon } from "lucide-react";
|
import { FileIcon, Loader2Icon } from "lucide-react";
|
||||||
import { memo, useMemo, type ImgHTMLAttributes } from "react";
|
import { memo, useMemo, type AnchorHTMLAttributes, type ImgHTMLAttributes } from "react";
|
||||||
import rehypeKatex from "rehype-katex";
|
import rehypeKatex from "rehype-katex";
|
||||||
|
|
||||||
import { Loader } from "@/components/ai-elements/loader";
|
import { Loader } from "@/components/ai-elements/loader";
|
||||||
@ -127,6 +127,13 @@ function MessageContent_({
|
|||||||
img: (props: ImgHTMLAttributes<HTMLImageElement>) => (
|
img: (props: ImgHTMLAttributes<HTMLImageElement>) => (
|
||||||
<MessageImage {...props} threadId={threadId} maxWidth="90%" />
|
<MessageImage {...props} threadId={threadId} maxWidth="90%" />
|
||||||
),
|
),
|
||||||
|
a: ({ href, ...props }: AnchorHTMLAttributes<HTMLAnchorElement>) => {
|
||||||
|
if (href && href.startsWith("/mnt/")) {
|
||||||
|
const url = resolveArtifactURL(href, threadId);
|
||||||
|
return <a {...props} href={url} target="_blank" rel="noopener noreferrer" />;
|
||||||
|
}
|
||||||
|
return <a {...props} href={href} />;
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
[threadId],
|
[threadId],
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user