mirror of
https://github.com/EthanMarti/infio-copilot.git
synced 2026-05-08 08:00:10 +00:00
update web search results view && web search setting view
This commit is contained in:
@@ -578,7 +578,13 @@ const Chat = forwardRef<ChatRef, ChatProps>((props, ref) => {
|
||||
}
|
||||
}
|
||||
} else if (toolArgs.type === 'search_web') {
|
||||
const results = await webSearch(toolArgs.query, settings.serperApiKey, settings.jinaApiKey, (await getRAGEngine()))
|
||||
const results = await webSearch(
|
||||
toolArgs.query,
|
||||
settings.serperApiKey,
|
||||
settings.serperSearchEngine,
|
||||
settings.jinaApiKey,
|
||||
(await getRAGEngine())
|
||||
)
|
||||
const formattedContent = `[search_web for '${toolArgs.query}'] Result:\n${results}\n`;
|
||||
return {
|
||||
type: 'search_web',
|
||||
|
||||
@@ -23,9 +23,7 @@ export default function MarkdownReadFileBlock({
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
console.log('finish', finish, applyStatus)
|
||||
if (finish && applyStatus === ApplyStatus.Idle) {
|
||||
console.log('finish auto read file', path)
|
||||
onApply({
|
||||
type: 'read_file',
|
||||
filepath: path
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Search } from 'lucide-react'
|
||||
import React from 'react'
|
||||
|
||||
import { useSettings } from '../../contexts/SettingsContext'
|
||||
import { ApplyStatus, SearchWebToolArgs } from '../../types/apply'
|
||||
|
||||
export default function MarkdownWebSearchBlock({
|
||||
@@ -15,10 +16,20 @@ export default function MarkdownWebSearchBlock({
|
||||
finish: boolean
|
||||
}) {
|
||||
|
||||
const { settings } = useSettings()
|
||||
|
||||
const handleClick = () => {
|
||||
if (settings.serperSearchEngine === 'google') {
|
||||
window.open(`https://www.google.com/search?q=${query}`, '_blank')
|
||||
} else if (settings.serperSearchEngine === 'bing') {
|
||||
window.open(`https://www.bing.com/search?q=${query}`, '_blank')
|
||||
} else {
|
||||
window.open(`https://duckduckgo.com/?q=${query}`, '_blank')
|
||||
}
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
console.log('finish', finish, applyStatus)
|
||||
if (finish && applyStatus === ApplyStatus.Idle) {
|
||||
console.log('finish auto web search', query)
|
||||
onApply({
|
||||
type: 'search_web',
|
||||
query: query,
|
||||
@@ -28,7 +39,9 @@ export default function MarkdownWebSearchBlock({
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`infio-chat-code-block has-filename`}
|
||||
className={`infio-chat-code-block has-filename`
|
||||
}
|
||||
onClick={handleClick}
|
||||
>
|
||||
<div className={'infio-chat-code-block-header'}>
|
||||
<div className={'infio-chat-code-block-header-filename'}>
|
||||
|
||||
Reference in New Issue
Block a user