File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 9
9
10
10
// 重新导出initVectorDb,使其可在其他模块中导入
11
11
export { initVectorDb } ;
12
- import { getWorkspacePath } from "./workspace" ;
12
+ import { getFilePathOptions , getWorkspacePath } from "./workspace" ;
13
13
import { DirTree } from "@/stores/article" ;
14
14
import { toast } from "@/hooks/use-toast" ;
15
15
import { join } from "@tauri-apps/api/path" ;
@@ -110,10 +110,14 @@ export async function processMarkdownFile(
110
110
fileContent ?: string
111
111
) : Promise < boolean > {
112
112
try {
113
- // 如果未提供文件内容,则读取文件
114
- const content = fileContent || await readTextFile ( filePath ) ;
115
-
116
- // 分块处理文本
113
+ const workspace = await getWorkspacePath ( )
114
+ let content = ''
115
+ if ( workspace . isCustom ) {
116
+ content = fileContent || await readTextFile ( filePath )
117
+ } else {
118
+ const { path, baseDir } = await getFilePathOptions ( filePath )
119
+ content = fileContent || await readTextFile ( path , { baseDir } )
120
+ }
117
121
const chunks = chunkText ( content ) ;
118
122
119
123
// 文件名(不含路径)
You can’t perform that action at this time.
0 commit comments