Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c9a2667

Browse files
committedFeb 19, 2025·
fix: keep one url for the api and asset store
1 parent 276a3c4 commit c9a2667

File tree

9 files changed

+25
-17
lines changed

9 files changed

+25
-17
lines changed
 

‎README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ PandaETL is an open-source, no-code ETL (Extract, Transform, Load) tool designed
4848
3. Create a `.env` file in the frontend directory with the following:
4949

5050
```bash
51-
NEXT_PUBLIC_API_URL=http://localhost:3000/api/v1
52-
NEXT_PUBLIC_STORAGE_URL=http://localhost:3000/api/assets
51+
NEXT_PUBLIC_API_URL=http://localhost:3000
5352
```
5453

5554
or copy the `.env.example` file to `.env`

‎backend/.env.example

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ PANDAETL_SERVER_URL="https://api.panda-etl.ai/" # optional
33
API_SERVER_URL="https://api.domer.ai" # optional
44
USE_OPENAI_EMBEDDINGS=false # optional
55
OPENAI_API_KEY=sk-xxxxxxxxxxxx # optional
6-
CHROMA_BATCH_SIZE=5 # optional
6+
CHROMA_BATCH_SIZE=500 # optional
77
MAX_FILE_SIZE=20971520 # optional
8-
PANDAETL_API_KEY=xxx-xxx-xxx-xxx # optional if you already have a PandaETL api key
8+
PANDAETL_API_KEY=xxx-xxx-xxx-xxx # optional if you already have a PandaETL api key

‎backend/app/processing/file_preprocessing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def process_segmentation(project_id: int, asset_id: int, asset_file_name: str):
4444
vectorstore.add_docs(
4545
docs=docs,
4646
metadatas=metadatas,
47-
batch_size=100
47+
batch_size=settings.chroma_batch_size
4848
)
4949

5050
project_repository.update_asset_content_status(

‎backend/app/processing/process_queue.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -406,4 +406,4 @@ def vectorize_extraction_process_step(project_id: int, process_step_id: int, fil
406406
]
407407

408408
# Add documents to vectorstore
409-
vectorstore.add_docs(docs=docs, metadatas=metadatas, batch_size=100)
409+
vectorstore.add_docs(docs=docs, metadatas=metadatas, batch_size=settings.chroma_batch_size)

‎backend/tests/processing/test_process_queue.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def test_vectorize_extraction_process_step_single_reference(mock_chroma_db):
216216
mock_vectorstore.add_docs.assert_called_once_with(
217217
docs=expected_docs,
218218
metadatas=expected_metadatas,
219-
batch_size=100
219+
batch_size=5
220220
)
221221

222222
@patch('app.processing.process_queue.ChromaDB')
@@ -263,7 +263,7 @@ def test_vectorize_extraction_process_step_multiple_references_concatenation(moc
263263
mock_vectorstore.add_docs.assert_called_once_with(
264264
docs=expected_docs,
265265
metadatas=expected_metadatas,
266-
batch_size=100
266+
batch_size=5
267267
)
268268

269269
@patch('app.processing.process_queue.ChromaDB') # Replace with the correct module path

‎frontend/.env.example

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
NEXT_PUBLIC_API_URL=http://localhost:3000/api/v1
2-
NEXT_PUBLIC_STORAGE_URL=http://localhost:3000/api/assets
1+
NEXT_PUBLIC_API_URL=http://localhost:3000
32
NEXT_PUBLIC_MIXPANEL_TOKEN=f2e8a71ab2bde33ebf346c5abf6ba9fa
43
NEXT_PUBLIC_ROLLBAR_ACCESS_TOKEN=0df0bee895044430880278e2b2a5b2d2
54
# NEXT_PUBLIC_BACKEND_URL=http://backend:5328 # Uncomment this if you're working with a docker setup

‎frontend/next.config.mjs

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
const nextConfig = {
22
swcMinify: false, // TODO - track and remove this later: https://github.com/wojtekmaj/react-pdf/issues/1822
33
async rewrites() {
4+
const backendUrl =
5+
process.env.NEXT_PUBLIC_BACKEND_URL || process.env.NEXT_PUBLIC_API_URL;
6+
7+
if (!backendUrl) {
8+
console.warn(
9+
"Warning: No backend URL provided. API routes may not work correctly."
10+
);
11+
}
12+
413
return [
5-
// {
6-
// source: "/api/:path*",
7-
// destination: "http://localhost:5328/:path*",
8-
// },
14+
{
15+
source: "/api/:path*",
16+
destination: `${backendUrl}/v1/:path*`,
17+
},
918
{
1019
source: "/assets/:path*",
11-
destination: "http://localhost:5328/assets/:path*",
20+
destination: `${backendUrl}/assets/:path*`,
1221
},
1322
];
1423
},

‎frontend/src/constants.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export const BASE_API_URL = process.env.NEXT_PUBLIC_API_URL;
2-
export const BASE_STORAGE_URL = process.env.NEXT_PUBLIC_STORAGE_URL;
1+
export const BASE_API_URL = `${process.env.NEXT_PUBLIC_API_URL}/v1`;
2+
export const BASE_STORAGE_URL = `${process.env.NEXT_PUBLIC_API_URL}/assets`;
33
export const MAX_FILE_SIZE = 20 * 1024 * 1024; // 20MB in bytes

‎frontend/src/middleware.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export async function middleware(request: NextRequest) {
1111
const dockerBackendUrl = process.env.NEXT_PUBLIC_BACKEND_URL;
1212

1313
if (dockerBackendUrl) {
14+
console.log(dockerBackendUrl);
1415
const response = await axios.get<{ data: APIKeyData }>(
1516
`${dockerBackendUrl}/v1/user/get-api-key`
1617
);

0 commit comments

Comments
 (0)
Please sign in to comment.