2026-09-08 12:43:00 +08:00
|
|
|
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) =>
|
2026-09-08 21:29:21 +08:00
|
|
|
({
|
|
|
|
|
chatbox: "Chatbox 研究",
|
|
|
|
|
manual: "手工研究",
|
|
|
|
|
ai: "AI 研究(历史)",
|
|
|
|
|
template: "模板研究",
|
|
|
|
|
variant: "Alpha 变体",
|
|
|
|
|
feature: "特征工程",
|
|
|
|
|
pipeline: "研究流水线",
|
|
|
|
|
quantflow: "QuantFlow",
|
|
|
|
|
})[kind] ?? kind;
|
2026-09-08 12:43:00 +08:00
|
|
|
|
|
|
|
|
export function SourceDetails({
|
|
|
|
|
source,
|
|
|
|
|
onAction,
|
|
|
|
|
}: {
|
|
|
|
|
source: Source;
|
|
|
|
|
onAction: (action: UIAction) => void;
|
|
|
|
|
}) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="detail-section research-source">
|
|
|
|
|
<p>研究来源:{sourceLabel(source.kind)}</p>
|
|
|
|
|
{source.hypothesis && <p>{source.hypothesis}</p>}
|
|
|
|
|
{source.batch_id && <p>业务批次:{source.batch_id}</p>}
|
|
|
|
|
{source.research_id && <p>研究编号:{source.research_id}</p>}
|
|
|
|
|
{source.reference && source.kind !== "chatbox" && (
|
|
|
|
|
<p>来源引用:{source.reference}</p>
|
|
|
|
|
)}
|
|
|
|
|
<div className="inline-actions">
|
2026-09-08 21:29:21 +08:00
|
|
|
{source.research_id &&
|
|
|
|
|
["template", "variant", "feature", "pipeline", "quantflow"].includes(
|
|
|
|
|
source.kind,
|
|
|
|
|
) && (
|
|
|
|
|
<Button
|
|
|
|
|
onClick={() =>
|
|
|
|
|
onAction({
|
|
|
|
|
type: "open_experiment",
|
|
|
|
|
experiment_id: source.research_id!,
|
|
|
|
|
nonce: Date.now(),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
查看研究实验
|
|
|
|
|
</Button>
|
|
|
|
|
)}
|
2026-09-08 12:43:00 +08:00
|
|
|
{source.kind === "chatbox" && source.reference && (
|
|
|
|
|
<Button
|
|
|
|
|
onClick={() =>
|
|
|
|
|
onAction({
|
|
|
|
|
type: "open_conversation",
|
|
|
|
|
conversation_id: source.reference!,
|
|
|
|
|
nonce: Date.now(),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
打开研究会话
|
|
|
|
|
</Button>
|
|
|
|
|
)}
|
|
|
|
|
{source.template_input_id && (
|
|
|
|
|
<Button
|
|
|
|
|
onClick={() =>
|
|
|
|
|
onAction({
|
|
|
|
|
type: "open_research_input",
|
|
|
|
|
input_id: source.template_input_id!,
|
|
|
|
|
nonce: Date.now(),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
查看研究输入
|
|
|
|
|
</Button>
|
|
|
|
|
)}
|
|
|
|
|
{source.parent_run_id && (
|
|
|
|
|
<Button
|
|
|
|
|
onClick={() =>
|
|
|
|
|
onAction({
|
|
|
|
|
type: "open_backtest",
|
|
|
|
|
run_id: source.parent_run_id!,
|
|
|
|
|
nonce: Date.now(),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
查看原回测
|
|
|
|
|
</Button>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|