chore(config) personality as a feature (#10116)

## Summary
Sets up an explicit Feature flag for `/personality`, so users can now
opt in to it via `/experimental`. #10114 also updates the config

## Testing
- [x] Tested locally
This commit is contained in:
Dylan Hurd authored and GitHub committed 2026-01-28 17:58:28 -07:00
1 parent 26590d7927
commit ce3d764ae1
7 files changed
+51 -18

No files matched your search

+18 -14
View File
@@ -2892,6 +2892,7 @@ impl ChatWidget {
let personality = self
.config
.model_personality
.filter(|_| self.config.features.enabled(Feature::Personality))
.filter(|_| self.current_model_supports_personality());
let op = Op::UserTurn {
items,
@@ -3455,19 +3456,23 @@ impl ChatWidget {
);
return;
}
if !self.current_model_supports_personality() {
let current_model = self.current_model();
self.add_error_message(format!(
"Current model ({current_model}) doesn't support personalities. Try /model to pick a different model."
));
return;
}
self.open_personality_popup_for_current_model();
}
fn open_personality_popup_for_current_model(&mut self) {
let current_model = self.current_model();
let current_personality = self.config.model_personality;
let current_personality = self
.config
.model_personality
.unwrap_or(Personality::Friendly);
let personalities = [Personality::Friendly, Personality::Pragmatic];
let supports_personality = self.current_model_supports_personality();
let disabled_message = (!supports_personality).then(|| {
format!(
"Current model ({current_model}) doesn't support personalities. Try /model to switch to a newer model."
)
});
let items: Vec<SelectionItem> = personalities
.into_iter()
@@ -3492,7 +3497,7 @@ impl ChatWidget {
SelectionItem {
name,
description,
is_current: current_personality == Some(personality),
is_current: current_personality == personality,
is_disabled: !supports_personality,
actions,
dismiss_on_select: true,
@@ -3504,11 +3509,8 @@ impl ChatWidget {
let mut header = ColumnRenderable::new();
header.push(Line::from("Select Personality".bold()));
header.push(Line::from(
"Choose a communication style for future responses.".dim(),
"Choose a communication style for Codex. Disable in /experimental.".dim(),
));
if let Some(message) = disabled_message {
header.push(Line::from(message.red()));
}
self.bottom_pane.show_selection_view(SelectionViewParams {
header: Box::new(header),
@@ -4714,6 +4716,9 @@ impl ChatWidget {
self.refresh_model_display();
self.request_redraw();
}
if feature == Feature::Personality {
self.sync_personality_command_enabled();
}
#[cfg(target_os = "windows")]
if matches!(
feature,
@@ -4780,7 +4785,6 @@ impl ChatWidget {
mask.model = Some(model.to_string());
}
self.refresh_model_display();
self.sync_personality_command_enabled();
}
pub(crate) fn current_model(&self) -> &str {
@@ -4795,7 +4799,7 @@ impl ChatWidget {
fn sync_personality_command_enabled(&mut self) {
self.bottom_pane
.set_personality_command_enabled(self.current_model_supports_personality());
.set_personality_command_enabled(self.config.features.enabled(Feature::Personality));
}
fn current_model_supports_personality(&self) -> bool {