Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch loaded model upon chat change #134

Merged
merged 6 commits into from
Jul 8, 2024

Conversation

jmbejar
Copy link
Collaborator

@jmbejar jmbejar commented Jul 3, 2024

When the user switches to another chat conversation, the last used model is automatically loaded.

In addition, there are two bug fixes:

  • Save & Regenerate buttons were visible for AI messages, which was wrong (issue introduced when changed to use Makepad buttons).
  • Fixed weird issue when chat messages were not appearing at all (the problems was the scroll position of the messages PortalList when coming from a longest conversation).
  • Check if changes would break existing users because of the chat persistence.
    Note about existing users: Chat conversations persisted with earlier versions of the app won't auto-select the last used model because this piece of data was never stored. We could use the model used in the first interaction but it doesn't seem to worth adding more code to cover such case. As far the conversation are updated, they will be persisted in our new format and the app will behave in the new way.

@jmbejar jmbejar marked this pull request as ready for review July 3, 2024 19:50
@jmbejar jmbejar force-pushed the switch-loaded-model-upon-chat-change branch from 1d821a8 to 03e71e6 Compare July 8, 2024 14:20
Copy link
Collaborator

@noxware noxware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

left two small unimportant comments

src/chat/chat_panel.rs Outdated Show resolved Hide resolved
}
}
}

pub fn select_chat(&mut self, chat_id: ChatID) {
self.chats.set_current_chat(chat_id);

if let Some(file_id) = self.get_last_used_file_id_in_current_chat() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: maybe we can extract this chunk of added code to a function called self.load_last_model_for_current_chat() and call it here. Just for the sake of having smaller and self documented functions.

noxware
noxware previously approved these changes Jul 8, 2024
Co-authored-by: Franco Profeti <7684329+noxware@users.noreply.github.com>
@jmbejar jmbejar merged commit 09961f7 into main Jul 8, 2024
@jmbejar jmbejar deleted the switch-loaded-model-upon-chat-change branch July 8, 2024 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants