feat: 移除诊断建议,并新增提示

This commit is contained in:
digua
2026-04-10 21:18:20 +08:00
parent b8a0e9e8da
commit 62b4816060
11 changed files with 22 additions and 286 deletions
+2 -1
View File
@@ -39,7 +39,8 @@
"no_file_selected": "No file selected",
"import_failed": "Import failed",
"unrecognized_format": "Unrecognized file format",
"no_messages": "No messages parsed. Please check if the file format is correct."
"no_messages": "No messages parsed. Please check if the file format is correct.",
"actionHint": "You can try manual format matching or view the log below:"
},
"diagnostics": {
"format": "Format: ",
+2 -1
View File
@@ -39,7 +39,8 @@
"no_file_selected": "ファイルが選択されていません",
"import_failed": "インポートに失敗しました",
"unrecognized_format": "認識できないファイル形式です",
"no_messages": "メッセージを検出できませんでした。ファイル形式が正しいか確認してください"
"no_messages": "メッセージを検出できませんでした。ファイル形式が正しいか確認してください",
"actionHint": "下記の手動マッチングまたはログの確認をお試しください:"
},
"diagnostics": {
"format": "検出フォーマット:",
+2 -1
View File
@@ -39,7 +39,8 @@
"no_file_selected": "未选择文件",
"import_failed": "导入失败",
"unrecognized_format": "无法识别的文件格式",
"no_messages": "未解析到任何消息,请检查文件格式是否正确"
"no_messages": "未解析到任何消息,请检查文件格式是否正确",
"actionHint": "你还可以尝试下方手动匹配或查看日志:"
},
"diagnostics": {
"format": "检测格式:",
+2 -1
View File
@@ -39,7 +39,8 @@
"no_file_selected": "未選擇檔案",
"import_failed": "匯入失敗",
"unrecognized_format": "無法識別的檔案格式",
"no_messages": "未解析到任何訊息,請檢查檔案格式是否正確"
"no_messages": "未解析到任何訊息,請檢查檔案格式是否正確",
"actionHint": "你還可以嘗試下方手動匹配或查看日誌:"
},
"diagnostics": {
"format": "偵測格式:",
+9 -24
View File
@@ -46,7 +46,6 @@ async function autoGenerateSessionIndex(sessionId: string) {
}
const importError = ref<string | null>(null)
const diagnosisSuggestion = ref<string | null>(null)
const hasImportLog = ref(false)
const importDiagnostics = ref<{
logFile: string | null
@@ -115,7 +114,6 @@ async function checkImportLog() {
// 处理文件选择(点击选择)- 支持多选
async function handleClickImport() {
importError.value = null
diagnosisSuggestion.value = null
hasImportLog.value = false
importDiagnostics.value = null
@@ -144,7 +142,6 @@ async function handleFileDrop({ paths }: { files: File[]; paths: string[] }) {
}
importError.value = null
diagnosisSuggestion.value = null
hasImportLog.value = false
importDiagnostics.value = null
@@ -172,9 +169,6 @@ async function processFilePaths(paths: string[]) {
if (result.error === 'error.unrecognized_format') {
formatSelectorFilePath.value = paths[0]
}
if (result.diagnosisSuggestion) {
diagnosisSuggestion.value = result.diagnosisSuggestion
}
// 保存诊断信息
if (result.diagnostics) {
importDiagnostics.value = {
@@ -209,7 +203,6 @@ async function handleFormatSelect(formatId: string) {
if (!filePath) return
importError.value = null
diagnosisSuggestion.value = null
importDiagnostics.value = null
isImporting.value = true
importProgress.value = { stage: 'detecting', progress: 0, message: '' }
@@ -785,27 +778,19 @@ const getMergeFileProgressText = (file: MergeFileInfo) =>
</div>
</div>
</div>
<!-- 诊断建议如果有 -->
<div
v-if="diagnosisSuggestion"
class="w-full rounded-md bg-amber-50 px-3 py-2 text-sm text-amber-800 dark:bg-amber-900/30 dark:text-amber-200"
<p
v-if="formatSelectorFilePath || hasImportLog"
class="text-xs text-gray-500 dark:text-gray-400"
>
<div class="flex items-start gap-2">
<UIcon name="i-heroicons-light-bulb" class="mt-0.5 h-4 w-4 shrink-0" />
<span>{{ diagnosisSuggestion }}</span>
</div>
</div>
{{ t('home.import.errors.actionHint') }}
</p>
<div class="flex gap-2">
<UButton v-if="hasImportLog" size="xs" @click="openLatestImportLog">{{ t('home.import.viewLog') }}</UButton>
<UButton
v-if="formatSelectorFilePath"
size="xs"
variant="soft"
icon="i-heroicons-list-bullet"
@click="showFormatSelector = true"
>
<UButton v-if="formatSelectorFilePath" size="xs" @click="showFormatSelector = true">
{{ t('home.formatSelector.manualSelect') }}
</UButton>
<UButton v-if="hasImportLog" size="xs" variant="soft" @click="openLatestImportLog">
{{ t('home.import.viewLog') }}
</UButton>
</div>
</div>
+1 -9
View File
@@ -29,7 +29,6 @@ export interface BatchFileInfo {
status: BatchFileStatus
progress?: ImportProgress
error?: string
diagnosisSuggestion?: string
sessionId?: string
}
@@ -171,7 +170,6 @@ export const useSessionStore = defineStore(
async function importFile(): Promise<{
success: boolean
error?: string
diagnosisSuggestion?: string
}> {
try {
const result = await window.chatApi.selectFile()
@@ -181,8 +179,7 @@ export const useSessionStore = defineStore(
}
// 有错误(如格式不识别)- 优先检查错误,因为此时可能没有 filePath
if (result.error) {
const diagnosisSuggestion = result.diagnosis?.suggestion
return { success: false, error: result.error, diagnosisSuggestion }
return { success: false, error: result.error }
}
// 没有文件路径(用户取消)
if (!result.filePath) {
@@ -215,7 +212,6 @@ export const useSessionStore = defineStore(
async function importFileFromPath(filePath: string): Promise<{
success: boolean
error?: string
diagnosisSuggestion?: string
diagnostics?: ImportDiagnosticsInfo
}> {
try {
@@ -296,12 +292,9 @@ export const useSessionStore = defineStore(
return { success: true, diagnostics: importResult.diagnostics }
} else {
// 传递诊断信息(如果有)
const diagnosisSuggestion = importResult.diagnosis?.suggestion
return {
success: false,
error: importResult.error || 'error.import_failed',
diagnosisSuggestion,
diagnostics: importResult.diagnostics,
}
}
@@ -460,7 +453,6 @@ export const useSessionStore = defineStore(
} else {
file.status = 'failed'
file.error = importResult.error || 'error.import_failed'
file.diagnosisSuggestion = importResult.diagnosis?.suggestion
failedCount++
}
} catch (error) {