fix: Correctly serialize filter plugin options for status display
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -143,20 +143,20 @@ fn build_filter_plugin_table(filter_plugins: &Vec<crate::common::status::FilterP
|
|||||||
let options_str = if plugin_info.options.is_empty() {
|
let options_str = if plugin_info.options.is_empty() {
|
||||||
"{}".to_string()
|
"{}".to_string()
|
||||||
} else {
|
} else {
|
||||||
// Convert options to a map for better display
|
// Convert options to a proper structure for display
|
||||||
let mut options_map = std::collections::BTreeMap::new();
|
let mut options_list = Vec::new();
|
||||||
for opt in &plugin_info.options {
|
for opt in &plugin_info.options {
|
||||||
let mut opt_map = std::collections::BTreeMap::new();
|
let mut opt_map = std::collections::BTreeMap::new();
|
||||||
opt_map.insert("name".to_string(), serde_yaml::Value::String(opt.name.clone()));
|
opt_map.insert("name".to_string(), serde_yaml::Value::String(opt.name.clone()));
|
||||||
if let Some(default) = &opt.default {
|
if let Some(default) = &opt.default {
|
||||||
opt_map.insert("default".to_string(), serde_yaml::Value::String(format!("{:?}", default)));
|
opt_map.insert("default".to_string(), default.clone());
|
||||||
} else {
|
} else {
|
||||||
opt_map.insert("default".to_string(), serde_yaml::Value::String("None".to_string()));
|
opt_map.insert("default".to_string(), serde_yaml::Value::Null);
|
||||||
}
|
}
|
||||||
opt_map.insert("required".to_string(), serde_yaml::Value::String(opt.required.to_string()));
|
opt_map.insert("required".to_string(), serde_yaml::Value::Bool(opt.required));
|
||||||
options_map.insert(opt.name.clone(), serde_yaml::Value::String(format!("{:?}", opt_map)));
|
options_list.push(serde_yaml::Value::Mapping(opt_map));
|
||||||
}
|
}
|
||||||
serde_yaml::to_string(&options_map)
|
serde_yaml::to_string(&serde_yaml::Value::Sequence(options_list))
|
||||||
.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