mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-10-25 17:54:34 +08:00
feat(ai): add confirmation dialog before regenerating all session indexes
Warn users that regeneration will clear all existing AI summaries. Uses the same UModal pattern as other confirmation dialogs in settings. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
fdb6d8f648
commit
969406915f
5 files changed
+53
-1
No files matched your search
@@ -40,6 +40,7 @@ const allSessionsStatus = ref<SessionIndexStatus[]>([])
|
||||
const isLoadingSessionStatus = ref(false)
|
||||
const isBatchGenerating = ref(false)
|
||||
const batchProgress = ref({ current: 0, total: 0, currentName: '' })
|
||||
const showRegenerateConfirm = ref(false)
|
||||
|
||||
// 计算统计信息
|
||||
const sessionIndexStats = computed(() => {
|
||||
@@ -147,6 +148,11 @@ async function batchGenerateIndex() {
|
||||
isBatchGenerating.value = false
|
||||
}
|
||||
|
||||
function confirmRegenerateAll() {
|
||||
showRegenerateConfirm.value = false
|
||||
batchRegenerateAll()
|
||||
}
|
||||
|
||||
// 批量重新生成所有会话的索引
|
||||
async function batchRegenerateAll() {
|
||||
if (allSessionsStatus.value.length === 0) return
|
||||
@@ -301,7 +307,7 @@ onMounted(() => {
|
||||
variant="soft"
|
||||
:loading="isBatchGenerating"
|
||||
:disabled="isLoadingSessionStatus || sessionIndexStats.total === 0"
|
||||
@click="batchRegenerateAll"
|
||||
@click="showRegenerateConfirm = true"
|
||||
>
|
||||
<UIcon v-if="!isBatchGenerating" name="i-heroicons-arrow-path" class="mr-1 h-3 w-3" />
|
||||
{{ t('settings.ai.session.batchRegenerate') }}
|
||||
@@ -321,5 +327,39 @@ onMounted(() => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 全部重新生成确认弹窗 -->
|
||||
<UModal v-model:open="showRegenerateConfirm" :ui="{ content: 'z-[101]', overlay: 'z-[100]' }">
|
||||
<template #content>
|
||||
<div class="p-5">
|
||||
<div class="mb-4 flex items-center gap-3">
|
||||
<div class="flex h-10 w-10 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30">
|
||||
<UIcon name="i-heroicons-exclamation-triangle" class="h-5 w-5 text-red-600 dark:text-red-400" />
|
||||
</div>
|
||||
<h3 class="text-lg font-semibold text-gray-900 dark:text-white">
|
||||
{{ t('settings.ai.session.batchRegenerateConfirmTitle') }}
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="space-y-3 text-sm text-gray-600 dark:text-gray-400">
|
||||
<p>{{ t('settings.ai.session.batchRegenerateConfirmMessage') }}</p>
|
||||
<div class="rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-800/50 dark:bg-red-900/20">
|
||||
<p class="text-xs text-red-700 dark:text-red-400">
|
||||
{{ t('settings.ai.session.batchRegenerateConfirmWarning') }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-5 flex justify-end gap-2">
|
||||
<UButton variant="ghost" @click="showRegenerateConfirm = false">
|
||||
{{ t('common.cancel') }}
|
||||
</UButton>
|
||||
<UButton color="error" @click="confirmRegenerateAll">
|
||||
{{ t('settings.ai.session.batchRegenerate') }}
|
||||
</UButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</UModal>
|
||||
</div>
|
||||
</template>
|
||||
@@ -277,6 +277,9 @@
|
||||
"loadingStatus": "Loading...",
|
||||
"batchGenerate": "Generate Missing",
|
||||
"batchRegenerate": "Regenerate All",
|
||||
"batchRegenerateConfirmTitle": "Confirm Regeneration",
|
||||
"batchRegenerateConfirmMessage": "This will clear all existing AI summaries and regenerate session indexes from scratch.",
|
||||
"batchRegenerateConfirmWarning": "Existing summaries will be overwritten. This action cannot be undone.",
|
||||
"summaryStrategy": "Summary Detail Level",
|
||||
"summaryStrategyHelp": "Controls how detailed AI-generated summaries will be",
|
||||
"summaryBrief": "Brief",
|
||||
|
||||
@@ -277,6 +277,9 @@
|
||||
"loadingStatus": "読み込み中...",
|
||||
"batchGenerate": "未生成分を作成",
|
||||
"batchRegenerate": "すべて再生成",
|
||||
"batchRegenerateConfirmTitle": "再生成の確認",
|
||||
"batchRegenerateConfirmMessage": "この操作により、既存のAI要約がすべてクリアされ、セッションインデックスが最初から再生成されます。",
|
||||
"batchRegenerateConfirmWarning": "既存の要約は上書きされます。この操作は取り消せません。",
|
||||
"summaryStrategy": "要約の詳細度",
|
||||
"summaryStrategyHelp": "AI が要約を生成する際の詳細さを設定します",
|
||||
"summaryBrief": "簡潔",
|
||||
|
||||
@@ -277,6 +277,9 @@
|
||||
"loadingStatus": "加载中...",
|
||||
"batchGenerate": "生成未索引",
|
||||
"batchRegenerate": "全部重新生成",
|
||||
"batchRegenerateConfirmTitle": "确认重新生成",
|
||||
"batchRegenerateConfirmMessage": "此操作将清空所有已生成的 AI 摘要,并重新生成全部会话索引。",
|
||||
"batchRegenerateConfirmWarning": "已有的摘要内容将被覆盖,此操作不可撤销。",
|
||||
"summaryStrategy": "摘要详细程度",
|
||||
"summaryStrategyHelp": "影响 AI 生成摘要时的详细程度",
|
||||
"summaryBrief": "简要",
|
||||
|
||||
@@ -277,6 +277,9 @@
|
||||
"loadingStatus": "載入中...",
|
||||
"batchGenerate": "產生未索引項目",
|
||||
"batchRegenerate": "全部重新產生",
|
||||
"batchRegenerateConfirmTitle": "確認重新產生",
|
||||
"batchRegenerateConfirmMessage": "此操作將清空所有已產生的 AI 摘要,並重新產生全部會話索引。",
|
||||
"batchRegenerateConfirmWarning": "已有的摘要內容將被覆蓋,此操作不可撤銷。",
|
||||
"summaryStrategy": "摘要詳細程度",
|
||||
"summaryStrategyHelp": "影響 AI 生成摘要時的詳細程度",
|
||||
"summaryBrief": "簡要",
|
||||
|
||||
Reference in new issue
Block a user