mirror of
https://github.com/johndoe6345789/AutoMetabuilder.git
synced 2026-04-24 13:54:59 +00:00
- Implement core components: CLI argument parsing, environment loading, GitHub service creation, and logging configuration. - Add support for OpenAI client setup and model resolution. - Develop SDLC context loader from GitHub and repository files. - Implement workflow context and engine builders. - Introduce major workflow packages: `game_tick_loop` and `contextual_iterative_loop`. - Update localization files with new package descriptions and labels. - Streamline web navigation by loading items from a dedicated JSON file.
55 lines
1.5 KiB
TypeScript
55 lines
1.5 KiB
TypeScript
import { useCallback, useState } from "react";
|
|
|
|
export type DashboardRunPayload = {
|
|
mode?: string;
|
|
iterations?: number;
|
|
yolo?: boolean;
|
|
stop_at_mvp?: boolean;
|
|
};
|
|
|
|
type UseDashboardControlsArgs = {
|
|
onRun: (payload: DashboardRunPayload) => Promise<void>;
|
|
t: (key: string, fallback?: string) => string;
|
|
};
|
|
|
|
type UseDashboardControlsResult = {
|
|
mode: string;
|
|
setMode: (next: string) => void;
|
|
iterations: number;
|
|
setIterations: (next: number) => void;
|
|
stopAtMvp: boolean;
|
|
setStopAtMvp: (next: boolean) => void;
|
|
feedback: string;
|
|
handleRun: () => Promise<void>;
|
|
};
|
|
|
|
export default function useDashboardControls({ onRun, t }: UseDashboardControlsArgs): UseDashboardControlsResult {
|
|
const [mode, setMode] = useState("once");
|
|
const [iterations, setIterations] = useState(1);
|
|
const [stopAtMvp, setStopAtMvp] = useState(false);
|
|
const [feedback, setFeedback] = useState("");
|
|
|
|
const handleRun = useCallback(async () => {
|
|
const isYolo = mode === "yolo";
|
|
setFeedback(`${t("ui.dashboard.status.bot_label", "Bot Status")} — submitting`);
|
|
try {
|
|
await onRun({ mode, iterations, yolo: isYolo, stop_at_mvp: stopAtMvp });
|
|
setFeedback(`${t("ui.dashboard.start_bot", "Start Bot")} ${t("ui.dashboard.status.running", "Running")}`);
|
|
} catch (error) {
|
|
console.error(error);
|
|
setFeedback(t("ui.dashboard.status.idle", "Idle"));
|
|
}
|
|
}, [iterations, mode, onRun, stopAtMvp, t]);
|
|
|
|
return {
|
|
mode,
|
|
setMode,
|
|
iterations,
|
|
setIterations,
|
|
stopAtMvp,
|
|
setStopAtMvp,
|
|
feedback,
|
|
handleRun,
|
|
};
|
|
}
|