Save a default model per user, set from Settings
This commit is contained in:
@@ -25,3 +25,17 @@ func (s *Store) UpdateNotificationPrefs(ctx context.Context, login string, prefs
|
||||
}
|
||||
return s.GetUser(ctx, login)
|
||||
}
|
||||
|
||||
func (s *Store) UpdateDefaultModel(ctx context.Context, login, model string) (api.User, error) {
|
||||
err := s.write(ctx, func(tx *sql.Tx, emit emitFunc) error {
|
||||
_, err := tx.ExecContext(ctx, `UPDATE users SET default_model = ? WHERE login = ?`, model, login)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return emit(api.Event{Kind: "user.updated", Actor: login, Payload: map[string]any{"login": login}})
|
||||
})
|
||||
if err != nil {
|
||||
return api.User{}, err
|
||||
}
|
||||
return s.GetUser(ctx, login)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user