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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: say when a file added while creating a project fails to index (#17313)
Nilayc3af42a66b41
diff --git a/studio/frontend/src/features/rag/api/save-markdown-source.ts b/studio/frontend/src/features/rag/api/save-markdown-source.tsindex 66d946152d7..5457e5c646b 100644--- a/studio/frontend/src/features/rag/api/save-markdown-source.ts+++ b/studio/frontend/src/features/rag/api/save-markdown-source.ts@@ -61,7 +61,7 @@ export function projectSourceFileName(title: string): string {const INGEST_POLL_MS = 2_000;const INGEST_POLL_ATTEMPTS = 150;-async function watchIngestion(+export async function watchIngestion(projectId: string,jobId: string,filename: string,diff --git a/studio/frontend/src/features/rag/components/project-source-dropzone.tsx b/studio/frontend/src/features/rag/components/project-source-dropzone.tsxindex b2809fe4b6a..995236c3957 100644--- a/studio/frontend/src/features/rag/components/project-source-dropzone.tsx+++ b/studio/frontend/src/features/rag/components/project-source-dropzone.tsx@@ -18,6 +18,7 @@ import {noteProjectWork,uploadProjectDocument,} from "../api/rag-api";+import { watchIngestion } from "../api/save-markdown-source";import {RAG_SOURCE_UPLOAD_ACCEPT,SUPPORTED_SOURCES_HINT,@@ -125,7 +126,10 @@ async function uploadStaged(const result = await uploadProjectDocument(projectId, source, ocr, caption);// The backend hashes content, so this is a document already uploaded under another name.if (documentIds.has(result.documentId)) merged.push(entry.name);- else documentIds.add(result.documentId);+ else {+ documentIds.add(result.documentId);+ void watchIngestion(projectId, result.jobId, result.filename || entry.name);+ }} catch (error) {toast.error(`Couldn't upload ${entry.name}`, {description: error instanceof Error ? error.message : String(error),diff --git a/studio/frontend/tests/project-create-source-indexing.test.ts b/studio/frontend/tests/project-create-source-indexing.test.tsnew file mode 100644index 00000000000..e593cde303c--- /dev/null+++ b/studio/frontend/tests/project-create-source-indexing.test.ts@@ -0,0 +1,59 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import assert from "node:assert/strict";+import test from "node:test";+import type * as Dropzone from "../src/features/rag/components/project-source-dropzone.tsx";+import { loadWithStubs, stubJsxRuntime } from "./helpers/module-stubs.ts";+import { recordedToasts, toast } from "./helpers/store-stubs/toast.ts";++const announced: string[] = [];+const ragApi = {+ announceProjectSourcesUpdated: (projectId: string) => announced.push(projectId),+ invalidateProjectSources: () => undefined,+ noteProjectWork: () => undefined,+ uploadProjectDocument: async (_projectId: string, file: File) => ({+ documentId: `doc-${file.name}`,+ jobId: `job-${file.name}`,+ filename: file.name,+ }),+ getJob: async (jobId: string) =>+ jobId === "job-scan.pdf"+ ? { id: jobId, status: "failed", error: "No text could be extracted" }+ : { id: jobId, status: "completed" },+};++const { uploadStagedSources } = loadWithStubs<typeof Dropzone>(+ new URL("../src/features/rag/components/project-source-dropzone.tsx", import.meta.url),+ {+ react: {},+ "react/jsx-runtime": stubJsxRuntime(),+ "@hugeicons/core-free-icons": {},+ "@hugeicons/react": {},+ "@/lib/utils": { cn: () => "" },+ "@/lib/toast": { toast },+ "@/features/native-intents": {},+ "@/features/chat/stores/chat-runtime-store": {},+ "./vision-overrides": {+ resolveVisionOverrides: async () => ({ ocr: undefined, caption: undefined }),+ },+ "../api/rag-api": ragApi,+ "./rag-api": ragApi,+ },+ { relativePassthrough: true },+);++test("a file added at project creation that fails to index is reported by name", async () => {+ const staged = ["notes.txt", "scan.pdf"].map((name) => {+ const file = new File(["x"], name);+ return { id: name, name, size: file.size, upload: file };+ });+ await uploadStagedSources("p1", staged as never);+ for (let i = 0; i < 60 && announced.length < 3; i++) {+ await new Promise((resolve) => setTimeout(resolve, 100));+ }+ assert.deepEqual(+ recordedToasts.map((t) => [t.kind, t.message, t.description]),+ [["error", "Couldn't index scan.pdf", "No text could be extracted"]],+ );+});