fix(翻译进知识库):修复1.对话上传的文件需要同步到对应知识库!但现在知识库里没有看到
deploy-hxtesting / build-and-deploy (push) Successful in 1m20s

2.如图三所示点击相对于文件详情中图片都没有了
This commit is contained in:
runny committed 2026-12-01 10:15:49 +08:00
1 parent a6632e7b55
commit b762deaf15
3 files changed
+25 -3

No files matched your search

+5 -1
View File
@@ -410,7 +410,11 @@ async function renderExcel(blob: Blob, fileType?: string) {
await nextTick();
const container = previewContent.value as HTMLElement | null;
if (container && drawings.length > 0) {
mountExcelPreviewImages(container, drawings);
// Async: the mount retries while the panel fades in and logs the count,
// so a silent no-image state is diagnosable from the console.
mountExcelPreviewImages(container, drawings).then(mounted => {
console.info(`[DocumentPreview] embedded images mounted: ${mounted}/${drawings.length}`);
});
}
}
+13 -1
View File
@@ -163,7 +163,17 @@ export async function extractExcelImages(buf: ArrayBuffer): Promise<ExcelDrawing
* images follow the actual row/column sizes. Anchors beyond the rendered
* extent clamp to the table edge.
*/
export function mountExcelPreviewImages(container: HTMLElement, images: ExcelDrawingImage[]): void {
export async function mountExcelPreviewImages(container: HTMLElement, images: ExcelDrawingImage[]): Promise<number> {
// The preview panel may still be fading in when renderExcel finishes: a
// hidden table reports zero-size rects, which would collapse every image
// to 2x2 px. Wait (bounded) until the grid has real geometry.
for (let attempt = 0; attempt < 20; attempt++) {
const probe = container.querySelector('#sheet-0') as HTMLTableElement | null;
if (!probe || probe.getBoundingClientRect().width > 0) break;
await new Promise(resolve => setTimeout(resolve, 100));
}
let mounted = 0;
for (const img of images) {
const table = container.querySelector(`#sheet-${img.sheetIndex}`) as HTMLTableElement | null;
if (!table) continue;
@@ -207,5 +217,7 @@ export function mountExcelPreviewImages(container: HTMLElement, images: ExcelDra
el.style.objectFit = 'fill';
el.style.zIndex = '5';
parent.appendChild(el);
mounted++;
}
return mounted;
}