fix: abort creation chat sse on result page

This commit is contained in:
2026-04-24 20:33:01 +08:00
parent 3aabb59945
commit 88bd4f36e9
5 changed files with 82 additions and 1 deletions

View File

@@ -52,6 +52,7 @@ export interface StoryRequestOptions {
export interface TextStreamOptions {
onUpdate?: (text: string) => void;
signal?: AbortSignal;
}
export interface CustomWorldSceneImageRequest {

View File

@@ -66,6 +66,7 @@ export async function streamRpgCreationMessage(
`/api/runtime${RPG_AGENT_API_BASE}/${encodeURIComponent(sessionId)}/messages/stream`,
payload,
'发送共创消息失败',
options.signal,
);
return readCreationAgentSessionFromSse<RpgAgentSessionSnapshot>(response, {

View File

@@ -21,11 +21,13 @@ export async function openRpgCreationSsePost(
url: string,
payload: unknown,
fallbackMessage: string,
signal?: AbortSignal,
) {
const response = await fetchWithApiAuth(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
signal,
});
if (!response.ok) {