feat: show auto-generated conversation title for AI chat. (#17922)

## Summary
Replaces the static "Ask AI" header in the command menu with the
conversation’s auto-generated title once it’s set after the first
message.

## Changes
- **Backend:** Title is generated after the first user message (existing
behavior).
- **Frontend:** After the first stream completes, we fetch the thread
title and sync it to:
- `currentAIChatThreadTitleState` (persists across command menu
close/reopen)
- Command menu page info and navigation stack (so the title survives
back navigation)
- **Entry points:** Opening Ask AI from the left nav or command center
uses the same title resolution (explicit `pageTitle` → current thread
title → "Ask AI" fallback).
- **Race fix:** Title sync only runs when the thread that finished
streaming is still the active thread, so switching threads mid-stream
doesn’t overwrite the current thread’s title.

---------

Co-authored-by: Félix Malfait <felix@twenty.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Abdullah.
2026-02-17 17:46:35 +05:00
committed by GitHub
parent e80e9a6a25
commit 09e1684300
19 changed files with 219 additions and 53 deletions
@@ -40,7 +40,7 @@ describe('getCronTriggerDefaultSettings', () => {
it('throws an error for an invalid interval', () => {
// @ts-expect-error Testing invalid input
expect(() => getCronTriggerDefaultSettings('INVALID')).toThrowError(
expect(() => getCronTriggerDefaultSettings('INVALID')).toThrow(
'Invalid cron trigger interval',
);
});
@@ -32,7 +32,7 @@ describe('getWebhookTriggerDefaultSettings', () => {
it('throws an error for an invalid http method', () => {
// @ts-expect-error Testing invalid input
expect(() => getWebhookTriggerDefaultSettings('INVALID')).toThrowError(
expect(() => getWebhookTriggerDefaultSettings('INVALID')).toThrow(
'Invalid webhook http method',
);
});