feat: add versioned research templates and alpha variants

This commit is contained in:
yuxuanhui
2026-09-08 21:29:21 +08:00
parent b604e6050e
commit f89ae211d2
55 changed files with 5650 additions and 435 deletions
+2
View File
@@ -1,5 +1,6 @@
import type { ComponentType } from "react";
import { Button, Tag } from "@douyinfe/semi-ui-19";
import { ResearchToolCard } from "../research/ResearchToolCard";
import { BacktestToolCard } from "../backtests/BacktestToolCard";
import { CatalogToolCard } from "../research/CatalogToolCard";
import { AlphaToolCard } from "./AlphaToolCard";
@@ -9,6 +10,7 @@ import type { ToolCardProps } from "./types";
// The server owns labels, effects and refresh targets. This is the only place
// where a new presentation shape joins the workspace; tool names are domain-local.
const renderers: Record<string, ComponentType<ToolCardProps>> = {
research: ResearchToolCard,
alpha: AlphaToolCard,
jobs: JobToolCard,
catalog: CatalogToolCard,
+13 -1
View File
@@ -11,7 +11,16 @@ export type ModelSettings = {
test_results: Record<string, { ok: boolean; message: string }>;
};
export type PageContext = {
page: "alphas" | "account" | "datasets" | "backtests";
page:
| "alphas"
| "account"
| "datasets"
| "backtests"
| "operators"
| "templates"
| "variants";
research_asset_id?: string;
research_experiment_id?: string;
catalog_scope?: {
instrument_type: string;
region: string;
@@ -34,6 +43,9 @@ export type AlphaUIAction =
| { type: "open_alpha"; alpha_id: string; nonce: number }
| { type: "apply_filters"; filters: Record<string, unknown>; nonce: number };
export type UIAction =
| { type: "open_template"; asset_id: string; version?: number; nonce: number }
| { type: "open_experiment"; experiment_id: string; nonce: number }
| { type: "open_variant"; alpha_id: string; nonce: number }
| { type: "open_conversation"; conversation_id: string; nonce: number }
| { type: "open_research_input"; input_id: string; nonce: number }
| { type: "open_backtest"; run_id: string; nonce: number }
+7
View File
@@ -4,6 +4,10 @@ export type WorkspacePage = PageContext["page"];
const contextLabels: Record<WorkspacePage, (context: PageContext) => string> = {
alphas: (context) =>
`上下文:${context.alpha_id ? `Alpha ${context.alpha_id}` : "Alpha 列表"}${context.selected_ids?.length ? ` · 已选 ${context.selected_ids.length} 条` : ""}`,
operators: () => "上下文:算子库",
templates: (context) =>
`上下文:模板工坊${context.research_asset_id ? ` · ${context.research_asset_id}` : ""}${context.research_experiment_id ? ` · 实验 ${context.research_experiment_id}` : ""}`,
variants: () => "上下文:Alpha 变体",
account: () => "上下文:个人信息页",
backtests: () => "上下文:回测研究",
datasets: (context) =>
@@ -27,6 +31,9 @@ type Destination = {
};
// Exhaustive action destinations prevent a new action silently falling into Alpha.
const destinations: Record<UIAction["type"], Destination> = {
open_template: { page: "templates", chat: "responsive" },
open_experiment: { page: "templates", chat: "responsive" },
open_variant: { page: "variants", chat: "responsive" },
open_conversation: { chat: "open" },
open_research_input: { page: "datasets", chat: "close" },
open_backtest: { page: "backtests", chat: "responsive" },