Skip to content

Commit 10d53b8

Browse files
committed
fix: docx, embeded log
1 parent 4de5194 commit 10d53b8

File tree

6 files changed

+16
-9
lines changed

6 files changed

+16
-9
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
kg-data/
2+
13
# dependencies (bun install)
24
node_modules
35
.vscode

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ docker-compose up -d
6666
本项目采用 [GAPLv3](LICENSE) 许可证。如需许可证外其他用途,请联系 Wechat SOVLOOKUP。
6767

6868
<!-- 下一步-->
69+
<!-- TODO 插件管理 API -->
70+
<!-- TODO 插件变动重新触发扫描 -->
6971
<!-- TODO 添加全部 llmjs 支持的文件类型 -->
7072
<!-- TODO 制作宣传视频发 bilibili -->
7173

@@ -74,8 +76,6 @@ docker-compose up -d
7476
<!-- TODO 打点日志 -->
7577

7678
<!-- 功能 -->
77-
<!-- TODO 插件管理 API -->
78-
<!-- TODO 插件变动重新触发扫描 -->
7979
<!-- TODO 客户端版 -->
8080
<!-- TODO 文件加载器、分割器支持自定义向量 -->
8181
<!-- TODO 前端 i8n -->

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "docbase",
3-
"version": "0.1.4",
3+
"version": "0.1.5",
44
"type": "module",
55
"workspaces": [
66
"packages/*"

packages/core/src/DocBase.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export class DocBase {
6363
this.#watcherTaskCache.entries().map(async ([path, type]) => {
6464
if (type === "upsert") {
6565
await this.#docManager.upsertDoc(path);
66+
console.log(`[embeded] ${path}`);
6667
} else if (type === "remove") {
6768
await this.#docManager.deleteDocByPath(path);
6869
}

packages/core/src/DocLoader.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,16 @@ export const defaultDocLoaderPlugin: DocLoaderPlugin = {
5151
const ext = getExtFromPath(path);
5252

5353
if (ext === "docx" && !basename(path).startsWith("~$")) {
54-
return {
55-
// @ts-ignore
56-
content: (await mammoth.convertToMarkdown({ path })).value,
57-
};
54+
// @ts-ignore
55+
const content = (await mammoth.convertToMarkdown({ path })).value;
56+
57+
if (content) {
58+
return {
59+
content,
60+
};
61+
} else {
62+
return false;
63+
}
5864
}
5965

6066
if (ext === "md") {

packages/core/src/DocManager.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,6 @@ export class DocManager {
471471
localDoc,
472472
getDocSyncContent,
473473
});
474-
475-
console.log(`[embeded] ${path}`);
476474
}
477475
}
478476
};

0 commit comments

Comments
 (0)