Thread
, Message
) used by C1Chat.
The Flow of a Conversation
- User Input: The user types a prompt into the chat composer and sends it.
- Message Creation: The application creates a user message from this input and adds it to the current Thread’s history.
- Backend Request: The frontend sends the new user message (often along with the thread context) to your backend server.
- API Call: Your backend constructs the full payload for the C1 API. This typically includes a predefined system prompt, the conversation history from the Thread, and the new user message.
- Assistant Response: The C1 API processes the request and returns a response, which your application stores as an assistant message.
- UI Update: The frontend receives this C1 response, adds it to the Thread as a new assistant message, and displays it in the UI.
Message
C1 API is openai compatible. So the message is the same as openai. AMessage
is a basic unit in a conversation. Each message has a role
that defines its author:
user
: Represents an input from the end-user.assistant
: Represents a response from the AI. The content can be standard text or a C1 DSL string for rendering interactive UI.system
: Provides high-level instructions to the AI and is typically not visible in the UI.
Thread: A Single Conversation
AThread
is an ordered list of Message
objects. It represents a single, continuous conversation.
ThreadList: Managing Multiple Conversations
AThreadList
is the collection of all threads for a user. In a typical UI, this is represented by the chat history sidebar.