Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
!README.md
!/data
!/src
!logging.yaml

## Exclude files in allowed subdirectories
**/__pycache__/
Expand Down
17 changes: 9 additions & 8 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,21 @@ RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync \
--frozen \
--no-dev \
--no-editable \
--no-install-project
--frozen \
--no-dev \
--no-editable \
--no-install-project

COPY src /app/src
COPY data /app/data
COPY logging.yaml /app/logging.yaml

RUN --mount=type=cache,target=/root/.cache/uv \
uv sync \
--frozen \
--no-dev \
--no-editable \
--compile-bytecode
--frozen \
--no-dev \
--no-editable \
--compile-bytecode

###################################
# DEVELOPMENT (--target local)
Expand Down
31 changes: 31 additions & 0 deletions backend/logging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: 1
disable_existing_loggers: false

formatters:
default:
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
datefmt: "%Y-%m-%d %H:%M:%S"

handlers:
console:
class: logging.StreamHandler
formatter: default
stream: ext://sys.stdout

loggers:
uvicorn:
level: INFO
handlers:
- console
propagate: false

atlas_assistant:
level: INFO
handlers:
- console
propagate: false

root:
level: INFO
handlers:
- console
5 changes: 4 additions & 1 deletion backend/src/atlas_assistant/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ async def chat(
agent: Agent = request.state.agent
thread_id = chat_request.thread_id or str(uuid.uuid4())
event_stream = (accept and "text/event-stream" in accept) or False
logger.info(f"Query: {chat_request.query}")
return StreamingResponse(
query_agent(agent, chat_request.query, thread_id, settings, event_stream),
media_type="text/event-stream" if event_stream else "application/x-ndjson",
Expand Down Expand Up @@ -246,8 +247,10 @@ def maybe_create_response_message(
for tool_call in tool_calls:
function = tool_call.get("function")
if function.get("name") == "Output":
output = Output.model_validate_json(function.get("arguments"))
logger.info(f"Answer: {output.answer}")
return OutputResponseMessage(
output=Output.model_validate_json(function.get("arguments")),
output=output,
thread_id=thread_id,
)
if message.content:
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ services:
"*data*",
"--host",
"0.0.0.0",
"--log-config",
"logging.yaml",
]
volumes:
- ./backend/.env:/app/.env
- ./backend/src:/app/src
- ./backend/data:/app/data
- ./backend/tests:/app/tests
- ./backend/logging.yaml:/app/logging.yaml

chat:
image: atlas/backend
Expand Down
6 changes: 4 additions & 2 deletions terraform/aws/ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ module "ecs" {
"--host",
"0.0.0.0",
"--port",
"8000"
"8000",
"--log-config",
"logging.yaml"
]
portMappings = [
{
Expand Down Expand Up @@ -88,4 +90,4 @@ module "ecs" {
}

tags = var.tags
}
}