diff --git a/frontend-web/src/components/workspace/chats/chat-box.tsx b/frontend-web/src/components/workspace/chats/chat-box.tsx index 8de0d29a..5687a78f 100644 --- a/frontend-web/src/components/workspace/chats/chat-box.tsx +++ b/frontend-web/src/components/workspace/chats/chat-box.tsx @@ -86,7 +86,11 @@ const ChatBox: React.FC<{ threadId, disableArtifacts = false, }) => { - const { isMock, thread } = useThread(); + const { + isMock, + thread, + knowledgeReferencesEnabled = false, + } = useThread(); const pathname = usePathname(); const threadIdRef = useRef(threadId); const artifactsCountRef = useRef(0); @@ -107,7 +111,8 @@ const ChatBox: React.FC<{ citationDisplay?.reference_mode_enabled ?? false; const ragModeEnabled = (referenceModeEntryEnabled && settings.display.ragModeEnabled) || - isThreadRagModeLocked(threadId); + isThreadRagModeLocked(threadId) || + knowledgeReferencesEnabled; // Frontend RAG modes write their own hidden source tool messages. They use // the existing reference panel, but must not request or write reference // batches through DeerFlow's backend APIs. @@ -121,7 +126,7 @@ const ChatBox: React.FC<{ ); const referencesEnabled = ragModeEnabled || hasFrontendRag; const shouldFetchBackendReferenceBatches = - referencesEnabled && !hasFrontendRag; + referencesEnabled && !hasFrontendRag && !!threadId && threadId !== "new"; const { skills } = useSkills(); const canScanArtifactDirectory = diff --git a/frontend-web/src/components/workspace/messages/context.ts b/frontend-web/src/components/workspace/messages/context.ts index d22189c7..65f3a626 100644 --- a/frontend-web/src/components/workspace/messages/context.ts +++ b/frontend-web/src/components/workspace/messages/context.ts @@ -4,11 +4,17 @@ import { createContext, useContext } from "react"; import type { RuntimeDisplaySource } from "@/core/skill-display/runtime"; import type { AgentThreadState } from "@/core/threads"; -export interface ThreadContextType { - thread: BaseStream; - isMock?: boolean; - /** - * When set, the conversation is rendered from a public read-only share. +export interface ThreadContextType { + thread: BaseStream; + isMock?: boolean; + /** + * True when the active conversation has selected LLMWiki knowledge bases. + * Knowledge-base Q&A should always expose its source documents, independent + * from the admin-controlled manual reference-mode button. + */ + knowledgeReferencesEnabled?: boolean; + /** + * When set, the conversation is rendered from a public read-only share. * Artifact/image URLs then resolve to the unauthenticated * `/api/public/shares/{code}/files/...` endpoint instead of the * auth-gated thread artifact route. diff --git a/frontend-web/src/components/workspace/messages/message-list.tsx b/frontend-web/src/components/workspace/messages/message-list.tsx index 15d83aff..e5cae494 100644 --- a/frontend-web/src/components/workspace/messages/message-list.tsx +++ b/frontend-web/src/components/workspace/messages/message-list.tsx @@ -305,9 +305,12 @@ export function MessageList({ const { data: citationDisplay } = useCitationDisplaySettings(); const referenceModeEntryEnabled = citationDisplay?.reference_mode_enabled ?? false; + const knowledgeReferencesEnabled = + threadContext?.knowledgeReferencesEnabled === true; const ragModeEnabled = (referenceModeEntryEnabled && settings.display.ragModeEnabled) || - isThreadRagModeLocked(threadId); + isThreadRagModeLocked(threadId) || + knowledgeReferencesEnabled; const hasSingleRoundRag = useMemo( () => messages.some( diff --git a/frontend-web/src/pages/AgentChatPage.tsx b/frontend-web/src/pages/AgentChatPage.tsx index 20774b4f..80f9595b 100644 --- a/frontend-web/src/pages/AgentChatPage.tsx +++ b/frontend-web/src/pages/AgentChatPage.tsx @@ -779,7 +779,13 @@ export default function AgentChatPage({ : "ready"; return ( - + 0, + }} + > {/* Root: fixed-height horizontal split. ChatBox (chat + artifact preview) lives in the left flex cell; the agent detail panel is a separate flex sibling OUTSIDE ChatBox, so the artifact preview diff --git a/frontend-web/src/pages/ChatPage.tsx b/frontend-web/src/pages/ChatPage.tsx index c52559cf..2a7a93a7 100644 --- a/frontend-web/src/pages/ChatPage.tsx +++ b/frontend-web/src/pages/ChatPage.tsx @@ -688,7 +688,14 @@ export default function ChatPage() { !isWujieEnv(); return ( - + 0, + }} + >