import { Button } from "@douyinfe/semi-ui-19";
import type { Source } from "../backtests/types";
import type { UIAction } from "../ai/types";
import "./style.css";
export const sourceLabel = (kind: string) =>
({
superalpha: "Super Alpha 研究",
chatbox: "Chatbox 研究",
manual: "手工研究",
mcp: "MCP 研究",
ai: "AI 研究(历史)",
template: "模板研究",
variant: "Alpha 变体",
feature: "特征工程",
pipeline: "研究流水线",
quantflow: "QuantFlow",
})[kind] ?? kind;
export function SourceDetails({
source,
onAction,
}: {
source: Source;
onAction: (action: UIAction) => void;
}) {
return (
研究来源:{sourceLabel(source.kind)}
{source.hypothesis &&
{source.hypothesis}
}
{source.batch_id &&
业务批次:{source.batch_id}
}
{source.research_id &&
研究编号:{source.research_id}
}
{source.reference && source.kind !== "chatbox" && (
来源引用:{source.reference}
)}
{(source.superalpha_plan_id ||
((source.kind === "superalpha" ||
source.research_kind === "superalpha") &&
source.research_id)) && (
)}
{source.research_id &&
["template", "variant", "feature", "pipeline", "quantflow"].includes(
source.kind,
) && (
)}
{source.kind === "chatbox" && source.reference && (
)}
{[
...new Set([
...(source.input_snapshot_ids ?? []),
...(source.input_snapshot_id ? [source.input_snapshot_id] : []),
]),
].map((id, index) => (
))}
{source.parent_run_id && (
)}
);
}