Skip to content

Commit 6dcb2f9

Browse files
committed
Skip title generation on task mount
1 parent 55103f3 commit 6dcb2f9

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

apps/twig/src/renderer/features/sessions/hooks/useChatTitleGenerator.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const log = logger.scope("chat-title-generator");
1313
const REGENERATE_INTERVAL = 7;
1414

1515
export 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 &&

0 commit comments

Comments
 (0)