Save a default model per user, set from Settings

This commit is contained in:
Ian Gulliver
2026-10-18 00:57:51 -07:00
parent 17f09ecb7c
commit 10c6c84f74
10 changed files with 395 additions and 257 deletions
+4 -2
View File
@@ -474,6 +474,8 @@ DELETE FROM inbox_responses WHERE item_id IN (SELECT id FROM inbox_items WHERE k
DELETE FROM inbox_items WHERE kind = 'client_run';
ALTER TABLE inbox_responses DROP COLUMN client;
ALTER TABLE inbox_responses DROP COLUMN exit_code;
`}, {"add-user-default-model", `
ALTER TABLE users ADD COLUMN default_model TEXT NOT NULL DEFAULT 'claude-opus-5-5';
`}}
const (
@@ -674,8 +676,8 @@ func (s *Store) EnsureUser(ctx context.Context, login, displayName string) (api.
func (s *Store) GetUser(ctx context.Context, login string) (api.User, error) {
u := api.User{}
prefs := ""
err := s.db.QueryRowContext(ctx, `SELECT login, display_name, git_name, git_email, notification_prefs FROM users WHERE login = ?`, login).
Scan(&u.Login, &u.DisplayName, &u.GitName, &u.GitEmail, &prefs)
err := s.db.QueryRowContext(ctx, `SELECT login, display_name, git_name, git_email, notification_prefs, default_model FROM users WHERE login = ?`, login).
Scan(&u.Login, &u.DisplayName, &u.GitName, &u.GitEmail, &prefs, &u.DefaultModel)
if errors.Is(err, sql.ErrNoRows) {
return u, ErrNotFound
}