mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-22 05:34:45 +08:00
Merge upstream/experimental into feat/citations
Resolved conflicts: - backend/src/gateway/routers/artifacts.py: Keep citations block removal for markdown downloads - frontend/src/components/workspace/messages/message-list-item.tsx: Keep improved citation handling with rehypePlugins, humanMessagePlugins, and CitationsLoadingIndicator Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -79,7 +79,12 @@ export const enUS: Translations = {
|
||||
proMode: "Pro",
|
||||
proModeDescription:
|
||||
"Reasoning, planning and executing, get more accurate results, may take more time",
|
||||
ultraMode: "Ultra",
|
||||
ultraModeDescription:
|
||||
"Pro mode with subagents enabled, maximum capability for complex multi-step tasks",
|
||||
searchModels: "Search models...",
|
||||
surpriseMe: "Surprise",
|
||||
surpriseMePrompt: "Surprise me",
|
||||
suggestions: [
|
||||
{
|
||||
suggestion: "Write",
|
||||
@@ -214,7 +219,7 @@ export const enUS: Translations = {
|
||||
tools: "Tools",
|
||||
skills: "Skills",
|
||||
notification: "Notification",
|
||||
acknowledge: "Acknowledge",
|
||||
about: "About",
|
||||
},
|
||||
memory: {
|
||||
title: "Memory",
|
||||
|
||||
@@ -62,7 +62,11 @@ export interface Translations {
|
||||
reasoningModeDescription: string;
|
||||
proMode: string;
|
||||
proModeDescription: string;
|
||||
ultraMode: string;
|
||||
ultraModeDescription: string;
|
||||
searchModels: string;
|
||||
surpriseMe: string;
|
||||
surpriseMePrompt: string;
|
||||
suggestions: {
|
||||
suggestion: string;
|
||||
prompt: string;
|
||||
@@ -161,7 +165,7 @@ export interface Translations {
|
||||
tools: string;
|
||||
skills: string;
|
||||
notification: string;
|
||||
acknowledge: string;
|
||||
about: string;
|
||||
};
|
||||
memory: {
|
||||
title: string;
|
||||
|
||||
@@ -77,7 +77,11 @@ export const zhCN: Translations = {
|
||||
reasoningModeDescription: "思考后再行动,在时间与准确性之间取得平衡",
|
||||
proMode: "专业",
|
||||
proModeDescription: "思考、计划再执行,获得更精准的结果,可能需要更多时间",
|
||||
ultraMode: "超级",
|
||||
ultraModeDescription: "专业模式加子代理,适用于复杂的多步骤任务,功能最强大",
|
||||
searchModels: "搜索模型...",
|
||||
surpriseMe: "小惊喜",
|
||||
surpriseMePrompt: "给我一个小惊喜吧",
|
||||
suggestions: [
|
||||
{
|
||||
suggestion: "写作",
|
||||
@@ -209,7 +213,7 @@ export const zhCN: Translations = {
|
||||
tools: "工具",
|
||||
skills: "技能",
|
||||
notification: "通知",
|
||||
acknowledge: "致谢",
|
||||
about: "关于",
|
||||
},
|
||||
memory: {
|
||||
title: "记忆",
|
||||
|
||||
@@ -21,9 +21,9 @@ export interface LocalSettings {
|
||||
};
|
||||
context: Omit<
|
||||
AgentThreadContext,
|
||||
"thread_id" | "is_plan_mode" | "thinking_enabled"
|
||||
"thread_id" | "is_plan_mode" | "thinking_enabled" | "subagent_enabled"
|
||||
> & {
|
||||
mode: "flash" | "thinking" | "pro" | undefined;
|
||||
mode: "flash" | "thinking" | "pro" | "ultra" | undefined;
|
||||
};
|
||||
layout: {
|
||||
sidebar_collapsed: boolean;
|
||||
|
||||
13
frontend/src/core/subagents/context.ts
Normal file
13
frontend/src/core/subagents/context.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { createContext, useContext } from "react";
|
||||
|
||||
import type { SubagentState } from "../threads/types";
|
||||
|
||||
export const SubagentContext = createContext<Map<string, SubagentState>>(new Map());
|
||||
|
||||
export function useSubagentContext() {
|
||||
const context = useContext(SubagentContext);
|
||||
if (context === undefined) {
|
||||
throw new Error("useSubagentContext must be used within a SubagentContext.Provider");
|
||||
}
|
||||
return context;
|
||||
}
|
||||
69
frontend/src/core/subagents/hooks.ts
Normal file
69
frontend/src/core/subagents/hooks.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
|
||||
import type { SubagentProgressEvent, SubagentState } from "../threads/types";
|
||||
|
||||
export function useSubagentStates() {
|
||||
const [subagents, setSubagents] = useState<Map<string, SubagentState>>(new Map());
|
||||
const subagentsRef = useRef<Map<string, SubagentState>>(new Map());
|
||||
|
||||
// 保持 ref 与 state 同步
|
||||
useEffect(() => {
|
||||
subagentsRef.current = subagents;
|
||||
}, [subagents]);
|
||||
|
||||
const handleSubagentProgress = useCallback((event: SubagentProgressEvent) => {
|
||||
console.log('[SubagentProgress] Received event:', event);
|
||||
|
||||
const { task_id, trace_id, subagent_type, event_type, result, error } = event;
|
||||
|
||||
setSubagents(prev => {
|
||||
const newSubagents = new Map(prev);
|
||||
const existingState = newSubagents.get(task_id) || {
|
||||
task_id,
|
||||
trace_id,
|
||||
subagent_type,
|
||||
status: "running" as const,
|
||||
};
|
||||
|
||||
let newState = { ...existingState };
|
||||
|
||||
switch (event_type) {
|
||||
case "started":
|
||||
newState = {
|
||||
...newState,
|
||||
status: "running",
|
||||
};
|
||||
break;
|
||||
|
||||
case "completed":
|
||||
newState = {
|
||||
...newState,
|
||||
status: "completed",
|
||||
result,
|
||||
};
|
||||
break;
|
||||
|
||||
case "failed":
|
||||
newState = {
|
||||
...newState,
|
||||
status: "failed",
|
||||
error,
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
||||
newSubagents.set(task_id, newState);
|
||||
return newSubagents;
|
||||
});
|
||||
}, []);
|
||||
|
||||
const clearSubagents = useCallback(() => {
|
||||
setSubagents(new Map());
|
||||
}, []);
|
||||
|
||||
return {
|
||||
subagents,
|
||||
handleSubagentProgress,
|
||||
clearSubagents,
|
||||
};
|
||||
}
|
||||
2
frontend/src/core/subagents/index.ts
Normal file
2
frontend/src/core/subagents/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export { useSubagentStates } from "./hooks";
|
||||
export { SubagentContext, useSubagentContext } from "./context";
|
||||
@@ -135,6 +135,7 @@ export function useSubmitThread({
|
||||
threadId: isNewThread ? threadId! : undefined,
|
||||
streamSubgraphs: true,
|
||||
streamResumable: true,
|
||||
streamMode: ["values", "messages-tuple", "custom"],
|
||||
config: {
|
||||
recursion_limit: 1000,
|
||||
},
|
||||
|
||||
@@ -17,4 +17,5 @@ export interface AgentThreadContext extends Record<string, unknown> {
|
||||
model_name: string | undefined;
|
||||
thinking_enabled: boolean;
|
||||
is_plan_mode: boolean;
|
||||
subagent_enabled: boolean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user