refactor: unify data preparations and research input snapshots
Deploy production / deploy (push) Successful in 53s
Deploy production / deploy (push) Successful in 53s
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
import {
|
||||
ResearchDataInput,
|
||||
researchSelection,
|
||||
} from "../preparations/ResearchDataInput";
|
||||
import { ResearchList, ResearchDetail } from "./ResearchList";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import {
|
||||
@@ -66,9 +70,7 @@ export function FeaturesPage({
|
||||
`/research/assets?kind=feature&q=${encodeURIComponent(q)}&offset=${(page - 1) * 25}`,
|
||||
{ signal: controller.signal },
|
||||
),
|
||||
api<{ items: InputSnapshot[] }>("/research/inputs", {
|
||||
signal: controller.signal,
|
||||
}),
|
||||
Promise.resolve({ items: inputs }),
|
||||
])
|
||||
.then(([list, fixed]) => {
|
||||
setItems(list.items);
|
||||
@@ -128,7 +130,7 @@ export function FeaturesPage({
|
||||
body: JSON.stringify({
|
||||
kind: "feature",
|
||||
version: asset?.version,
|
||||
content: draft,
|
||||
content: { ...draft, ...researchSelection(draft.input_ids, inputs) },
|
||||
}),
|
||||
},
|
||||
);
|
||||
@@ -317,7 +319,7 @@ export function FeaturesPage({
|
||||
.filter((i) => draft.input_ids.includes(i.id))
|
||||
.map((i) => ({
|
||||
id: i.id,
|
||||
name: `${i.dataset_id} · ${i.scope.region}/${i.scope.universe}/D${i.scope.delay} · ${i.field_ids.length} 字段 · ${i.id}`,
|
||||
name: `${i.name} · ${i.scope.region}/${i.scope.universe}/D${i.scope.delay} · ${i.field_ids.length} 字段 · ${i.id}`,
|
||||
}))}
|
||||
disabled={!!busy}
|
||||
busy={busy === "generate"}
|
||||
@@ -330,7 +332,7 @@ export function FeaturesPage({
|
||||
await post<FeatureAsset>("/research/generate", {
|
||||
name: draft.name,
|
||||
hypothesis: draft.hypothesis,
|
||||
input_ids: draft.input_ids,
|
||||
...researchSelection(draft.input_ids, inputs),
|
||||
method: "feature",
|
||||
}),
|
||||
);
|
||||
@@ -347,23 +349,21 @@ export function FeaturesPage({
|
||||
</section>
|
||||
<label>
|
||||
固定输入
|
||||
<ResearchSelect
|
||||
label="特征固定输入"
|
||||
multiple
|
||||
filter
|
||||
value={draft.input_ids}
|
||||
optionList={inputs.map((i) => ({
|
||||
value: i.id,
|
||||
label: `${i.dataset_id} · ${i.scope.region}/${i.scope.universe}/D${i.scope.delay} · ${i.field_ids.length} 字段 · ${i.id.slice(0, 8)}`,
|
||||
}))}
|
||||
onChange={(v) => setDraft({ ...draft, input_ids: v as string[] })}
|
||||
<ResearchDataInput
|
||||
label="选择特征数据准备"
|
||||
ids={draft.input_ids}
|
||||
inputs={inputs}
|
||||
onChange={(ids, rows) => {
|
||||
setInputs(rows);
|
||||
setDraft({ ...draft, input_ids: ids });
|
||||
}}
|
||||
/>
|
||||
</label>
|
||||
{inputs
|
||||
.filter((i) => draft.input_ids.includes(i.id))
|
||||
.map((i) => (
|
||||
<details key={i.id}>
|
||||
<summary>{i.dataset_id} 的固定字段</summary>
|
||||
<summary>{i.name} 的固定字段</summary>
|
||||
<p className="muted">{i.field_ids.join("、")}</p>
|
||||
</details>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user