mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-05-06 08:48:24 +00:00
- Backend: add citation format to lead_agent and general_purpose prompts - Add CitationLink component (Badge + HoverCard) for citation cards - MarkdownContent: detect citation: prefix in link text, render CitationLink - Message/artifact/subtask: use MarkdownContent or Streamdown with CitationLink - message-list-item: pass img via components prop (remove isHuman/img) - message-group, subtask-card: drop unused imports; fix import order (lint) Co-authored-by: Cursor <cursoragent@cursor.com>
63 lines
1.5 KiB
TypeScript
63 lines
1.5 KiB
TypeScript
"use client";
|
|
|
|
import { useI18n } from "@/core/i18n/hooks";
|
|
import type { Translations } from "@/core/i18n/locales/types";
|
|
|
|
import { Tooltip } from "./tooltip";
|
|
|
|
export type AgentMode = "flash" | "thinking" | "pro" | "ultra";
|
|
|
|
function getModeLabelKey(
|
|
mode: AgentMode,
|
|
): keyof Pick<
|
|
Translations["inputBox"],
|
|
"flashMode" | "reasoningMode" | "proMode" | "ultraMode"
|
|
> {
|
|
switch (mode) {
|
|
case "flash":
|
|
return "flashMode";
|
|
case "thinking":
|
|
return "reasoningMode";
|
|
case "pro":
|
|
return "proMode";
|
|
case "ultra":
|
|
return "ultraMode";
|
|
}
|
|
}
|
|
|
|
function getModeDescriptionKey(
|
|
mode: AgentMode,
|
|
): keyof Pick<
|
|
Translations["inputBox"],
|
|
"flashModeDescription" | "reasoningModeDescription" | "proModeDescription" | "ultraModeDescription"
|
|
> {
|
|
switch (mode) {
|
|
case "flash":
|
|
return "flashModeDescription";
|
|
case "thinking":
|
|
return "reasoningModeDescription";
|
|
case "pro":
|
|
return "proModeDescription";
|
|
case "ultra":
|
|
return "ultraModeDescription";
|
|
}
|
|
}
|
|
|
|
export function ModeHoverGuide({
|
|
mode,
|
|
children,
|
|
showTitle = true,
|
|
}: {
|
|
mode: AgentMode;
|
|
children: React.ReactNode;
|
|
/** When true, tooltip shows "ModeName: Description". When false, only description. */
|
|
showTitle?: boolean;
|
|
}) {
|
|
const { t } = useI18n();
|
|
const label = t.inputBox[getModeLabelKey(mode)];
|
|
const description = t.inputBox[getModeDescriptionKey(mode)];
|
|
const content = showTitle ? `${label}: ${description}` : description;
|
|
|
|
return <Tooltip content={content}>{children}</Tooltip>;
|
|
}
|