Skip to content
5,392 changes: 2,735 additions & 2,657 deletions frontend/src/components/ChatBox.tsx

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions frontend/src/components/GroupFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
isMailAttachment,
SlackEntity,
SystemEntity,
WebSearchEntity,
} from "shared/types"
import { Filter, Groups } from "@/types"
import { getIcon } from "@/lib/common"
Expand Down Expand Up @@ -112,6 +113,8 @@ export const getName = (app: Apps, entity: Entity): string => {
return "Data-Source"
} else if (app === Apps.KnowledgeBase && entity === SystemEntity.SystemInfo) {
return "Knowledge-Base"
} else if (app === Apps.WebSearch && entity === WebSearchEntity.WebSearch) {
return "Web Search"
} else {
throw new Error(`Invalid app ${app} and entity ${entity}`)
}
Expand Down
12 changes: 7 additions & 5 deletions frontend/src/hooks/useChatStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,14 @@ const notifySubscribers = (streamId: string) => {
}
}


// Helper function to append reasoning data to stream state
const appendReasoningData = (streamState: StreamState, data: string) => {
try {
const stepData = JSON.parse(data)

// If this is a valid reasoning step, add it as a new line
if (stepData.step || stepData.text) {
streamState.thinking += data + '\n'
streamState.thinking += data + "\n"
} else {
// Fallback to simple text accumulation
streamState.thinking += data
Expand Down Expand Up @@ -221,7 +220,6 @@ export async function createAuthEventSource(url: string): Promise<EventSource> {

make()
})

}

// Start a new stream or continue existing one
Expand All @@ -237,6 +235,7 @@ export const startStream = async (
agentIdFromChatParams?: string | null,
toolsList?: ToolsListItem[],
metadata?: AttachmentMetadata[],
enableWebSearch: boolean = false,
): Promise<void> => {
if (!messageToSend) return

Expand Down Expand Up @@ -281,6 +280,8 @@ export const startStream = async (
url.searchParams.append("isReasoningEnabled", "true")
}

url.searchParams.append("enableWebSearch", enableWebSearch.toString())

// Add toolsList parameter if provided
if (toolsList && toolsList.length > 0) {
url.searchParams.append("toolsList", JSON.stringify(toolsList))
Expand Down Expand Up @@ -623,6 +624,7 @@ export const useChatStream = (
agentIdFromChatParams?: string | null,
toolsList?: ToolsListItem[],
metadata?: AttachmentMetadata[],
enableWebSearch: boolean = false,
) => {
const streamKey = currentStreamKey

Expand All @@ -638,6 +640,7 @@ export const useChatStream = (
agentIdFromChatParams,
toolsList,
metadata,
enableWebSearch,
)

setStreamInfo(getStreamState(streamKey))
Expand Down Expand Up @@ -866,7 +869,6 @@ export const useChatStream = (
})

eventSource.addEventListener(ChatSSEvents.Reasoning, (event) => {

appendReasoningData(streamState, event.data)
patchReasoningContent(event.data)
})
Expand Down
15 changes: 8 additions & 7 deletions frontend/src/lib/common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
PlugZap,
Github,
BookOpen,
Globe,
} from "lucide-react" // Added FileText, CalendarDays, PlugZap, Github, BookOpen
import DocsSvg from "@/assets/docs.svg" // Added this line
import SlidesSvg from "@/assets/slides.svg"
Expand All @@ -31,6 +32,7 @@ import {
ConnectorType,
SystemEntity,
DataSourceEntity,
WebSearchEntity,
} from "shared/types"
import { LoadingSpinner } from "@/routes/_authenticated/admin/integrations/google"

Expand Down Expand Up @@ -124,24 +126,23 @@ export const getIcon = (
return <CalendarDays size={12} className={classNameVal} />
} else if (app === Apps.DataSource && entity === "file") {
return <FileText size={size?.w || 12} className={classNameVal} />
} else if (app === Apps.KnowledgeBase &&
entity === SystemEntity.SystemInfo
) {
} else if (app === Apps.KnowledgeBase && entity === SystemEntity.SystemInfo) {
return (
<BookOpen
size={size?.w || 12}
<BookOpen
size={size?.w || 12}
className={`${classNameVal} dark:stroke-[#F1F3F4]`}
stroke="#384049"
/>
)
}
else if (
} else if (
(app === Apps.Github && entity === ConnectorType.MCP) ||
entity === SystemEntity.SystemInfo
) {
return <Github size={size?.w || 12} className={classNameVal} />
} else if (entity === SystemEntity.SystemInfo) {
return <PlugZap size={size?.w || 12} className={classNameVal} /> // Fallback for other MCPs
} else if (app === Apps.WebSearch && entity === WebSearchEntity.WebSearch) {
return <Globe size={size?.w || 12} className={classNameVal} />
} else if (
app === Apps.DataSource &&
entity === DataSourceEntity.DataSourceFile
Expand Down
Loading