feat: display effective plugin options including defaults
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -154,27 +154,57 @@ fn build_meta_plugins_configured_table(settings: &config::Settings) -> Option<Ta
|
|||||||
Err(_) => continue,
|
Err(_) => continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get the actual plugin with user-provided options to see the merged result
|
// First, create a default plugin to get its default options
|
||||||
|
let default_plugin = get_meta_plugin(
|
||||||
|
meta_plugin_type,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Start with the default options
|
||||||
|
let mut effective_options = default_plugin.options().clone();
|
||||||
|
|
||||||
|
// Merge with the configured options
|
||||||
|
for (key, value) in &plugin_config.options {
|
||||||
|
effective_options.insert(key.clone(), value.clone());
|
||||||
|
}
|
||||||
|
|
||||||
// Convert outputs from HashMap<String, String> to HashMap<String, serde_yaml::Value>
|
// Convert outputs from HashMap<String, String> to HashMap<String, serde_yaml::Value>
|
||||||
let outputs_converted: std::collections::HashMap<String, serde_yaml::Value> = plugin_config.outputs
|
let outputs_converted: std::collections::HashMap<String, serde_yaml::Value> = plugin_config.outputs
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(k, v)| (k.clone(), serde_yaml::Value::String(v.clone())))
|
.map(|(k, v)| (k.clone(), serde_yaml::Value::String(v.clone())))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
// Convert options from HashMap<String, serde_yaml::Value> to the correct type
|
// Create the actual plugin with merged options
|
||||||
let options_converted = plugin_config.options.clone();
|
|
||||||
|
|
||||||
let actual_plugin = get_meta_plugin(
|
let actual_plugin = get_meta_plugin(
|
||||||
meta_plugin_type,
|
meta_plugin_type,
|
||||||
Some(options_converted),
|
Some(effective_options.clone()),
|
||||||
Some(outputs_converted),
|
Some(outputs_converted),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Show the merged options
|
// Show the merged options including defaults set by the plugin
|
||||||
let options_str = if actual_plugin.options().is_empty() {
|
// Convert options to a YAML string, but handle formatting better
|
||||||
|
let mut options_to_serialize = actual_plugin.options().clone();
|
||||||
|
|
||||||
|
// For plugins that set default options programmatically, we need to include them
|
||||||
|
// Let's get the default plugin to see what options it would have
|
||||||
|
let default_plugin = get_meta_plugin(
|
||||||
|
meta_plugin_type,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Merge in default options from the plugin implementation
|
||||||
|
for (key, value) in default_plugin.options() {
|
||||||
|
if !options_to_serialize.contains_key(key) {
|
||||||
|
options_to_serialize.insert(key.clone(), value.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let options_str = if options_to_serialize.is_empty() {
|
||||||
"{}".to_string()
|
"{}".to_string()
|
||||||
} else {
|
} else {
|
||||||
serde_yaml::to_string(actual_plugin.options())
|
serde_yaml::to_string(&options_to_serialize)
|
||||||
.unwrap_or_else(|_| "Unable to serialize options".to_string())
|
.unwrap_or_else(|_| "Unable to serialize options".to_string())
|
||||||
.trim()
|
.trim()
|
||||||
.to_string()
|
.to_string()
|
||||||
|
|||||||
Reference in New Issue
Block a user