Fix: first chat was not shown

This commit is contained in:
jeffser 2024-06-30 17:11:40 -06:00
parent 80fea3a3b5
commit 1da347ff2f

View File

@ -54,7 +54,7 @@ class AlpacaWindow(Adw.ApplicationWindow):
model_tweaks = {"temperature": 0.7, "seed": 0, "keep_alive": 5} model_tweaks = {"temperature": 0.7, "seed": 0, "keep_alive": 5}
local_models = [] local_models = []
pulling_models = {} pulling_models = {}
chats = {"chats": {_("New Chat"): {"messages": {}}}, "selected_chat": "New Chat"} chats = {"chats": {_("New Chat"): {"messages": {}}}, "selected_chat": "New Chat", "order": []}
attachments = {} attachments = {}
#Override elements #Override elements
@ -495,7 +495,7 @@ Generate a title following these rules:
- Keep it in the same language as the prompt - Keep it in the same language as the prompt
- The title needs to be less than 30 characters - The title needs to be less than 30 characters
- Use only alphanumeric characters and spaces - Use only alphanumeric characters and spaces
- Just write the title, nothing else - Just write the title, NOTHING ELSE
```PROMPT ```PROMPT
{message['content']} {message['content']}
@ -981,8 +981,13 @@ Generate a title following these rules:
for chat_name in self.chats["chats"].keys(): for chat_name in self.chats["chats"].keys():
self.chats["order"].append(chat_name) self.chats["order"].append(chat_name)
except Exception as e: except Exception as e:
self.chats = {"chats": {_("New Chat"): {"messages": {}}}, "selected_chat": _("New Chat")} self.chats = {"chats": {}, "selected_chat": None, "order": []}
self.load_history_into_chat() self.new_chat()
else:
self.chats = {"chats": {}, "selected_chat": None, "order": []}
self.new_chat()
self.load_history_into_chat()
def generate_numbered_name(self, chat_name:str, compare_list:list) -> str: def generate_numbered_name(self, chat_name:str, compare_list:list) -> str:
if chat_name in compare_list: if chat_name in compare_list:
@ -1135,7 +1140,6 @@ Generate a title following these rules:
connection_handler.url = f"http://127.0.0.1:{local_instance.port}" connection_handler.url = f"http://127.0.0.1:{local_instance.port}"
local_instance.start() local_instance.start()
if self.verify_connection() == False: self.connection_error() if self.verify_connection() == False: self.connection_error()
self.update_list_available_models()
def on_replace_contents(self, file, result): def on_replace_contents(self, file, result):
file.replace_contents_finish(result) file.replace_contents_finish(result)