File tree Expand file tree Collapse file tree
apps/twig/src/renderer/features/sessions/hooks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ const log = logger.scope("chat-title-generator");
1313const REGENERATE_INTERVAL = 7 ;
1414
1515export function useChatTitleGenerator ( taskId : string ) : void {
16- const lastGeneratedAtCount = useRef ( 0 ) ;
16+ const lastGeneratedAtCount = useRef < number | null > ( null ) ;
1717 const isGenerating = useRef ( false ) ;
1818
1919 const promptCount = useSessionStore ( ( state ) => {
@@ -28,6 +28,11 @@ export function useChatTitleGenerator(taskId: string): void {
2828 if ( promptCount === 0 ) return ;
2929 if ( isGenerating . current ) return ;
3030
31+ if ( lastGeneratedAtCount . current === null ) {
32+ lastGeneratedAtCount . current = promptCount ;
33+ return ;
34+ }
35+
3136 const shouldGenerate =
3237 ( promptCount === 1 && lastGeneratedAtCount . current === 0 ) ||
3338 ( promptCount > 1 &&
You can’t perform that action at this time.
0 commit comments