mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-22 21:54:45 +08:00
feat: add handling for task timeout and enhance Streamdown plugin for word animation
This commit is contained in:
@@ -124,6 +124,12 @@ export function MessageList({
|
|||||||
status: "failed",
|
status: "failed",
|
||||||
error: result.split("Task failed.")[1]?.trim(),
|
error: result.split("Task failed.")[1]?.trim(),
|
||||||
});
|
});
|
||||||
|
} else if (result.startsWith("Task timed out")) {
|
||||||
|
updateSubtask({
|
||||||
|
id: taskId,
|
||||||
|
status: "failed",
|
||||||
|
error: result,
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
updateSubtask({
|
updateSubtask({
|
||||||
id: taskId,
|
id: taskId,
|
||||||
|
|||||||
@@ -17,7 +17,10 @@ import { Shimmer } from "@/components/ai-elements/shimmer";
|
|||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { ShineBorder } from "@/components/ui/shine-border";
|
import { ShineBorder } from "@/components/ui/shine-border";
|
||||||
import { useI18n } from "@/core/i18n/hooks";
|
import { useI18n } from "@/core/i18n/hooks";
|
||||||
import { streamdownPlugins } from "@/core/streamdown";
|
import {
|
||||||
|
streamdownPlugins,
|
||||||
|
streamdownPluginsWithWordAnimation,
|
||||||
|
} from "@/core/streamdown";
|
||||||
import { useSubtask } from "@/core/tasks/context";
|
import { useSubtask } from "@/core/tasks/context";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
@@ -98,7 +101,9 @@ export function SubtaskCard({
|
|||||||
{task.prompt && (
|
{task.prompt && (
|
||||||
<ChainOfThoughtStep
|
<ChainOfThoughtStep
|
||||||
label={
|
label={
|
||||||
<Streamdown {...streamdownPlugins}>{task.prompt}</Streamdown>
|
<Streamdown {...streamdownPluginsWithWordAnimation}>
|
||||||
|
{task.prompt}
|
||||||
|
</Streamdown>
|
||||||
}
|
}
|
||||||
></ChainOfThoughtStep>
|
></ChainOfThoughtStep>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import remarkGfm from "remark-gfm";
|
|||||||
import remarkMath from "remark-math";
|
import remarkMath from "remark-math";
|
||||||
import type { StreamdownProps } from "streamdown";
|
import type { StreamdownProps } from "streamdown";
|
||||||
|
|
||||||
|
import { rehypeSplitWordsIntoSpans } from "../rehype";
|
||||||
|
|
||||||
export const streamdownPlugins = {
|
export const streamdownPlugins = {
|
||||||
remarkPlugins: [
|
remarkPlugins: [
|
||||||
remarkGfm,
|
remarkGfm,
|
||||||
@@ -13,6 +15,17 @@ export const streamdownPlugins = {
|
|||||||
] as StreamdownProps["rehypePlugins"],
|
] as StreamdownProps["rehypePlugins"],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const streamdownPluginsWithWordAnimation = {
|
||||||
|
remarkPlugins: [
|
||||||
|
remarkGfm,
|
||||||
|
[remarkMath, { singleDollarTextMath: true }],
|
||||||
|
] as StreamdownProps["remarkPlugins"],
|
||||||
|
rehypePlugins: [
|
||||||
|
[rehypeKatex, { output: "html" }],
|
||||||
|
rehypeSplitWordsIntoSpans,
|
||||||
|
] as StreamdownProps["rehypePlugins"],
|
||||||
|
};
|
||||||
|
|
||||||
// Plugins for human messages - no autolink to prevent URL bleeding into adjacent text
|
// Plugins for human messages - no autolink to prevent URL bleeding into adjacent text
|
||||||
export const humanMessagePlugins = {
|
export const humanMessagePlugins = {
|
||||||
remarkPlugins: [
|
remarkPlugins: [
|
||||||
|
|||||||
Reference in New Issue
Block a user