feat: add millon js, add models picker dialog, update builder

This commit is contained in:
BennyKok
2024-01-07 17:22:28 +08:00
parent 3c4bce630e
commit 01a9c1a1d6
33 changed files with 1693 additions and 190 deletions
+4 -1
View File
@@ -14,12 +14,13 @@ export function MachineBuildLog({
endpoint: string;
}) {
const [logs, setLogs] = useState<LogsType>([]);
const [finished, setFinished] = useState(false);
const wsEndpoint = endpoint.replace(/^http/, "ws");
const { lastMessage, readyState } = useWebSocket(
`${wsEndpoint}/ws/${machine_id}`,
{
shouldReconnect: () => true,
shouldReconnect: () => !finished,
reconnectAttempts: 20,
reconnectInterval: 1000,
}
@@ -36,6 +37,8 @@ export function MachineBuildLog({
if (message?.event === "LOGS") {
setLogs((logs) => [...(logs ?? []), message.data]);
} else if (message?.event === "FINISHED") {
setFinished(true);
}
}, [lastMessage]);