mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-05-24 15:40:19 +08:00
fix: prevent SessionIndexModal from blocking empty sessions
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user