From 36d08fa2a7a16fb0ceecb50f1ebaa5360abc1d4d Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Mon, 29 Jun 2026 09:43:56 +0200 Subject: [PATCH] fix: request file list/search without extracted content by default (#25774) The file picker and Files modal only render filenames and metadata, but searchFiles()/getFiles() never passed content=false, so the backend serialized data.content (full extracted text) of every file into each response. On instances with many large documents this turns a metadata list into tens of MB per request, re-issued on every picker keystroke. The backend already supports content=false on GET /files/ and GET /files/search; this just makes the list/search callers opt out of the payload by default. The param stays overridable for callers that need it. Fixes #25741 Co-authored-by: Claude Opus 4.8 (1M context) --- src/lib/apis/files/index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/lib/apis/files/index.ts b/src/lib/apis/files/index.ts index a2b625edf8..433fe2d45f 100644 --- a/src/lib/apis/files/index.ts +++ b/src/lib/apis/files/index.ts @@ -145,10 +145,13 @@ export const uploadDir = async (token: string) => { return res; }; -export const getFiles = async (token: string = '') => { +export const getFiles = async (token: string = '', content: boolean = false) => { let error = null; - const res = await fetch(`${WEBUI_API_BASE_URL}/files/`, { + const searchParams = new URLSearchParams(); + searchParams.append('content', String(content)); + + const res = await fetch(`${WEBUI_API_BASE_URL}/files/?${searchParams.toString()}`, { method: 'GET', headers: { Accept: 'application/json', @@ -180,7 +183,8 @@ export const searchFiles = async ( token: string, filename: string = '*', skip: number = 0, - limit: number = 50 + limit: number = 50, + content: boolean = false ) => { let error = null; @@ -188,6 +192,7 @@ export const searchFiles = async ( searchParams.append('filename', filename); searchParams.append('skip', String(skip)); searchParams.append('limit', String(limit)); + searchParams.append('content', String(content)); const res = await fetch(`${WEBUI_API_BASE_URL}/files/search?${searchParams.toString()}`, { method: 'GET',