Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: let the Project sources panel be hidden in a project chat (#14125)

Daniel Han055f12163710
diff --git a/studio/frontend/src/features/rag/components/thread-documents-bar.tsx b/studio/frontend/src/features/rag/components/thread-documents-bar.tsx
index 072f0f699da..2a44482c6f7 100644
--- a/studio/frontend/src/features/rag/components/thread-documents-bar.tsx
+++ b/studio/frontend/src/features/rag/components/thread-documents-bar.tsx
@@ -1384,16 +1384,19 @@ export function ThreadDocumentsBar({
);
}
// project sources stay visible with Docs off because retrieval uses them; thread scope is inert.
+ // Hiding keeps retrieval; turning on Chat with files or opening another chat shows them again.
if (!ragEnabled) {
return (
<>
{kbDialog}
- {projectDocuments.length > 0 ? (
+ {projectDocuments.length > 0 && !ragPanelHidden ? (
<ChatFilesPanel
key="project"
icon={FolderAttachmentIcon}
title={ragToolDisabled ? "Project sources not used" : "Project sources"}
count={countSuffix}
+ onClose={() => setRagPanelHidden(true)}
+ closeLabel="Hide sources"
note={
<span
className="hidden truncate text-ui-12 text-muted-foreground @[32rem]/files-panel:inline"
diff --git a/studio/frontend/tests/rag-panel-hide.test.ts b/studio/frontend/tests/rag-panel-hide.test.ts
index 305bec0ca24..f35652fa980 100644
--- a/studio/frontend/tests/rag-panel-hide.test.ts
+++ b/studio/frontend/tests/rag-panel-hide.test.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
-// The Chat with files panel's X hides the panel; retrieval and the composer's RAG tag stay.
+// The files panels' X hides the panel; retrieval and the composer's RAG tag stay.
import assert from "node:assert/strict";
import test from "node:test";
@@ -14,10 +14,16 @@ const thread = readSrc("components/assistant-ui/thread.tsx");
test("the panel X hides the panel instead of turning RAG off", () => {
assert.doesNotMatch(bar, /onClose=\{\(\) => setRagEnabled\(false\)\}/);
- assert.equal(bar.match(/onClose=\{\(\) => setRagPanelHidden\(true\)\}/g)?.length, 2);
+ assert.equal(bar.match(/onClose=\{\(\) => setRagPanelHidden\(true\)\}/g)?.length, 3);
assert.match(bar, /if \(ragPanelHidden\) \{\n\s*return kbDialog;\n\s*\}/);
});
+test("a project chat with RAG off can hide its project sources panel (#13876)", () => {
+ const off = bar.slice(bar.indexOf("if (!ragEnabled) {"), bar.indexOf("const busy = projectUnresolved;"));
+ assert.match(off, /\{projectDocuments\.length > 0 && !ragPanelHidden \? \(/);
+ assert.match(off, /onClose=\{\(\) => setRagPanelHidden\(true\)\}\n\s*closeLabel="Hide sources"/);
+});
+
test("turning RAG on, picking a source or switching chats shows the panel again", () => {
assert.match(store, /ragEnabled,\n\s*ragPanelHidden: false,/);
assert.match(store, /ragSource,\n\s*ragPanelHidden: false,/);