B6/B7: failed终态前端可见 + SSE事件链核实
B6 错误态: - 后端已加 TaskStatus.FAILED + 异常区分重试中/耗尽(014迁移ALTER status ENUM) - 前端 TaskStatus 类型加 failed - RecentTasksBar/history STATUS_LABEL 补 failed 标签 - history 页 HISTORY_STATUSES 纳入 failed(否则失败任务前端找不到) - FatalErrorBanner + useSse error 不再静默丢弃 B7: 核实 SSE(ticket换JWT) + 事件消费链无缺口,标绿 tsc EXIT=0
This commit is contained in:
@@ -28,6 +28,9 @@ interface GenerationState {
|
||||
imageCandidates: ImageCandidate[];
|
||||
failedBatches: FailedBatch[];
|
||||
|
||||
// 任务级致命错误(SSE error事件,生成彻底失败)。区别于图片批次级 failedBatches。
|
||||
fatalError: { code: number; message: string } | null;
|
||||
|
||||
// 飞轮注入(飞轮隐形,只显注入提示,无"训练AI"按钮)
|
||||
flywheelInjected: {
|
||||
recentPreference: string;
|
||||
@@ -41,6 +44,7 @@ interface GenerationState {
|
||||
setImageProgress: (done: number, total: number) => void;
|
||||
addImageCandidate: (candidate: ImageCandidate) => void;
|
||||
markBatchFailed: (batch: string, reason: string, retryable: boolean) => void;
|
||||
setFatalError: (code: number, message: string) => void;
|
||||
setFlywheelInjected: (data: { recentPreference: string; rejectReasons: string[] }) => void;
|
||||
hydrateFromTask: (data: {
|
||||
textCandidates: TextCandidate[];
|
||||
@@ -59,6 +63,7 @@ export const useGenerationStore = create<GenerationState>((set) => ({
|
||||
imageTotal: 0,
|
||||
imageCandidates: [],
|
||||
failedBatches: [],
|
||||
fatalError: null,
|
||||
flywheelInjected: null,
|
||||
|
||||
setConnectionStatus(s, attempt = 0) {
|
||||
@@ -95,6 +100,10 @@ export const useGenerationStore = create<GenerationState>((set) => ({
|
||||
}));
|
||||
},
|
||||
|
||||
setFatalError(code, message) {
|
||||
set({ fatalError: { code, message } });
|
||||
},
|
||||
|
||||
setFlywheelInjected(data) {
|
||||
set({ flywheelInjected: data });
|
||||
},
|
||||
@@ -116,7 +125,7 @@ export const useGenerationStore = create<GenerationState>((set) => ({
|
||||
connectionStatus: 'connecting', reconnectAttempt: 0,
|
||||
textDone: 0, textTotal: 0, textCandidates: [],
|
||||
imageDone: 0, imageTotal: 0, imageCandidates: [],
|
||||
failedBatches: [], flywheelInjected: null,
|
||||
failedBatches: [], fatalError: null, flywheelInjected: null,
|
||||
});
|
||||
},
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user