Skip to content

Commit a46440b

Browse files
committed
chore: implement review comment
1 parent 77a17b7 commit a46440b

4 files changed

Lines changed: 24 additions & 15 deletions

File tree

basilisk/completion_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ def __init__(
5959
"""Initialize the completion handler.
6060
6161
Args:
62-
parent: The parent window for displaying error dialogs
6362
on_completion_start: Callback called when completion starts
6463
on_completion_end: Callback called when completion ends (success flag)
6564
on_stream_chunk: Callback called for each streaming chunk
@@ -127,6 +126,7 @@ def stop_completion(self):
127126
self._stop_completion = True
128127
logger.debug("Stopping completion task: %s", self.task.ident)
129128
self.task.join(timeout=1)
129+
if self.on_completion_end:
130130
wx.CallAfter(self.on_completion_end, False)
131131

132132
def is_running(self) -> bool:

basilisk/gui/conversation_tab.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,6 @@ def on_stop_completion(self, event: wx.CommandEvent):
661661
"""
662662
self.completion_handler.stop_completion()
663663

664-
self._stop_completion = False
665-
666664
def generate_conversation_title(self):
667665
"""Generate a title for the conversation tab by using the AI model to analyze the conversation content.
668666

basilisk/gui/edit_block_dialog.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def init_ui(self):
227227
btn_sizer.AddButton(wx.Button(self, wx.ID_CANCEL))
228228

229229
self.Bind(wx.EVT_BUTTON, self.on_ok, id=wx.ID_OK)
230-
self.Bind(wx.EVT_BUTTON, self.on_cancxel, id=wx.ID_CANCEL)
230+
self.Bind(wx.EVT_BUTTON, self.on_cancel, id=wx.ID_CANCEL)
231231

232232
btn_sizer.Realize()
233233

@@ -354,7 +354,7 @@ def on_ok(self, event: wx.CommandEvent):
354354
self.block.response.content = self.response_txt.GetValue()
355355
event.Skip()
356356

357-
def on_cancxel(self, event: wx.CommandEvent):
357+
def on_cancel(self, event: wx.CommandEvent):
358358
"""Handle the Cancel button click.
359359
360360
Closes the dialog without saving changes.

basilisk/gui/prompt_attachments_panel.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,8 @@ def add_attachment_from_url(self, url: str):
445445
)
446446
return
447447
except Exception as err:
448+
if isinstance(err, (KeyboardInterrupt, SystemExit)):
449+
raise
448450
log.error(err, exc_info=True)
449451
wx.CallAfter(
450452
wx.MessageBox,
@@ -476,7 +478,7 @@ def on_show_attachment_details(self, event: wx.CommandEvent):
476478
Args:
477479
event: Event triggered by the show attachment details action
478480
"""
479-
current_attachment = self.selected_attachment_file()
481+
current_attachment = self.selected_attachment_file
480482
if not current_attachment:
481483
return
482484

@@ -507,7 +509,7 @@ def on_attachments_remove(self, event: wx.CommandEvent):
507509
event: Event triggered by the remove attachment action
508510
"""
509511
selection = self.attachments_list.GetFirstSelected()
510-
current_attachment = self.selected_attachment_file()
512+
current_attachment = self.selected_attachment_file
511513
if not current_attachment:
512514
return
513515

@@ -530,11 +532,11 @@ def on_copy_attachment_location(self, event: wx.CommandEvent):
530532
Args:
531533
event: Event triggered by the copy attachment location action
532534
"""
533-
current_attachment = self.selected_attachment_file()
535+
current_attachment = self.selected_attachment_file
534536
if not current_attachment:
535537
return
536538

537-
location = "\"%s\"" % str(current_attachment.location)
539+
location = f'"{current_attachment.location}"'
538540
with wx.TheClipboard as clipboard:
539541
clipboard.SetData(wx.TextDataObject(location))
540542

@@ -704,12 +706,21 @@ def resize_all_attachments(self):
704706
for attachment in self.attachment_files:
705707
if not attachment.mime_type.startswith("image/"):
706708
continue
707-
attachment.resize(
708-
self.conv_storage_path,
709-
config.conf().images.max_width,
710-
config.conf().images.max_height,
711-
config.conf().images.quality,
712-
)
709+
try:
710+
attachment.resize(
711+
self.conv_storage_path,
712+
config.conf().images.max_width,
713+
config.conf().images.max_height,
714+
config.conf().images.quality,
715+
)
716+
except Exception as e:
717+
log.error(
718+
"Error resizing image attachment %s: %s",
719+
attachment.location,
720+
e,
721+
exc_info=True,
722+
)
723+
continue
713724

714725
def ensure_model_compatibility(
715726
self, current_model: ProviderAIModel | None

0 commit comments

Comments
 (0)