fix: prevent SessionIndexModal from blocking empty sessions

This commit is contained in:
digua
2026-05-22 22:06:08 +08:00
committed by digua
parent cb516daea0
commit 811bb3c09a
4 changed files with 19 additions and 6 deletions
+1
View File
@@ -37,3 +37,4 @@ yarn.lock
!.vscode/snippets.code-snippets
.docs
.playwright-mcp/
@@ -13,6 +13,8 @@ const props = defineProps<{
sessionId: string
/** 弹窗打开状态(v-model */
modelValue?: boolean
/** 会话消息总数,为 0 时不自动弹出 */
messageCount?: number
}>()
const emit = defineEmits<{
@@ -47,6 +49,8 @@ const canClose = computed(() => {
// 检查会话索引状态并自动弹出
async function checkAndAutoOpen() {
if (!props.sessionId) return
// 没有消息的会话无需索引,跳过自动弹出
if (props.messageCount === 0) return
isLoading.value = true
try {
@@ -93,14 +97,12 @@ async function generateSessionIndex() {
hasIndex.value = true
sessionCount.value = count
emit('generated', count)
// 生成完成后自动关闭
forceMode.value = false
isOpen.value = false
} catch (error) {
console.error('生成会话索引失败:', error)
} finally {
isGenerating.value = false
forceMode.value = false
isOpen.value = false
}
}
+6 -1
View File
@@ -255,7 +255,12 @@ const { headerDescription } = useSessionHeaderDescription({
</div>
<!-- 会话索引弹窗内部自动检测并弹出 -->
<SessionIndexModal v-if="currentSessionId" v-model="showSessionIndexModal" :session-id="currentSessionId" />
<SessionIndexModal
v-if="currentSessionId && session && session.messageCount > 0"
v-model="showSessionIndexModal"
:session-id="currentSessionId"
:message-count="session.messageCount"
/>
<!-- 增量导入弹窗 -->
<IncrementalImportModal
+6 -1
View File
@@ -266,7 +266,12 @@ const otherMemberAvatar = computed(() => {
</div>
<!-- 会话索引弹窗内部自动检测并弹出 -->
<SessionIndexModal v-if="currentSessionId" v-model="showSessionIndexModal" :session-id="currentSessionId" />
<SessionIndexModal
v-if="currentSessionId && session && session.messageCount > 0"
v-model="showSessionIndexModal"
:session-id="currentSessionId"
:message-count="session.messageCount"
/>
<!-- 增量导入弹窗 -->
<IncrementalImportModal