Skip to content

feat(ai): auto-title conversations from the first message - #100

Merged
os-zhuang merged 1 commit into
mainfrom
feat/ai-conversation-titles
Jun 10, 2026
Merged

os-zhuang merged 1 commit into
mainfrom
feat/ai-conversation-titles

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

What

Saved conversations in the drawer now show a meaningful title (e.g. "How many orders?") instead of "New conversation". The store titles a conversation from its first user message at creation.

Why client-side

The server's LLM auto-titling (summarizeConversation) only fires on its own chat-persist path, which the mobile client bypasses (it persists via the explicit /:id/messages endpoint — verified: a conversation stayed untitled after a conversationId chat). objectui uses the same first-message fallback for display, so this matches web behavior.

  • lib/ai-conversations.ts — deriveConversationTitle() (collapse whitespace, truncate to 48 chars on a word boundary + ellipsis) and renameConversation() (PATCH /conversations/:id) for a future rename UI.
  • store — createConversation(deriveConversationTitle(firstMessage)).

Tests

  • Title derivation (short verbatim, word-boundary truncation, empty fallback), PATCH rename, and the store creating with the derived title.
  • npm run lint 0 errors; jest 1259/1259 (153 suites).

🤖 Generated with Claude Code

Saved conversations in the drawer now show a meaningful title instead of
"New conversation". The store titles a conversation from its first user
message at creation time.

Why client-side: the server's LLM auto-titling (summarizeConversation)
only fires on its own chat-persist path, which the mobile client bypasses
(it persists via the explicit /:id/messages endpoint). objectui uses the
same first-message fallback for display.

- lib/ai-conversations.ts: deriveConversationTitle() (collapse whitespace,
  truncate to 48 chars on a word boundary with an ellipsis) +
  renameConversation() (PATCH /conversations/:id) for future rename UI.
- store: createConversation(deriveConversationTitle(firstMessage)).

+4 tests (title derivation incl. truncation/empty, PATCH rename, store
creates with the derived title). Suite 1259/1259, lint clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@os-zhuang
os-zhuang merged commit ec9f19b into main Jun 10, 2026
@os-zhuang
os-zhuang deleted the feat/ai-conversation-titles branch June 10, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant