This commit is contained in:
2026-04-28 19:36:39 +08:00
parent a9febe7678
commit f0471a4f8d
206 changed files with 18456 additions and 10133 deletions

View File

@@ -115,18 +115,38 @@ export function readCustomWorldAgentUiState(
params.get(CUSTOM_WORLD_GENERATION_SOURCE_QUERY_KEY),
),
};
const storedValue = resolved.sessionStorage?.getItem(
CUSTOM_WORLD_AGENT_UI_STATE_STORAGE_KEY,
);
if (
stateFromQuery.activeSessionId ||
stateFromQuery.activeOperationId ||
stateFromQuery.customWorldGenerationSource
) {
return stateFromQuery;
let storedOwnerUserId: string | null = null;
if (storedValue) {
try {
const parsed = JSON.parse(storedValue) as CustomWorldAgentUiState;
const storedSessionId = normalizeValue(parsed.activeSessionId);
if (
storedSessionId &&
storedSessionId === stateFromQuery.activeSessionId
) {
storedOwnerUserId = normalizeValue(parsed.ownerUserId);
}
} catch {
resolved.sessionStorage?.removeItem(CUSTOM_WORLD_AGENT_UI_STATE_STORAGE_KEY);
}
}
return {
...stateFromQuery,
// URL 只承载可分享的 session 指针,用户归属仍仅来自本机 sessionStorage。
...(storedOwnerUserId ? { ownerUserId: storedOwnerUserId } : {}),
};
}
const storedValue = resolved.sessionStorage?.getItem(
CUSTOM_WORLD_AGENT_UI_STATE_STORAGE_KEY,
);
if (!storedValue) {
return {};
}