From cf7dec1f13810bb4b655dc4c9fd7b40ecace8e2e Mon Sep 17 00:00:00 2001 From: Roland Tannous Date: Thu, 28 May 2026 16:02:50 +0400 Subject: [PATCH] Studio: grey out RAG pill when the model can't call tools MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RAG retrieval runs entirely through the local search_knowledge_base tool. If the loaded model doesn't support tool calling (e.g. a safetensors model whose template advertises tools in an unparsable emission format, so supports_tools is suppressed), enabling RAG does nothing — the model never calls the tool. The pill stayed lit and clickable, which was misleading. Gate the RAG pill on supportsTools (in addition to modelLoaded), the same condition web/code use when there's no provider builtin. Applied to both composer surfaces (shared-composer and the in-thread RagToggle), with a 'RAG needs a model that supports tool calling' tooltip on the disabled state. --- .../src/components/assistant-ui/thread.tsx | 13 +++++++++---- .../src/features/chat/shared-composer.tsx | 17 ++++++++++++----- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsx index d3cbb2d0a8..d4f0a0b66d 100644 --- a/studio/frontend/src/components/assistant-ui/thread.tsx +++ b/studio/frontend/src/components/assistant-ui/thread.tsx @@ -1149,7 +1149,10 @@ const RagToggle: FC = () => { const setRagToolEnabled = useChatRuntimeStore((s) => s.setRagToolEnabled); const ragSource = useChatRuntimeStore((s) => s.ragSource); const setRagSource = useChatRuntimeStore((s) => s.setRagSource); - const disabled = !modelLoaded; + const supportsTools = useChatRuntimeStore((s) => s.supportsTools); + // RAG runs through the local search_knowledge_base tool, so it needs + // tool-calling support (mirrors shared-composer's ragDisabled). + const disabled = !modelLoaded || !supportsTools; return (