Spaces:
Sleeping
Sleeping
Commit
·
36722a7
1
Parent(s):
fe3f114
fix the issue
Browse files- .dockerignore +2 -2
- Dockerfile +7 -3
- backend/api/services/agent_orchestrator.py +7 -1
.dockerignore
CHANGED
|
@@ -42,8 +42,8 @@ Thumbs.db
|
|
| 42 |
*.log
|
| 43 |
logs/
|
| 44 |
|
| 45 |
-
# Database files (
|
| 46 |
-
|
| 47 |
|
| 48 |
# Temporary files
|
| 49 |
*.tmp
|
|
|
|
| 42 |
*.log
|
| 43 |
logs/
|
| 44 |
|
| 45 |
+
# Database files (avoid copying local dev databases into images)
|
| 46 |
+
data/*.db
|
| 47 |
|
| 48 |
# Temporary files
|
| 49 |
*.tmp
|
Dockerfile
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
# Install system dependencies
|
| 6 |
-
RUN apt-get update && apt-get install -y \
|
| 7 |
gcc \
|
| 8 |
g++ \
|
| 9 |
postgresql-client \
|
|
@@ -12,7 +15,8 @@ RUN apt-get update && apt-get install -y \
|
|
| 12 |
|
| 13 |
# Copy requirements and install Python dependencies
|
| 14 |
COPY requirements.txt .
|
| 15 |
-
RUN
|
|
|
|
| 16 |
|
| 17 |
# Copy application code
|
| 18 |
COPY . .
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
# syntax=docker/dockerfile:1.4
|
| 4 |
FROM python:3.10-slim
|
| 5 |
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
+
# Install system dependencies (kept minimal for faster builds)
|
| 9 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 10 |
gcc \
|
| 11 |
g++ \
|
| 12 |
postgresql-client \
|
|
|
|
| 15 |
|
| 16 |
# Copy requirements and install Python dependencies
|
| 17 |
COPY requirements.txt .
|
| 18 |
+
RUN --mount=type=cache,target=/root/.cache/pip \
|
| 19 |
+
pip install --no-cache-dir -r requirements.txt
|
| 20 |
|
| 21 |
# Copy application code
|
| 22 |
COPY . .
|
backend/api/services/agent_orchestrator.py
CHANGED
|
@@ -1382,6 +1382,12 @@ Answer:"""
|
|
| 1382 |
|
| 1383 |
snippet_text = "\n\n".join(snippets) if snippets else ""
|
| 1384 |
scores_text = "\n".join(scores_info) if scores_info else ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1385 |
|
| 1386 |
if not snippet_text:
|
| 1387 |
prompt = (
|
|
@@ -1425,7 +1431,7 @@ Answer:"""
|
|
| 1425 |
f"<knowledge_base_documents>\n"
|
| 1426 |
f"The following documents were retrieved from the tenant's knowledge base as relevant to the user's question:\n\n"
|
| 1427 |
f"{snippet_text}\n\n"
|
| 1428 |
-
f"{
|
| 1429 |
f"</knowledge_base_documents>\n\n"
|
| 1430 |
f"<user_question>\n"
|
| 1431 |
f"{req.message}\n"
|
|
|
|
| 1382 |
|
| 1383 |
snippet_text = "\n\n".join(snippets) if snippets else ""
|
| 1384 |
scores_text = "\n".join(scores_info) if scores_info else ""
|
| 1385 |
+
|
| 1386 |
+
# Build optional relevance scores section separately to avoid complex f-string expressions
|
| 1387 |
+
if scores_text:
|
| 1388 |
+
relevance_section = "## Relevance Scores\n" + scores_text + "\n\n"
|
| 1389 |
+
else:
|
| 1390 |
+
relevance_section = ""
|
| 1391 |
|
| 1392 |
if not snippet_text:
|
| 1393 |
prompt = (
|
|
|
|
| 1431 |
f"<knowledge_base_documents>\n"
|
| 1432 |
f"The following documents were retrieved from the tenant's knowledge base as relevant to the user's question:\n\n"
|
| 1433 |
f"{snippet_text}\n\n"
|
| 1434 |
+
f"{relevance_section}"
|
| 1435 |
f"</knowledge_base_documents>\n\n"
|
| 1436 |
f"<user_question>\n"
|
| 1437 |
f"{req.message}\n"
|