@@ -151,8 +151,12 @@ def _start_session(self, first_note: str) -> bool:
151151 self ._is_waiting_for_summary = False
152152
153153 # Schedule cleanup for the first message
154- self ._executor .submit (self ._cleanup_message_async , first_note ,
155- header_response ['ts' ], self ._current_session )
154+ self ._executor .submit (
155+ self ._cleanup_message_async ,
156+ first_note ,
157+ header_response ['ts' ],
158+ self ._current_session
159+ )
156160
157161 return True
158162 except SlackApiError as e :
@@ -220,19 +224,19 @@ def _update_replies(self, session: SessionState):
220224 # Update cleaned reply
221225 try :
222226 self .client .chat_update (
223- channel = session ['channel_id' ],
224- ts = session ['cleaned_reply_ts' ],
225- text = cleaned_content
227+ channel = session ['channel_id' ],
228+ ts = session ['cleaned_reply_ts' ],
229+ text = cleaned_content
226230 )
227231 except SlackApiError as e :
228232 logger .error (f"Error updating cleaned reply: { e } " )
229233
230234 # Update raw reply
231235 try :
232236 self .client .chat_update (
233- channel = session ['channel_id' ],
234- ts = session ['raw_reply_ts' ],
235- text = raw_content
237+ channel = session ['channel_id' ],
238+ ts = session ['raw_reply_ts' ],
239+ text = raw_content
236240 )
237241 except SlackApiError as e :
238242 logger .error (f"Error updating raw reply: { e } " )
@@ -261,25 +265,36 @@ def _send_note_to_thread(self, text: str, indent_level: int = 0) -> bool:
261265 if len (self ._current_session ['session_messages' ]) == 2 :
262266 try :
263267 header_text = f":wip: { self ._current_session ['last_summary' ]} :thread:"
264- self ._update_message (self ._current_session ['channel_id' ],
265- self ._current_session ['thread_ts' ], header_text )
268+ self ._update_message (
269+ self ._current_session ['channel_id' ],
270+ self ._current_session ['thread_ts' ],
271+ header_text ,
272+ )
266273 except SlackApiError as e :
267274 logger .error (f"Error updating header with thread indicator: { e } " )
268275
269276 # Update both reply messages
270277 self ._update_replies (self ._current_session )
271278
272279 # Schedule cleanup for this message
273- self ._executor .submit (self ._cleanup_message_async , formatted_text , msg_ts ,
274- self ._current_session )
280+ self ._executor .submit (
281+ self ._cleanup_message_async ,
282+ formatted_text ,
283+ msg_ts ,
284+ self ._current_session ,
285+ )
275286
276287 # Request summary with smart debouncing
277288 self ._request_summary_smart ()
278289
279290 return True
280291
281- def _cleanup_message_async (self , original_text : str , message_ts : str ,
282- session : SessionState ):
292+ def _cleanup_message_async (
293+ self ,
294+ original_text : str ,
295+ message_ts : str ,
296+ session : SessionState ,
297+ ):
283298 """Clean up a message using Claude in the background."""
284299 try :
285300 client = self ._get_anthropic_client ()
@@ -293,12 +308,12 @@ def _cleanup_message_async(self, original_text: str, message_ts: str,
293308Original text: { original_text } """
294309
295310 message = client .messages .create (
296- model = "claude-opus-4-1-20250805" ,
297- max_tokens = 5000 ,
298- temperature = 0.7 ,
299- messages = [
300- {"role" : "user" , "content" : prompt }
301- ]
311+ model = "claude-opus-4-1-20250805" ,
312+ max_tokens = 5000 ,
313+ temperature = 0.7 ,
314+ messages = [
315+ {"role" : "user" , "content" : prompt }
316+ ]
302317 )
303318
304319 cleaned_text = message .content [0 ].text .strip ()
@@ -334,12 +349,12 @@ def _summarize_session_async(self, version: int, session: SessionState):
334349{ thread_text } """
335350
336351 message = client .messages .create (
337- model = "claude-opus-4-1-20250805" ,
338- max_tokens = 200 ,
339- temperature = 0.7 ,
340- messages = [
341- {"role" : "user" , "content" : prompt }
342- ]
352+ model = "claude-opus-4-1-20250805" ,
353+ max_tokens = 200 ,
354+ temperature = 0.7 ,
355+ messages = [
356+ {"role" : "user" , "content" : prompt }
357+ ]
343358 )
344359
345360 summary = message .content [0 ].text .strip ()
@@ -473,4 +488,4 @@ def handle_disconnect(self) -> None:
473488 def __del__ (self ):
474489 """Cleanup executor and timer on deletion."""
475490 self ._executor .shutdown (wait = False )
476- self ._summary_timer .cancel ()
491+ self ._summary_timer .cancel ()
0 commit comments