Skip to content

/chat endpoint needs proper handling of long-running task #569

@tonyzhao6

Description

@tonyzhao6

The /chat endpoint is currently using FastAPI's background task to execute the search process and LLM calls in order to get around Turn.io's 20 second limitation. This is not a robust solution since FastAPI's background task does not guarantee execution order.

Suitable solutions for productions are:

  1. Websockets (but Turn.io does not support this currently)
  2. Proper message queue system like Celery, RMQ, etc.
  3. Preventing users from requesting another message until the current background task finishes.

NB: This does not affect the frontend UI since there is no way to call the /chat endpoint with a WA ID and Turn API key from the UI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions