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) <noreply@anthropic.com>
This commit is contained in:
Classic298
2026-06-29 09:43:56 +02:00
committed by GitHub
parent 2bdd2ab94e
commit 36d08fa2a7

View File

@@ -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',