update files search methods && semantic search mehtod

This commit is contained in:
duanfuxiang
2025-03-31 17:33:53 +08:00
parent d72c871716
commit 1e85149660
15 changed files with 87 additions and 28 deletions

View File

@@ -27,7 +27,7 @@ import {
LLMBaseUrlNotSetException,
LLMModelNotSetException,
} from '../../core/llm/exception'
import { regexSearchFiles } from '../../core/services/ripgrep'
import { regexSearchFiles } from '../../core/ripgrep'
import { useChatHistory } from '../../hooks/use-chat-history'
import { ApplyStatus, ToolArgs } from '../../types/apply'
import { ChatMessage, ChatUserMessage } from '../../types/chat'
@@ -527,10 +527,9 @@ const Chat = forwardRef<ChatRef, ChatProps>((props, ref) => {
}
} else if (toolArgs.type === 'regex_search_files') {
const baseVaultPath = app.vault.adapter.getBasePath()
const ripgrepPath = settings.ripgrepPath
const absolutePath = path.join(baseVaultPath, toolArgs.filepath)
console.log("absolutePath", absolutePath)
const results = await regexSearchFiles(absolutePath, toolArgs.regex)
console.log("results", results)
const results = await regexSearchFiles(absolutePath, toolArgs.regex, ripgrepPath)
const formattedContent = `[regex_search_files for '${toolArgs.filepath}'] Result:\n${results}\n`;
return {
type: 'regex_search_files',