Repository navigation
Conversation
…hare when the editor opens first
… use a laughing face for Characters
…er nameplate, and a lighter dialogue panel
… 3:4 reply portraits, and a friendlier Characters icon
…d characters answer, titles and surnames count
…gle the docked portrait
…ons skip group chats
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…r memory - Cloud providers are never sent stop sequences, so a character reply from one ran on into the next speaker's line. The provider stream now cuts at them; connection-model routes keep their own filter, and /v1/messages no longer passes the stop twice. - Avatars use the shared, reference-counted object URL cache (moved from the library to lib/), so a picture on screen is never revoked and the rest stay within its budget; library cards fetch a picture only once near the screen (useSeen, moved to hooks/). - A send re-checks the cast at most once per chat every 30 s, so a group round asks once. - A resumed group reply is replayed with its speaker's name, like every other group reply. - Click-to-close in the image viewer is opt-in (avatars), not a change to every image. - The avatar upload routes look up the row off the event loop. - A character's chat list says when older chats were left out. - The python-picture export test gets the character transcript helper its siblings already had.
# Conflicts: # studio/frontend/tests/characters-wiring.test.ts
The harness stubbed prepareCharacterRun but not prepareCharacterCountRun, which the count path calls; its dependency resolver pulled the real one in without the countRuns cache it uses, so two cases failed with ReferenceError on every OS.
The python floor gate counts studio files that evaluate PEP 604 unions on 3.9; this test file added one (dict | None).
|
The latest run on
|
The desktop branding contract on main forbids "Unsloth Studio" in display strings; the system prompt hint and the imported-card note used it in every locale.
chat-export-python-images.test.ts evaluates the export loader, which now calls characterChatTranscript, so its context provides it as chat-export-html-images.test.ts does. The research contract sliced thread.tsx at "const UserActionBar: FC = () =>", which this PR changed to take showTime.
The restructure made the bottom spacer's aui-thread-bottom-spacer class unconditional again, so every chat's markup grew by 25 characters and UI parity failed. Only character chats get it now, as d5ba349 had it, with a test.
# Conflicts: # studio/frontend/tests/characters-wiring.test.ts
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
# Conflicts: # studio/backend/routes/chat_generation_runs.py # studio/frontend/tests/chat-export-python-images.test.ts
Adds character chat to Studio: a library of characters you can talk to, alone or in a group, with import and export of the standard character card formats (V1, V2 and V3 as PNG or JSON, and CHARX).
What it adds
/characters, in the sidebar's More menu and the command palette): a portrait grid with search, tags, favorites and sorting, import by file picker or drag and drop, and Select mode to start a group chat.Screenshots
The replies are live, from
Qwen3.8-27B(UD-Q4_K_M). Every character, the persona (Alex) and the visual novel background were made for this PR.Stage view
A group chat: characters answer each other as well as you. Here Rin brings in Leo to get Alex's Spanish ready for a job.
A lesson with Leo
The Characters page
A character's profile
The editor
Existing menus that changed
Before is the merge base (
e27c6806ad), after is this PR.How it works
Storage (
storage/characters_db.py): four new tables in each account'sstudio.db:characters,personas,chat_cast(a chat's members, order and mute) andchat_scene(its persona and settings).chat_threadsandchat_messagesare not changed. Deleting a chat removes its cast and scene; deleting a character keeps its chats. A fork copies cast and scene in the same transaction. Each character keeps its original card, so an export carries the fields Studio does not edit. Portraits are files next to the database, served by authenticated routes. Starters are recorded incharacter_starterswhen added, so each is added once per account and a deleted one stays deleted.Cards (
core/characters/cards.py): readsccv3beforecharafrom PNG text chunks, JSON and CHARX, and exports a PNG with V2 and V3 chunks, or V3 JSON. Files that are not cards are refused with a reason. Cards are untrusted input: decompression stays within one card-size budget and tags are clamped to the editor's limits.Routes (
routes/characters.py,/api/characters): characters, import and export, portraits, personas, andPOST /chats,GETandPUT /chats/{thread_id}for a chat's cast and scene.PUTapplies one edit on top of what is stored (settings merge; members are added, removed or muted by id), so edits from two tabs compose.Chat structure: a character chat is created on the server with a hidden opening user turn and each greeting as a reply under it, so alternate greetings are ordinary branches. In a group, a hidden turn message precedes each member's reply. Every reply therefore has a user parent, which durable chat runs require, and strict templates (Mistral, Gemma 2) keep alternating. Each reply stores its speaker in
metadata.roleplay, so the speaker survives a Stop, a reload, or a run that finishes with no tab open.Prompt (
features/characters/prompt/, pure modules with tests): one system block in a fixed order (instructions, lore, characters, persona, scenario, example dialogue) that does not depend on who speaks next, so llama.cpp's prompt cache holds when the speaker changes. Depth notes and final instructions ride late user turns, because the backend merges system messages into the first. Lorebooks support keywords,/regex/keys, secondary keys, constant entries, scan depth and a token budget; regex keys come from imported cards, so they run on a linear-time matcher. In groups, history lines carry the speaker's name and stop strings cover the other speakers.Compaction: on local models (GGUF, MLX, NPU and managed engines), character chats use the rolling context policy: the oldest turns are dropped while the cards stay, and the closest archived turns are quoted back silently. The checkpoint default would turn earlier user messages into standing instructions and show its recall as a tool call inside the character's reply. On a cloud connection a character chat compacts like any other chat there, which since #17743 means a summary of the older turns.
Outside the feature folder: hooks in the chat adapter (prompt, stop strings, speaker), the thread (hidden turns, message frames), run settings, chat header, sidebar, composer + menu, router and command palette. The image viewer now closes when a picture shown at fit size is clicked. Strings are in all 24 locales. One fix also reaches ordinary chats: Mistral templates require nine-character alphanumeric tool-call ids, so web search failed with Mistral models; replayed history now maps ids when the template checks them (
core/inference/chat_template_helpers.py).Limitations
Testing
On the current head (
67c432a1f6, which merges main atf49006976f):tests/test_characters.py(61),tests/test_mistral_tool_call_ids.py(5),tests/test_chat_generation_runs.py(75) andtests/multi_account(1279, of which 96 are character and chat-scene cases) pass.tests/characters-prompt.test.ts(23) andtests/auto-compaction-settings.test.ts(18) pass; typecheck, build,bundle:checkandi18n:check:strictpass. The full frontend suite's 12 failures also fail on main.On the opening commit (
7e2df2c):tests/multi_accountwith the schema, chat history, chat storage, fork and account lifecycle suites, 2606 passed;i18n:check:strict, build andbundle:checkpassed; the full frontend suite's 15 failures also fail on the merge base.Live, with
Mistral-Nemo-Instruct-2407, driven in Chromium: importing public cards in every supported format (one with 350 lore entries); one-on-one and group chats with regenerate, alternate greetings, Write my reply, both reply orders, and Stop mid-round followed by a reload; fork, export and re-import; compaction at a 3,072-token context over nine long turns; web search with Mistral before and after the id fix; the three views in both themes and at phone width, and the stage view at window widths from 360 to 3840 px.The starter characters were checked live with
Qwen3.8-27B: a one-on-one Spanish lesson with Leo (corrections of ser and estar and of gustar), a group chat with Rin and Leo, and Rin one-on-one.