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
20 changes: 15 additions & 5 deletions grafi_dev/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,27 @@ def _execution_context(conv_id: str, req_id: str):

# ---------- conversation helpers ----------------------------------------
def get_conversation_ids():
evs = container.event_store.get_events()
conv_ids = {e.execution_context.conversation_id for e in evs}
return sorted(
{
e.execution_context.conversation_id
for e in container.event_store.get_events()
}
conv_ids,
key=lambda conv_id: min(
e.timestamp for e in evs if e.execution_context.conversation_id == conv_id
),
)


def get_request_ids(conv_id: str):
evs = container.event_store.get_conversation_events(conv_id)
return sorted({e.execution_context.assistant_request_id for e in evs})
req_ids = {e.execution_context.assistant_request_id for e in evs}
return sorted(
req_ids,
key=lambda req_id: min(
e.timestamp
for e in evs
if e.execution_context.assistant_request_id == req_id
),
)


# ---------- FastAPI factory ---------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"fastapi>=0.115.12",
"grafi>=0.0.11",
"grafi>=0.0.12",
"typer>=0.15.3",
"uvicorn>=0.34.2",
]
Expand Down
18 changes: 14 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.