Skip to content

Update format_sse to Carry Optional Buttons #357

@nuwangeek

Description

@nuwangeek

Priority: P1 — Required for streaming endpoint to deliver buttons to the frontend
File: src/llm_orchestration_service.py
Method: format_sse()
Also: Protocol definition in src/tool_classifier/workflows/service_workflow.py (LLMServiceProtocol.format_sse)
Type: Method signature extension
Add an optional buttons parameter:

def format_sse(
    self,
    chat_id: str,
    content: str,
    buttons: Optional[List[Dict[str, Any]]] = None,
) -> str:

When buttons is not None and not empty, include it in the payload:

payload = {
    "chatId": chat_id,
    "payload": {"content": content, **({"buttons": buttons} if buttons else {})},
    "timestamp": ...,
    "sentTo": [],
}

All existing call sites pass no buttons argument — no behavior change for RAG/context/single-step flows.
Work:

  1. Update format_sse signature and body in llm_orchestration_service.py.
  2. Update the LLMServiceProtocol.format_sse stub in service_workflow.py to match.
  3. Update the service_stream() async generator in execute_streaming() to call format_sse(chat_id, result["content"], result["buttons"]).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions