fix(web): 会话列表合同跟着外壳搬家,无活跃会话不再静默吞发送
四条源码合同改到 (app)/layout 与注册载荷两端对断。列表只剩校正会话时普通输入框锁定,发送会打开校正或给出提示。
This commit is contained in:
@@ -23,6 +23,24 @@ export function consultSendBlockedByRectificationSession(
|
||||
return isRectificationChatSession(session);
|
||||
}
|
||||
|
||||
/** Empty active session with only rectification rows still occupies the ordinary composer. */
|
||||
export function composerLocksAsRectification(
|
||||
activeSession: { sessionType?: string } | null | undefined,
|
||||
sessions: readonly { sessionType: string }[],
|
||||
): boolean {
|
||||
if (isRectificationChatSession(activeSession)) return true;
|
||||
if (activeSession) return false;
|
||||
return sessions.some((session) => session.sessionType === "birth_time_rectification");
|
||||
}
|
||||
|
||||
export function missingActiveSessionSendAction(
|
||||
sessions: readonly { id: string; sessionType: string }[],
|
||||
): { openSessionId: string } | { notice: string } {
|
||||
const rectification = sessions.find((session) => session.sessionType === "birth_time_rectification");
|
||||
if (rectification) return { openSessionId: rectification.id };
|
||||
return { notice: "请先选一条对话,或点上方「新建对话」。" };
|
||||
}
|
||||
|
||||
export function dropRectificationStoredPending<
|
||||
S extends { sessionId: string },
|
||||
T extends { id: string; sessionType: string },
|
||||
@@ -63,5 +81,6 @@ export function rectificationOrdinaryComposerReopen(input: {
|
||||
if (!input.activeRectificationSession || !input.error || input.error === "profile_incomplete") {
|
||||
return false;
|
||||
}
|
||||
if (!input.sessionId) return true;
|
||||
return !input.errorSessionId || input.errorSessionId === input.sessionId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user