Get Thread Messages
GET /api/chat/threads/{thread_id}/messages
Get messages from a specific thread with pagination
Retrieves messages from a specific conversation thread with pagination support for lazy loading. Returns most recent messages first (when offset=0).
Args: request: FastAPI request object thread_id: Thread identifier to get messages from backend: Backend service instance (injected via dependency) limit: Maximum number of messages to return (default: 100) offset: Number of messages to skip (default: 0, for lazy loading older messages)
Returns: ThreadMessagesResponse: Messages with thread metadata and pagination info
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Query Parameters
Section titled “Query Parameters ”Responses
Section titled “ Responses ”Successful Response
Thread messages retrieval response model - ULTRA-COMPLETE (45+ fields).
Provides all messages within a conversation thread for display and history browsing. Messages are ordered chronologically.
Fields: status: Response status (“success”, “error”) thread_id: Thread identifier messages: Ordered list of messages in thread count: Total number of messages in thread
Used By: - GET /api/chat/threads/{thread_id}/messages endpoint - Thread message history display - Conversation replay and review - Message export functionality
object
Response status (‘success’ or ‘error’)
Thread identifier
Ordered list of messages in thread
Individual chat message data model - ULTRA-COMPLETE (55+ fields).
Represents a single message within a conversation thread including role (user/assistant), content, and metadata. Used for message display and history reconstruction.
Fields: message_id: Unique message identifier thread_id: Parent thread identifier role: Message role (‘user’ or ‘assistant’) content: Message text content timestamp: Message creation timestamp (auto-generated) agent_used: Divine agent that generated response (for assistant messages) model_used: AI model used for generation (for assistant messages)
Used By: - ThreadMessagesResponse for message listings - Chat message display UI - Conversation history reconstruction - Message export and backup
object
Unique message identifier
Parent thread identifier
Message role (‘user’ or ‘assistant’)
Message text content
Message timestamp
RAG context source information for chat responses.
Represents a single document or source used to provide context for AI responses through Retrieval-Augmented Generation (RAG). Includes relevance scoring and source metadata for attribution and transparency.
Fields: source: Document or source identifier score: Semantic similarity score (0.0-1.0, higher is more relevant) title: Human-readable source title content_preview: Preview snippet of relevant content document_type: Type of document (e.g., ‘lore’, ‘character’, ‘world’) collection: ChromaDB collection name
Used By: - ChatResponse.context_sources - EnhancedChatResponse.context_sources - ChatMessage.context_sources - ChatMessageInfo.context_sources
object
Document or source identifier
Semantic similarity score (0.0-1.0)
Custom metadata container for extensibility.
Provides a structured container for custom key-value metadata that doesn’t fit into predefined fields. Supports common metadata patterns.
Fields: tags: List of tags for categorization labels: Key-value labels annotations: Additional annotations source: Data source identifier version: Data version
Used By: - Various models’ custom_metadata fields
object
Pipeline thinking step captured from a workflow callback.
Mirrors enhanced_chat_handler.ThinkingStep but lives in the schema
package so response models can reference it without a circular import.
Shape is authoritative — the only writer is WorkflowCallbackHandler
which builds dicts with exactly these fields.
Used By: - ChatMessage.thinking_steps (restored from SQLite on thread load)
object
Step index
Human-readable step name
Human-readable description
Inputs at step start
object
Outputs at step end
object
Step duration in ms
ISO timestamp
Individual reasoning step in AI thinking trace.
Represents a single step in the AI’s reasoning process for transparency and debugging. Includes step type, content, timing, and confidence.
Fields: step_number: Sequential step number step_type: Type of reasoning (e.g., ‘analysis’, ‘synthesis’, ‘evaluation’) content: Reasoning content or thought confidence: Confidence level for this step (0.0-1.0) duration_ms: Time taken for this step
Used By: - EnhancedChatResponse.reasoning_trace - ChatMessage.reasoning_trace - EnhancedChatStreamChunk.reasoning_trace
object
Sequential step number
Reasoning content or thought
object
Base64-encoded image attached to a chat message.
object
MIME type (image/png, image/jpeg, image/gif, image/webp)
Base64-encoded image data
Custom metadata container for extensibility.
Provides a structured container for custom key-value metadata that doesn’t fit into predefined fields. Supports common metadata patterns.
Fields: tags: List of tags for categorization labels: Key-value labels annotations: Additional annotations source: Data source identifier version: Data version
Used By: - Various models’ custom_metadata fields
object
Total number of messages in thread
Custom metadata container for extensibility.
Provides a structured container for custom key-value metadata that doesn’t fit into predefined fields. Supports common metadata patterns.
Fields: tags: List of tags for categorization labels: Key-value labels annotations: Additional annotations source: Data source identifier version: Data version
Used By: - Various models’ custom_metadata fields
object
Custom metadata container for extensibility.
Provides a structured container for custom key-value metadata that doesn’t fit into predefined fields. Supports common metadata patterns.
Fields: tags: List of tags for categorization labels: Key-value labels annotations: Additional annotations source: Data source identifier version: Data version
Used By: - Various models’ custom_metadata fields
object
Validation Error