-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/ag UI #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/ag UI #59
Changes from all commits
f808e08
3331151
1dc0b67
83bb1b0
f9e99cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 3.13 | ||
| 3.14 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,13 @@ | ||
| FROM python:3.12-slim | ||
| FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| RUN apt-get update && apt-get install -y \ | ||
| curl \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \ | ||
| mv /root/.local/bin/uv /usr/local/bin/uv && \ | ||
| mv /root/.local/bin/uvx /usr/local/bin/uvx | ||
|
|
||
| COPY pyproject.toml uv.lock* ./ | ||
|
|
||
| RUN uv sync --frozen --no-cache || uv sync --no-cache | ||
|
|
||
| COPY . . | ||
|
|
||
| RUN uv sync --no-dev --no-cache \ | ||
| && uv pip list \ | ||
| && uv pip show fastapi uvicorn | ||
|
|
||
| EXPOSE 8000 | ||
|
|
||
| HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ | ||
| CMD curl -f http://localhost:8000/health || exit 1 | ||
|
|
||
| CMD ["uv", "run", "--no-sync", "python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] | ||
| CMD ["uv", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,9 +1,10 @@ | ||||||||
| from fastapi import APIRouter, Depends | ||||||||
| from fastapi.responses import StreamingResponse | ||||||||
| from sqlalchemy.orm import Session | ||||||||
|
|
||||||||
| from app.core.db_connection import get_db | ||||||||
| from app.schemas.chatMessage import UserMessageIn, AssistantMessageOut | ||||||||
| from app.services.chatMessage import create_user_message | ||||||||
| from ag_ui.core import RunAgentInput | ||||||||
| from app.services.chatMessage import process_agent_message | ||||||||
|
|
||||||||
|
|
||||||||
| router = APIRouter( | ||||||||
|
|
@@ -14,19 +15,15 @@ | |||||||
|
|
||||||||
| @router.post( | ||||||||
| "/messages", | ||||||||
| response_model=AssistantMessageOut | ||||||||
| ) | ||||||||
| def post_user_message( | ||||||||
| payload: UserMessageIn, | ||||||||
| async def post_user_message( | ||||||||
| payload: RunAgentInput, | ||||||||
| db: Session = Depends(get_db) | ||||||||
| ): | ||||||||
| assistant_msg, session_id = create_user_message( | ||||||||
| db=db, | ||||||||
| message=payload.message, | ||||||||
| session_id=payload.session_id | ||||||||
| """Handle chat messages using the AG-UI protocol. | ||||||||
|
|
||||||||
| This endpoint accepts RunAgentInput and returns a stream of AG-UI events. | ||||||||
| """ | ||||||||
| return StreamingResponse( | ||||||||
| process_agent_message(db, payload) | ||||||||
|
||||||||
| process_agent_message(db, payload) | |
| process_agent_message(db, payload), | |
| media_type="text/event-stream", |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring mentions returning "a stream of AG-UI events" but doesn't specify the format of these events or the expected media type. Consider adding more detail about the event format (e.g., whether they're JSON, SSE, newline-delimited) and the expected content-type to help API consumers understand how to consume the stream.