The Text tab offers an integrated conversational chat to interact directly with language models (LLMs — Large Language Models: AI programs trained to understand and generate text, like very advanced virtual assistants). It is the heart of textual AI generation in Celestory: you can co-write content, generate code, draft narrative scripts, query your project data in natural language — **and have the AI build your graph**.
### ⚠️ The most important point: this chat can modify your project
This is not a plain chatbot. As soon as the selected model knows how to use **tools**, every message you send triggers an **agent turn**: the assistant adds blocks, wires them, writes dialogue, creates variables and characters **in the graph you have open**, then tells you what it did.

- There is **no toggle** to switch on: the chosen model decides. If the model is not tool-capable, a **warning banner** appears ("The selected model (…) does not support tools, so it cannot touch the graph — it will only answer in the chat") and the chat falls back to a plain conversation with no effect on your story.
- The assistant has **29 dedicated graph tools**, plus whatever your MCP connectors expose (Tools tab).
- It chains at most **8 rounds of tool calls** per answer; beyond that it stops, and whatever it has already built stays in the graph.
- Every action appears in the conversation as a readable card ("Added character Alex", "3 choices set"), expandable for the details.
- Under the message that started the work, an **Undo this turn** button restores the project to its previous state — the unit undone is the whole turn, not each individual change.

👉 The full account of what the assistant can do, its rules and its limits: [The AI Assistant That Builds Your Graph](Assistant_Graphe.md).
### How does it work?
You type a message in the chat field. The model receives:
1. The history of your previous exchanges (to maintain context)
1. Optionally, text variables from your project attached to the message
1. Your current prompt (the instruction or question you send to the AI)

It generates a response that appears progressively in the chat, rendered in Markdown (lightweight text formatting: `# Title`, `bold`, `- list` → displayed as rich text) in real time.
### Chat Interface
- **Left panel**: the list of your previous conversations, automatically named and organized into groups. You can pin an important conversation to the top, rename it, move it to a group, or start a new one. The divider between the two panels can be dragged with the mouse.
- **Right panel**: the chat area with model selection, token counter, message history and input field.
### Key Features
- **Model selection**: choose among the available models, grouped by provider (with the brand logo where one exists). The model's credit cost is shown right next to it.
- **Token counter**: the interface shows in real time how many tokens (units of text the AI processes — one token ≈ ¾ of a word) the history uses against the selected model's context window (e.g. 12,530 / 256,000 tokens). When the provider reports real usage, the breakdown is shown on hover (input, output, cached tokens, reasoning tokens); otherwise it is an estimate, and the interface says so.
- **Input estimate**: before sending a message, the number of extra tokens your entry will consume is displayed (e.g. + 842 tokens).
- **Attaching text variables**: you can attach your project's text variables (a character, a game rule, a style guide) to the prompt. Each attached variable shows its token weight and is appended to the end of your message.
- **Markdown preview**: AI responses are rendered in Markdown in real time, ideal for visually validating structured documents.
- **History management**: delete individual messages, reload saved conversations, undo a whole assistant turn.
### Use Cases
- 🏗️ **Building the graph**: ask the assistant to lay out a scene, a branch, a group of blocks — and watch it appear in the graph.
- ✍️ **Narrative co-writing**: draft or rewrite dialogue, scene descriptions or scenario branches.
- 💻 **Vibe Coding**: generate HTML/CSS/JS code for an HTML5 block (see the Vibe Coding section below).
- 🗂️ **Querying project data**: ask a natural-language question about an attached text variable (a game rule, a style guide, a data export).
- 🧾 **Generating structured documents**: produce a report, a teaching sheet or training material in Markdown.
- 🌍 **Translation and proofreading**: translate or rephrase existing project content.
### Available Text Models
The model list is **not baked into the software**: it lives server-side, in a table administered by Celestory. It can therefore change (additions, removals, renames) without you having to update anything.

The providers identified by a logo in the interface today are: **Mistral**, **OpenAI**, **Google**, **Anthropic**, **Meta** and **xAI**. Others may appear without a logo.

For each model, three things matter:
- its **context window** (how much text it can hold),
- its **credit cost** (the `©` badge),
- its **tool capability** — a setting carried by the model itself, and the one that decides whether the assistant can touch your graph.

⚠️ Don't be surprised if a model appears, disappears or is renamed between sessions: just look at the list offered in the picker at the moment you generate.
---
