fix(chat): recover session list from snapshots
This commit is contained in:
+8
-8
@@ -2187,14 +2187,6 @@ export function createTkmindProxy({
|
||||
}
|
||||
}
|
||||
|
||||
if (healthyTargets === 0) {
|
||||
res.status(502).json({ message: lastFailure ?? '后端连接失败,请稍后重试' });
|
||||
return;
|
||||
}
|
||||
if (healthyTargets < targets.length) {
|
||||
res.setHeader('X-TKMind-Degraded', '1');
|
||||
}
|
||||
|
||||
const directSessionIds = [...owned].filter(isDirectChatSessionId);
|
||||
const ownedMissingFromGoose = [...owned].filter((sessionId) => !sessionsById.has(sessionId));
|
||||
const snapshotFallbackIds = [...new Set([...directSessionIds, ...ownedMissingFromGoose])];
|
||||
@@ -2231,6 +2223,14 @@ export function createTkmindProxy({
|
||||
}
|
||||
}
|
||||
|
||||
if (healthyTargets === 0 && owned.size > 0 && sessionsById.size === 0) {
|
||||
res.status(502).json({ message: lastFailure ?? '后端连接失败,请稍后重试' });
|
||||
return;
|
||||
}
|
||||
if (healthyTargets < targets.length || healthyTargets === 0) {
|
||||
res.setHeader('X-TKMind-Degraded', '1');
|
||||
}
|
||||
|
||||
const sessions = [...sessionsById.values()].sort(sortSessionsByRecent);
|
||||
await enrichSessionHistory(sessions, req.currentUser.id);
|
||||
if (typeof userAuth.getSessionOrigins === 'function' && sessions.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user