Skip to main content
GET
/
api
/
chat
/
history
Get Conversation History
curl --request GET \
  --url https://api.example.com/api/chat/history
{
  "history": [
    {
      "role": {},
      "content": "<string>",
      "timestamp": "<string>",
      "original_recipe": {},
      "suggested_recipe": {},
      "accepted": true
    }
  ]
}
This endpoint is currently not implemented in the backend. The chat system uses LangGraph’s built-in memory management with thread-based context.

Planned Implementation

Conversation history is maintained automatically by the AI assistant using thread IDs formatted as {user_id}-{date}. Each day creates a new conversation thread, and context is preserved within the same day’s interactions.

Alternative: Thread-Based Context

The SmartEat AI chat system currently uses LangGraph’s state management to maintain conversation context:
  • Thread ID Format: {user_id}-{current_date}
  • Context Window: Conversations are scoped to the current day
  • State Persistence: Message history is maintained in-memory during the session
  • Profile & Plan Access: The assistant always has access to your current profile and active meal plan

Example Current Behavior

When you send multiple messages in a day, the assistant maintains context:
First Message
curl -X POST https://api.smarteat.ai/api/chat/ \
  -H "Authorization: Bearer <token>" \
  -d 'message=Create a meal plan for me'

# Response: "I've created a 7-day meal plan..."
Follow-up Message (Same Day)
curl -X POST https://api.smarteat.ai/api/chat/ \
  -H "Authorization: Bearer <token>" \
  -d 'message=Can you swap the dinner for day 1?'

# Response: "I'll swap the dinner recipe from your meal plan..." 
# (Assistant remembers the plan it just created)

Schema Definition

When this endpoint is implemented, it will return conversation history using the following schema:

Response Structure

history
array
Array of messages in chronological order

Future Implementation Example

200 - Success (Planned)
{
  "history": [
    {
      "role": "user",
      "content": "Create a meal plan for this week",
      "timestamp": "2026-03-05T10:30:00Z"
    },
    {
      "role": "chef",
      "content": "I've created a 7-day meal plan for you with 3 meals per day...",
      "timestamp": "2026-03-05T10:30:05Z"
    },
    {
      "role": "user",
      "content": "Can you swap the dinner for day 1?",
      "timestamp": "2026-03-05T10:32:00Z"
    },
    {
      "role": "chef",
      "content": "I've found a similar recipe that matches your preferences...",
      "timestamp": "2026-03-05T10:32:03Z",
      "original_recipe": {
        "id": 1,
        "name": "Grilled Chicken Salad",
        "calories": 450
      },
      "suggested_recipe": {
        "id": 2,
        "name": "Mediterranean Chicken Bowl",
        "calories": 480
      },
      "accepted": true
    }
  ]
}

Notes

  • Conversation history may be implemented in a future version
  • Current implementation relies on LangGraph’s state management
  • Each day starts a new conversation thread
  • Consider implementing persistent storage for long-term conversation history

Build docs developers (and LLMs) love