fix: add hostname metadata to response
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -237,8 +237,6 @@ impl MetaPlugin for HostnameMetaPlugin {
|
||||
};
|
||||
}
|
||||
|
||||
let metadata = Vec::new();
|
||||
|
||||
// Get the full hostname
|
||||
let full_hostname = self.get_hostname();
|
||||
let short_hostname = full_hostname.split('.').next().unwrap_or(&full_hostname).to_string();
|
||||
@@ -263,6 +261,20 @@ impl MetaPlugin for HostnameMetaPlugin {
|
||||
String::new()
|
||||
};
|
||||
|
||||
// Prepare metadata to return
|
||||
let mut metadata = Vec::new();
|
||||
|
||||
// Add enabled metadata to the response
|
||||
if hostname_enabled {
|
||||
metadata.push(("hostname".to_string(), serde_yaml::Value::String(hostname_value.clone())));
|
||||
}
|
||||
if hostname_full_enabled {
|
||||
metadata.push(("hostname_full".to_string(), serde_yaml::Value::String(full_hostname.clone())));
|
||||
}
|
||||
if hostname_short_enabled {
|
||||
metadata.push(("hostname_short".to_string(), serde_yaml::Value::String(short_hostname.clone())));
|
||||
}
|
||||
|
||||
// Update outputs based on enabled status
|
||||
// Handle hostname output
|
||||
if hostname_enabled {
|
||||
@@ -276,7 +288,7 @@ impl MetaPlugin for HostnameMetaPlugin {
|
||||
// Handle hostname_full output
|
||||
if hostname_full_enabled {
|
||||
if let Some(output_value) = self.outputs.get_mut("hostname_full") {
|
||||
*output_value = serde_yaml::Value::String(full_hostname.clone());
|
||||
*output_value = serde_yaml::Value::String(full_hostname);
|
||||
}
|
||||
} else {
|
||||
self.outputs.insert("hostname_full".to_string(), serde_yaml::Value::Null);
|
||||
|
||||
Reference in New Issue
Block a user