Skip to content

BrainAPI is a knowledge graph–powered AI memory layer that transforms unstructured data into structured knowledge, enabling intelligent search, recommendations, and contextual memory for AI agents and applications.

fix(files ingestion): dynamic webhook url from request

Christiana9c8aa7e8e86
diff --git a/README.md b/README.md
index bd9ff2b..25b9d0b 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://discord.gg/VTngQTaeDf"><img src="https://img.shields.io/badge/Discord-Join%20Lumen%20Brain-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Discord"/></a>
- <img src="https://img.shields.io/badge/version-2.9.2--dev-blue?style=for-the-badge" alt="Version"/>
+ <img src="https://img.shields.io/badge/version-2.9.3--dev-blue?style=for-the-badge" alt="Version"/>
<img src="https://img.shields.io/badge/python-3.11+-green?style=for-the-badge&logo=python&logoColor=white" alt="Python"/>
<img src="https://img.shields.io/badge/license-AGPLv3%20%2B%20Commons%20Clause-purple?style=for-the-badge" alt="License"/>
</p>
diff --git a/pyproject.toml b/pyproject.toml
index a6bd4d2..5ce1db9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "brainapi2"
-version = "2.9.2-dev"
+version = "2.9.3-dev"
description = "Version 2.x.x of the BrainAPI memory layer."
authors = [
{name = "Christian",email = "[email protected]"}
diff --git a/src/services/api/routes/ingest.py b/src/services/api/routes/ingest.py
index a146803..c32fb12 100644
--- a/src/services/api/routes/ingest.py
+++ b/src/services/api/routes/ingest.py
@@ -3,7 +3,7 @@ File: /ingest.py
Created Date: Sunday October 19th 2025
Author: Christian Nonis <[email protected]>
-----
-Last Modified: Thursday February 19th 2026 7:45:12 pm
+Last Modified: Wednesday March 4th 2026 9:35:41 pm
Modified By: Christian Nonis <[email protected]>
-----
"""
@@ -103,6 +103,7 @@ async def ingest_structured_data(data: IngestionStructuredRequestBody):
@ingest_router.post(path="/file")
async def ingest_file(
+ request: Request,
file: Annotated[UploadFile, File()],
brain_id: str = Form(default="default"),
):
@@ -142,6 +143,7 @@ async def ingest_file(
"task_id": task,
}
else:
+ app_host = str(request.base_url).rstrip("/")
cache_adapter.set(
key=f"task:{task}",
value=json.dumps({"status": "queued", "task_id": task}),
@@ -153,7 +155,7 @@ async def ingest_file(
files={"file": (file.filename or "file", file.file, file.content_type)},
data={
"brain_id": brain_id,
- "webhook_callback": config.app_host,
+ "webhook_callback": f"{app_host}/ingest",
"identifier": task,
},
headers={"Authorization": f"Bearer {config.docparser_token}"},