mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
⏱️ fix: Increase RAG API Text Parsing Timeout (#10562)
* fix: increase RAG API text parsing timeout for large files * ci: Update text.spec.ts --------- Co-authored-by: Rosen Simov <rosen.simov@endurosat.com> Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
parent
ffcca3254e
commit
959984f959
2 changed files with 13 additions and 5 deletions
|
|
@ -50,8 +50,9 @@ import { parseTextNative, parseText } from './text';
|
||||||
import fs, { ReadStream } from 'fs';
|
import fs, { ReadStream } from 'fs';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import FormData from 'form-data';
|
import FormData from 'form-data';
|
||||||
import { generateShortLivedToken } from '../crypto/jwt';
|
import type { ServerRequest } from '~/types';
|
||||||
import { readFileAsString } from '../utils';
|
import { generateShortLivedToken } from '~/crypto/jwt';
|
||||||
|
import { readFileAsString } from '~/utils';
|
||||||
|
|
||||||
const mockedFs = fs as jest.Mocked<typeof fs>;
|
const mockedFs = fs as jest.Mocked<typeof fs>;
|
||||||
const mockedAxios = axios as jest.Mocked<typeof axios>;
|
const mockedAxios = axios as jest.Mocked<typeof axios>;
|
||||||
|
|
@ -77,7 +78,7 @@ describe('text', () => {
|
||||||
|
|
||||||
const mockReq = {
|
const mockReq = {
|
||||||
user: { id: 'user123' },
|
user: { id: 'user123' },
|
||||||
};
|
} as ServerRequest;
|
||||||
|
|
||||||
const mockFileId = 'file123';
|
const mockFileId = 'file123';
|
||||||
|
|
||||||
|
|
@ -228,6 +229,13 @@ describe('text', () => {
|
||||||
file_id: mockFileId,
|
file_id: mockFileId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
expect(mockedAxios.post).toHaveBeenCalledWith(
|
||||||
|
'http://rag-api.test/text',
|
||||||
|
expect.any(Object),
|
||||||
|
expect.objectContaining({
|
||||||
|
timeout: 300000,
|
||||||
|
}),
|
||||||
|
);
|
||||||
expect(result).toEqual({
|
expect(result).toEqual({
|
||||||
text: '',
|
text: '',
|
||||||
bytes: 0,
|
bytes: 0,
|
||||||
|
|
@ -278,7 +286,7 @@ describe('text', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await parseText({
|
const result = await parseText({
|
||||||
req: { user: undefined },
|
req: { user: undefined } as ServerRequest,
|
||||||
file: mockFile,
|
file: mockFile,
|
||||||
file_id: mockFileId,
|
file_id: mockFileId,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ export async function parseText({
|
||||||
accept: 'application/json',
|
accept: 'application/json',
|
||||||
...formHeaders,
|
...formHeaders,
|
||||||
},
|
},
|
||||||
timeout: 30000,
|
timeout: 300000,
|
||||||
});
|
});
|
||||||
|
|
||||||
const responseData = response.data;
|
const responseData = response.data;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue