feat(run): tool-aware model picker and run panel labels for codex lanes

Model dropdown now shows curated Claude vs Codex models per lane's tool,
and the run panel title/subtitle/binary-missing text switch between
"Chạy Claude"/"Chạy Codex" accordingly.
This commit is contained in:
2026-08-27 13:33:55 +07:00
parent ccf2fdb8eb
commit b1734a492f
8 changed files with 47 additions and 32 deletions
+15 -6
View File
@@ -42,7 +42,7 @@ import {
RotateCcw,
Lock,
} from "lucide-react";
import { api, RUN_MODEL_CHOICES, RUN_EFFORT_CHOICES } from "../../lib/api";
import { api, RUN_MODEL_CHOICES, RUN_MODEL_CHOICES_CODEX, RUN_EFFORT_CHOICES } from "../../lib/api";
import type {
CwdSuggestion,
DashboardRunHistoryItem,
@@ -233,7 +233,7 @@ export function RunSetup(props: RunSetupProps) {
)}
</Field>
<Field label={t("fields.model")}>
<ModelPicker value={props.model} onChange={props.onModelChange} />
<ModelPicker value={props.model} onChange={props.onModelChange} tool={props.tool} />
</Field>
{props.tool === "codex" ? (
<>
@@ -712,10 +712,19 @@ function SessionPicker({
// the "inherit from settings" choice, so use a non-empty marker.
const MODEL_CUSTOM = "__custom__";
function ModelPicker({ value, onChange }: { value: string; onChange: (s: string) => void }) {
function ModelPicker({
value,
onChange,
tool,
}: {
value: string;
onChange: (s: string) => void;
tool: LaneTool;
}) {
const { t } = useTranslation("run");
const choices = tool === "codex" ? RUN_MODEL_CHOICES_CODEX : RUN_MODEL_CHOICES;
// "Custom" is selected when the value isn't one of our curated IDs.
const knownIds = useMemo(() => RUN_MODEL_CHOICES.map((c) => c.id), []);
const knownIds = useMemo(() => choices.map((c) => c.id), [choices]);
const isCustom = value !== "" && !knownIds.includes(value);
const [showCustom, setShowCustom] = useState(isCustom);
@@ -724,14 +733,14 @@ function ModelPicker({ value, onChange }: { value: string; onChange: (s: string)
// a browser-native <select>.
const options = useMemo(
() => [
...RUN_MODEL_CHOICES.map((c) => ({
...choices.map((c) => ({
value: c.id === "" ? "" : c.id,
label: c.id === "" ? t("fields.modelInheritLabel") : c.label,
hint: c.hint,
})),
{ value: MODEL_CUSTOM, label: t("fields.modelCustom") },
],
[t]
[t, choices]
);
const onSelect = (v: string) => {