This commit is contained in:
2026-04-29 20:56:59 +08:00
parent fb6f455530
commit 730f485f48
200 changed files with 9881 additions and 2221 deletions

View File

@@ -131,9 +131,9 @@ export function usePlatformCreationAgentFlowController<
const [streamingReplyText, setStreamingReplyText] = useState('');
const [isStreamingReply, setIsStreamingReply] = useState(false);
const openWorkspace = useCallback(async () => {
const openWorkspace = useCallback(async (createPayload?: TCreatePayload) => {
if (isBusy) {
return;
return null;
}
setIsBusy(true);
@@ -142,15 +142,20 @@ export function usePlatformCreationAgentFlowController<
setIsStreamingReply(false);
try {
const response = await options.client.createSession(options.createPayload);
setSession(options.client.selectSession(response));
const response = await options.client.createSession(
createPayload ?? options.createPayload,
);
const nextSession = options.client.selectSession(response);
setSession(nextSession);
options.enterCreateTab();
options.onSessionOpened?.();
options.setSelectionStage(options.workspaceStage);
return nextSession;
} catch (caughtError) {
setError(
options.resolveErrorMessage(caughtError, options.errorMessages.open),
);
return null;
} finally {
setIsBusy(false);
}
@@ -235,8 +240,9 @@ export function usePlatformCreationAgentFlowController<
);
const executeAction = useCallback(
async (payload: TActionPayload) => {
if (!session || isBusy) {
async (payload: TActionPayload, sessionOverride?: TSession | null) => {
const targetSession = sessionOverride ?? session;
if (!targetSession || isBusy) {
return;
}
@@ -244,15 +250,15 @@ export function usePlatformCreationAgentFlowController<
setError(null);
try {
options.beforeExecuteAction?.({ payload, session });
options.beforeExecuteAction?.({ payload, session: targetSession });
const response = await options.client.executeAction(
session.sessionId,
targetSession.sessionId,
payload,
);
await options.onActionComplete?.({
payload,
response,
session,
session: targetSession,
setSession,
});
if (options.isCompileAction(payload)) {