feat(web): 设置中心缓存管理与文件预览资产工具
- 新增 documentPreviewAssets 工具,统一从 URL/Blob/File 推断预览类型(image/pdf/file/unsupported) - SettingsView/SettingsView.js/settingsModelHelper 新增系统缓存管理区块,调用 /settings/cache/clear 并展示清理结果;useSettings/services 适配 - WorkbenchAiFilePreviewDialog/useWorkbenchAiFilePreview 接入预览资产工具,workbenchAiComposerModel 调整文件处理 - ReceiptFolder/LogDetailView/DigitalEmployeeWorkRecords/travelReimbursementAttachmentModel 配套适配 - 新增 settings-cache-management-section 测试,更新 settings-llm/rendering/receipt-folder-view/composer-components/attachment-association 测试
This commit is contained in:
@@ -3,6 +3,8 @@ import { readFileSync } from 'node:fs'
|
||||
import test from 'node:test'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
import { buildSelectedFileCards } from '../src/composables/workbenchAiMode/workbenchAiComposerModel.js'
|
||||
|
||||
function readSource(path) {
|
||||
return readFileSync(fileURLToPath(new URL(path, import.meta.url)), 'utf8')
|
||||
}
|
||||
@@ -49,6 +51,31 @@ test('shared workbench file strip preserves OCR status badges', () => {
|
||||
assert.match(fileStripComponent, /:title="file\.ocrState\.title \|\| file\.ocrState\.label"/)
|
||||
})
|
||||
|
||||
test('shared workbench file strip uses recognized image preview metadata over raw PDF type', () => {
|
||||
const [card] = buildSelectedFileCards([
|
||||
{
|
||||
name: '2月23 上海-武汉.pdf',
|
||||
type: 'application/pdf',
|
||||
size: 24940,
|
||||
lastModified: 1760000000000
|
||||
}
|
||||
], () => ({
|
||||
status: 'recognized',
|
||||
document: {
|
||||
preview_kind: 'image',
|
||||
receipt_preview_url: '/receipt-folder/receipt-train-1/preview'
|
||||
}
|
||||
}))
|
||||
|
||||
assert.equal(card.tone, 'image')
|
||||
assert.equal(card.icon, 'mdi mdi-file-image-outline')
|
||||
assert.deepEqual(card.previewAsset, {
|
||||
kind: 'image',
|
||||
url: '/receipt-folder/receipt-train-1/preview',
|
||||
source: 'receipt'
|
||||
})
|
||||
})
|
||||
|
||||
test('AI mode primes attachment OCR synchronously after file selection', () => {
|
||||
assert.match(
|
||||
filePreviewRuntime,
|
||||
|
||||
Reference in New Issue
Block a user