Update Message
PATCH /api/chat/messages/{message_id}
Update message content
Updates the content of an existing message. Only user messages can be edited. AI responses cannot be modified directly (use regenerate instead).
Args: request: FastAPI request object message_id: ID of message to update request_data: Message update data (new content) backend: Backend service instance (injected)
Returns: MessageUpdateResponse: Updated message data
Raises: HTTPException: 404 if message not found HTTPException: 403 if attempting to edit AI message HTTPException: 500 if update fails
Example Request: PATCH /chat/messages/msg_abc123 { “content”: “Updated message content here” }
Example Response: { “status”: “success”, “message_id”: “msg_abc123”, “updated_message”: { “id”: “msg_abc123”, “content”: “Updated message content here”, “role”: “user”, “edited”: true }, “edited_at”: “2025-01-15T10:30:00Z” }
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Request Body required
Section titled “Request Body required ”Message content update request model.
Request model for updating the content of an existing message. Only user messages can be edited. AI responses cannot be modified directly (use regenerate instead).
Fields: content: New message content (must be non-empty)
Used By: - PATCH /api/chat/messages/{message_id} endpoint - Message edit UI - Message correction workflow
object
New message content
Responses
Section titled “ Responses ”Successful Response
Message update response model.
Confirms successful update of message content with updated message data.
Fields: status: Update status (“success”, “error”) message_id: ID of updated message updated_message: Updated message object edited_at: Edit timestamp
Used By: - PATCH /api/chat/messages/{message_id} response - Message edit confirmation - Message history tracking
object
Update status (‘success’ or ‘error’)
ID of updated message
Updated message object
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
Edit timestamp
Validation Error