Skip to content

Commit 72d63fa

Browse files
committed
Improvements to tool runner
1 parent e531e6e commit 72d63fa

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/widgets/tools/tools.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __init__(self, tool):
4040
if data.get('enum'):
4141
combo = Adw.ComboRow(
4242
name=name,
43-
title=name.title(),
43+
title=name.replace('_', ' ').title(),
4444
factory=factory
4545
)
4646
string_list = Gtk.StringList()
@@ -52,7 +52,7 @@ def __init__(self, tool):
5252
else:
5353
entry = Adw.EntryRow(
5454
name=name,
55-
title=name.title()
55+
title=name.replace('_', ' ').title()
5656
)
5757
self.parameter_elements.append(entry)
5858
pg.add(entry)
@@ -89,6 +89,8 @@ def __init__(self, tool):
8989
content_width=500
9090
)
9191
self.connect('closed', lambda *_: self.on_close())
92+
if len(self.parameter_elements) == 0:
93+
self.run_tool()
9294

9395
def on_close(self):
9496
SQL.delete_message(self.m_element_bot)
@@ -115,7 +117,9 @@ def start(self, arguments):
115117
attachment_type = 'tool',
116118
content = '\n'.join(attachment_content)
117119
)
118-
self.m_element_bot.main_stack.set_visible_child_name('content')
120+
self.m_element_bot.block_container.clear()
121+
self.m_element_bot.update_message(_('The tool would have generated a message in a chat.') if gen_request else _('The tool did not request to generate a message.'))
122+
GLib.idle_add(self.m_element_bot.main_stack.set_visible_child_name, 'content')
119123

120124
def run_tool(self):
121125
arguments = {}
@@ -1068,7 +1072,7 @@ def run(self, arguments, messages, bot_message) -> tuple:
10681072
SQL.insert_or_update_attachment(bot_message, attachment)
10691073
if self.pulling_model:
10701074
threading.Thread(target=self.pulling_model.update_progressbar, args=({'status': 'success'},)).start()
1071-
return False, "**Model Used: **{}\n\n**Status: **Background removed successfully!".format(model)
1075+
return False, "**Model Used: **{}\n**Status: **Background removed successfully!".format(model)
10721076
else:
10731077
return False, "Error: User didn't attach an image"
10741078
return False, "Error: Couldn't remove the image"

0 commit comments

Comments
 (0)