feat(ai): add panel shortcut and conversation restore

This commit is contained in:
二丫讲梵 authored and GitHub committed 2026-09-08 22:34:26 +08:00
1 parent b70d4153a4
commit 798733fd29
23 files changed
+165 -2

No files matched your search

+4
View File
@@ -313,6 +313,9 @@ pub struct AiChatSelectionState {
pub effort_preferences: Vec<AiModelEffortPreference>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub default_mode: Option<AiAssistantMode>,
/// Whether opening the AI panel should restore the most recently updated conversation.
#[serde(default)]
pub restore_last_conversation: bool,
/// Prompt template ids auto-applied when the AI panel opens, keyed by
/// connection db_type. BTreeMap keeps serialized key order stable.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
@@ -330,6 +333,7 @@ impl Default for AiChatSelectionState {
active: None,
effort_preferences: Vec::new(),
default_mode: None,
restore_last_conversation: false,
default_templates_by_db_type: BTreeMap::new(),
last_used_templates_by_db_type: BTreeMap::new(),
}
+1
View File
@@ -7400,6 +7400,7 @@ mod tests {
selection: AiEffortSelection::Enum("high".to_string()),
}],
default_mode: Some(AiAssistantMode::Agent),
restore_last_conversation: true,
default_templates_by_db_type: BTreeMap::from([("postgresql".to_string(), vec!["tpl-1".to_string()])]),
last_used_templates_by_db_type: BTreeMap::from([("mysql".to_string(), vec!["tpl-2".to_string()])]),
};