Added check for title generation
This commit is contained in:
parent
b66e2102d3
commit
bd006da0c1
@ -682,10 +682,10 @@ Generate a title following these rules:
|
|||||||
if 'images' in message:
|
if 'images' in message:
|
||||||
data["images"] = message['images']
|
data["images"] = message['images']
|
||||||
response = connection_handler.simple_post(f"{connection_handler.URL}/api/generate", data=json.dumps(data))
|
response = connection_handler.simple_post(f"{connection_handler.URL}/api/generate", data=json.dumps(data))
|
||||||
|
if response.status_code == 200:
|
||||||
new_chat_name = json.loads(response.text)["response"].strip().removeprefix("Title: ").removeprefix("title: ").strip('\'"').replace('\n', ' ').title().replace('\'S', '\'s')
|
new_chat_name = json.loads(response.text)["response"].strip().removeprefix("Title: ").removeprefix("title: ").strip('\'"').replace('\n', ' ').title().replace('\'S', '\'s')
|
||||||
new_chat_name = new_chat_name[:50] + (new_chat_name[50:] and '...')
|
new_chat_name = new_chat_name[:50] + (new_chat_name[50:] and '...')
|
||||||
self.rename_chat(label_element.get_name(), new_chat_name, label_element)
|
self.rename_chat(label_element.get_name(), new_chat_name, label_element)
|
||||||
|
|
||||||
def show_message(self, msg:str, bot:bool, footer:str=None, images:list=None, files:dict=None, message_id:str=None):
|
def show_message(self, msg:str, bot:bool, footer:str=None, images:list=None, files:dict=None, message_id:str=None):
|
||||||
message_text = Gtk.TextView(
|
message_text = Gtk.TextView(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user