@customize-agent/knowledge 3.0.11 → 3.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,6 +2,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
3
|
import * as path from 'node:path';
|
|
4
4
|
import { tmpdir } from 'node:os';
|
|
5
|
+
import { pathToFileURL } from 'node:url';
|
|
5
6
|
import { ExternalExtractorRegistry } from './external-extractor.js';
|
|
6
7
|
import { resolveAndImport, resolvePackage, getNodeModulesRoot } from './module-resolver.js';
|
|
7
8
|
export class ContentExtractor {
|
|
@@ -338,7 +339,8 @@ export class ContentExtractor {
|
|
|
338
339
|
const mod = await resolveAndImport('dwgdxf');
|
|
339
340
|
if (!mod.convertDwgToDxf)
|
|
340
341
|
return { tool: 'dwgdxf_wasm', warnings: ['内置 dwgdxf WASM 转换器未导出 convertDwgToDxf'] };
|
|
341
|
-
const
|
|
342
|
+
const wasmBase = pathToFileURL(path.join(path.dirname(resolvePackage('dwgdxf')), 'wasm')).href;
|
|
343
|
+
const dxfBytes = await mod.convertDwgToDxf(fs.readFileSync(filePath), { wasmBase });
|
|
342
344
|
const dxfText = Buffer.from(dxfBytes).toString('utf8');
|
|
343
345
|
return dxfText.trim()
|
|
344
346
|
? { dxfText, tool: 'dwgdxf_wasm', warnings: [] }
|