Skip to content

feat(ai): auto-title a conversation from its first user message#1850

Merged
xuyushun441-sys merged 1 commit into
mainfrom
feat/ai-conversation-auto-title-first-message
Jun 14, 2026
Merged

feat(ai): auto-title a conversation from its first user message#1850
xuyushun441-sys merged 1 commit into
mainfrom
feat/ai-conversation-auto-title-first-message

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Problem

The console AI sidebar lists conversations straight off ai_conversations rows. An untitled conversation renders a generic "New conversation" label — so once a user has a few, the list is a wall of identical rows with no way to distinguish or find one. (Found dogfooding the AI app-builder: dozens of indistinguishable "新对话".)

Conversations are created untitled and the list endpoint already returns title when present — but it was never set.

Fix

In ObjectQLConversationService.addMessage, set title from the first user message the instant it lands (collapse whitespace, cap 60 chars). Deterministic, no extra model call.

  • Only seeds when the conversation has no title yet AND the turn is a user turn.
  • An explicit title is never clobbered; the optional LLM auto-titler (when enabled) still overwrites with a nicer title.

Verification

  • 4 unit cases: untitled→titled, existing-title-kept, assistant-first-turn-ignored, whitespace-collapse+truncation. objectql-conversation-service suite green (23).
  • End-to-end on the objectos-ee rig (the runtime loads the CJS build): a new chat "帮我建一个会议室预订系统" → conversation row title = "帮我建一个会议室预订系统"; the sidebar shows real titles instead of "新对话".

🤖 Generated with Claude Code

The console sidebar lists conversations straight off the `ai_conversations`
rows, so an untitled conversation renders a generic "New conversation"
label — and once a user has a handful, the list is a wall of identical
rows with no way to tell them apart or find one.

Set `title` from the first USER message the moment it lands, in
`addMessage`: collapse whitespace, cap at 60 chars. Deterministic, no extra
model call. Only seeds when the conversation has no title yet and the turn
is a user turn, so the optional LLM auto-titler still overwrites it with a
nicer title when enabled, and an explicit title is never clobbered.

Tests: untitled→titled, existing-title kept, assistant-first-turn ignored,
whitespace-collapse + truncation. Suite green (23).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Building Building Preview, Comment Jun 14, 2026 1:30pm

Request Review

@github-actions github-actions Bot added the tests label Jun 14, 2026
@xuyushun441-sys
xuyushun441-sys merged commit 2a47a28 into main Jun 14, 2026
11 of 12 checks passed
@xuyushun441-sys
xuyushun441-sys deleted the feat/ai-conversation-auto-title-first-message branch June 14, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants