fix: 适配md图片的更多情况
This commit is contained in:
parent
13eb9cff9b
commit
1e981dc459
|
|
@ -593,21 +593,29 @@ function rewriteArtifactImagePaths(content: string, threadId?: string) {
|
|||
return content;
|
||||
}
|
||||
|
||||
const toArtifactUrl = (rawPath: string) => {
|
||||
const normalizedPath = rawPath.startsWith("/") ? rawPath : `/${rawPath}`;
|
||||
return resolveArtifactURL(normalizedPath, threadId);
|
||||
};
|
||||
|
||||
const markdownRewritten = content.replace(
|
||||
/!\[([^\]]*)\]\(\s*(\/?mnt\/user-data\/outputs\/[^)\s]+)\s*\)/g,
|
||||
(_full, alt, rawPath) => {
|
||||
const normalizedPath = rawPath.startsWith("/") ? rawPath : `/${rawPath}`;
|
||||
const artifactUrl = resolveArtifactURL(normalizedPath, threadId);
|
||||
return ``;
|
||||
return `})`;
|
||||
},
|
||||
);
|
||||
|
||||
return markdownRewritten.replace(
|
||||
const shorthandMarkdownRewritten = markdownRewritten.replace(
|
||||
/!(?!\[)([^\n()()]+?)\s*[((]\s*(\/?mnt\/user-data\/outputs\/[^)\s)]+)\s*[))]/g,
|
||||
(_full, alt, rawPath) => {
|
||||
return `})`;
|
||||
},
|
||||
);
|
||||
|
||||
return shorthandMarkdownRewritten.replace(
|
||||
/(<img\b[^>]*\bsrc\s*=\s*)(["'])(\/?mnt\/user-data\/outputs\/[^"']+)\2/gi,
|
||||
(_full, prefix, quote, rawPath) => {
|
||||
const normalizedPath = rawPath.startsWith("/") ? rawPath : `/${rawPath}`;
|
||||
const artifactUrl = resolveArtifactURL(normalizedPath, threadId);
|
||||
return `${prefix}${quote}${artifactUrl}${quote}`;
|
||||
return `${prefix}${quote}${toArtifactUrl(rawPath)}${quote}`;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export const zhCN: Translations = {
|
|||
// Welcome
|
||||
welcome: {
|
||||
// TODO: 测试环境标识
|
||||
greeting: "轻办公 · XClaw Tag:v3.1.0 build: 实现真正的执行一次脚本就部署的流程",
|
||||
greeting: "轻办公 · XClaw Tag:v3.1.0 fix:适配md图片的更多情况",
|
||||
description:
|
||||
"欢迎使用 🦌 DeerFlow,一个完全开源的超级智能体。通过内置和自定义的 Skills,\nDeerFlow 可以帮你搜索网络、分析数据,还能为你生成幻灯片、\n图片、视频、播客及网页等,几乎可以做任何事情。",
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue