Skip to content

refactor: carefully set model from session - #98

Merged
sudo-tee merged 1 commit into
sudo-tee:mainfrom
cameronr:refactor/model-init
Nov 4, 2025
Merged

sudo-tee merged 1 commit into
sudo-tee:mainfrom
cameronr:refactor/model-init

Conversation

@cameronr

@cameronr cameronr commented Nov 4, 2025

Copy link
Copy Markdown
Collaborator

When loading a session, clear state.current_model and set it to the model used by the most recent message.

Topbar shouldn't set a model as a side effect, it should just display what's been selected.

Add core.initialize_current_model() which will initialize state.current_model to the default from the config_file if it hasn't been set

I think this achieves the behavior described in #96 (comment):

  • If you load a session, it will set state.current_model to the model most recently used in that session
  • If you create a new session, state.current_model will get re-initialized to the default
  • Rerendering a session won't change state.current_model

When loading a session, clear state.current_model and set it to the
model used by the most recent message.

Topbar shouldn't set a model as a side effect, it should just display
what's been selected.

Add `core.initialize_current_model()` which will initialize
state.current_model to the default from the config_file if it hasn't
been set
@sudo-tee

sudo-tee commented Nov 4, 2025

Copy link
Copy Markdown
Owner

Thanks for having a look at this.

I wanted to have a look pretty soon. You beat me to it 😁.

@sudo-tee
sudo-tee merged commit 94ce86a into sudo-tee:main Nov 4, 2025
5 checks passed
@cameronr
cameronr deleted the refactor/model-init branch November 6, 2025 01:22
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