mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
Refactor personality nudge eligibility
This commit is contained in:
@@ -3483,11 +3483,7 @@ impl ChatWidget {
|
||||
if !self.is_session_configured() {
|
||||
return;
|
||||
}
|
||||
if self.personality_nudge_hidden() {
|
||||
self.personality_nudge = PersonalityNudgeState::Idle;
|
||||
return;
|
||||
}
|
||||
if self.config.model_personality.is_some() || !self.current_model_supports_personality() {
|
||||
if !self.personality_nudge_is_eligible() {
|
||||
self.personality_nudge = PersonalityNudgeState::Idle;
|
||||
return;
|
||||
}
|
||||
@@ -3498,17 +3494,13 @@ impl ChatWidget {
|
||||
}
|
||||
|
||||
fn maybe_show_pending_personality_nudge(&mut self) {
|
||||
if self.personality_nudge_hidden() {
|
||||
if !self.personality_nudge_is_eligible() {
|
||||
self.personality_nudge = PersonalityNudgeState::Idle;
|
||||
return;
|
||||
}
|
||||
if !matches!(self.personality_nudge, PersonalityNudgeState::Pending) {
|
||||
return;
|
||||
}
|
||||
if self.config.model_personality.is_some() || !self.current_model_supports_personality() {
|
||||
self.personality_nudge = PersonalityNudgeState::Idle;
|
||||
return;
|
||||
}
|
||||
if !self.bottom_pane.no_modal_or_popup_active() {
|
||||
return;
|
||||
}
|
||||
@@ -3517,6 +3509,12 @@ impl ChatWidget {
|
||||
self.personality_nudge = PersonalityNudgeState::Shown;
|
||||
}
|
||||
|
||||
fn personality_nudge_is_eligible(&self) -> bool {
|
||||
!self.personality_nudge_hidden()
|
||||
&& self.config.model_personality.is_none()
|
||||
&& self.current_model_supports_personality()
|
||||
}
|
||||
|
||||
fn open_personality_nudge(&mut self) {
|
||||
let choose_actions: Vec<SelectionAction> = vec![Box::new(|tx| {
|
||||
tx.send(AppEvent::OpenPersonalityPopup);
|
||||
|
||||
Reference in New Issue
Block a user