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',

View File

@@ -1,4 +1,4 @@
import { Check, Edit, Loader2, X, Diff } from 'lucide-react'
import { Check, Diff, Loader2, X } from 'lucide-react'
import { PropsWithChildren, useState } from 'react'
import { useDarkModeContext } from '../../contexts/DarkModeContext'

View File

@@ -137,7 +137,7 @@ const MarkdownWithIcons = ({
{markdownContent}
</ReactMarkdown>
</div>
{markdownContent && finish &&
{markdownContent && finish && iconName === "attempt_completion" &&
<div className="infio-chat-message-actions">
<CopyButton message={markdownContent} />
<CreateNewFileButton message={markdownContent} />