When a LAMB assistant using a RAG processor (Simple RAG, Context-Aware RAG, or Hierarchical RAG) answers a query and cites its sources, the reference URLs in the response are broken. The base URL of the KB server is incorrectly prepended to metadata URLs that are already absolute, producing mangled URLs like:
http://kb:9090http://localhost:9090/static/1/testbge/cf047e7fa1f646dfa025b1ed56b48528.html
Steps to Reproduce
- Create a Knowledge Base and ingest a document (e.g. via the markitdown plugin).
- Create an assistant with Simple RAG (or Context-Aware / Hierarchical RAG) using that KB.
- Ask the assistant a question that triggers a source citation.
- Observe the "Referencia" / source link in the assistant's response.
Expected Behavior
The source link should be a valid, clickable URL pointing to the document, e.g.:
http://<public-host>:9090/static/1/testbge/cf047e7fa1f646dfa025b1ed56b48528.html
Actual Behavior
The URL is a concatenation of the internal KB server URL (http://kb:9090) and the metadata URL (which is already an absolute URL), resulting in an invalid URL that cannot be opened.
Root Cause
In backend/lamb/completions/rag/ (affected files: simple_rag.py, hierarchical_rag.py, context_aware_rag.py), the code that builds source citation URLs unconditionally prepends KB_SERVER_URL to the URL fields stored in document metadata:
original_url = f"{KB_SERVER_URL}{metadata['original_file_url']}"
markdown_url = f"{KB_SERVER_URL}{metadata['markdown_file_url']}"
source_url = f"{KB_SERVER_URL}{metadata['file_url']}"
The markitdown ingestion plugins store absolute URLs in these metadata fields (e.g. http://localhost:9090/static/...), so prepending the KB server base URL produces a doubled, invalid URL.
The code should check whether the metadata value is already an absolute URL before prepending the base URL.
Affected Files
backend/lamb/completions/rag/simple_rag.py
backend/lamb/completions/rag/hierarchical_rag.py
backend/lamb/completions/rag/context_aware_rag.py
Screenshot showing the problem:

When a LAMB assistant using a RAG processor (Simple RAG, Context-Aware RAG, or Hierarchical RAG) answers a query and cites its sources, the reference URLs in the response are broken. The base URL of the KB server is incorrectly prepended to metadata URLs that are already absolute, producing mangled URLs like:
Steps to Reproduce
Expected Behavior
The source link should be a valid, clickable URL pointing to the document, e.g.:
Actual Behavior
The URL is a concatenation of the internal KB server URL (
http://kb:9090) and the metadata URL (which is already an absolute URL), resulting in an invalid URL that cannot be opened.Root Cause
In
backend/lamb/completions/rag/(affected files:simple_rag.py,hierarchical_rag.py,context_aware_rag.py), the code that builds source citation URLs unconditionally prependsKB_SERVER_URLto the URL fields stored in document metadata:The markitdown ingestion plugins store absolute URLs in these metadata fields (e.g.
http://localhost:9090/static/...), so prepending the KB server base URL produces a doubled, invalid URL.The code should check whether the metadata value is already an absolute URL before prepending the base URL.
Affected Files
backend/lamb/completions/rag/simple_rag.pybackend/lamb/completions/rag/hierarchical_rag.pybackend/lamb/completions/rag/context_aware_rag.pyScreenshot showing the problem: