File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/hooks/keyword-detector Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ export * from "./detector"
66export * from "./constants"
77export * from "./types"
88
9+ const sessionFirstMessageProcessed = new Set < string > ( )
10+
911export function createKeywordDetectorHook ( ) {
1012 return {
1113 "chat.message" : async (
@@ -20,6 +22,14 @@ export function createKeywordDetectorHook() {
2022 parts : Array < { type : string ; text ?: string ; [ key : string ] : unknown } >
2123 }
2224 ) : Promise < void > => {
25+ const isFirstMessage = ! sessionFirstMessageProcessed . has ( input . sessionID )
26+ sessionFirstMessageProcessed . add ( input . sessionID )
27+
28+ if ( isFirstMessage ) {
29+ log ( "Skipping keyword detection on first message for title generation" , { sessionID : input . sessionID } )
30+ return
31+ }
32+
2333 const promptText = extractPromptText ( output . parts )
2434 const messages = detectKeywords ( promptText )
2535
You can’t perform that action at this time.
0 commit comments