style: format command alias and deferred tool integrations
This commit is contained in:
@@ -754,9 +754,9 @@ pub fn auto_model_heuristic_with_bias(
|
||||
"\u{5206}\u{6790}", // 分析
|
||||
"\u{5be6}\u{73fe}", // 實現
|
||||
];
|
||||
let strong_match = COMPLEX_KEYWORDS.iter().any(|kw| {
|
||||
!borderline_pro_keywords.contains(kw) && lower.contains(kw)
|
||||
});
|
||||
let strong_match = COMPLEX_KEYWORDS
|
||||
.iter()
|
||||
.any(|kw| !borderline_pro_keywords.contains(kw) && lower.contains(kw));
|
||||
let borderline_match = borderline_pro_keywords.iter().any(|kw| lower.contains(kw));
|
||||
let pro_match = strong_match || (!cost_saving && borderline_match);
|
||||
if pro_match {
|
||||
|
||||
@@ -503,7 +503,10 @@ fn deferred_tool_schema_hydration_result(tool: &Tool, tool_input: &Value) -> Too
|
||||
} else {
|
||||
""
|
||||
};
|
||||
lines.push(format!(" {}: {}{}", field.name, field.kind, required_marker));
|
||||
lines.push(format!(
|
||||
" {}: {}{}",
|
||||
field.name, field.kind, required_marker
|
||||
));
|
||||
}
|
||||
}
|
||||
lines.push(String::new());
|
||||
@@ -531,8 +534,7 @@ fn deferred_tool_schema_hydration_result(tool: &Tool, tool_input: &Value) -> Too
|
||||
}
|
||||
}
|
||||
|
||||
ToolResult::success(lines.join("\n"))
|
||||
.with_metadata(json!({
|
||||
ToolResult::success(lines.join("\n")).with_metadata(json!({
|
||||
"event": "tool.schema_hydrated",
|
||||
"tool": tool.name,
|
||||
"executed": false,
|
||||
|
||||
@@ -2065,34 +2065,35 @@ pub(crate) fn slash_completion_hints(
|
||||
let prefix_lower = prefix.to_ascii_lowercase();
|
||||
for name in commands::all_command_names_matching(prefix, workspace) {
|
||||
let command_key = name.trim_start_matches('/');
|
||||
let (description, alias_hint) = if let Some(info) = commands::get_command_info(command_key) {
|
||||
// Detect matching alias: if the user typed via pinyin rather
|
||||
// than the canonical name, record which alias matched.
|
||||
let hint = if !command_key.to_ascii_lowercase().starts_with(&prefix_lower) {
|
||||
info.aliases
|
||||
.iter()
|
||||
.find(|a| a.to_ascii_lowercase().starts_with(&prefix_lower))
|
||||
.map(|a| a.to_string())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let desc = if info.aliases.is_empty() {
|
||||
info.description_for(locale).to_string()
|
||||
} else {
|
||||
format!(
|
||||
"{} (aliases: {})",
|
||||
info.description_for(locale),
|
||||
let (description, alias_hint) =
|
||||
if let Some(info) = commands::get_command_info(command_key) {
|
||||
// Detect matching alias: if the user typed via pinyin rather
|
||||
// than the canonical name, record which alias matched.
|
||||
let hint = if !command_key.to_ascii_lowercase().starts_with(&prefix_lower) {
|
||||
info.aliases
|
||||
.iter()
|
||||
.map(|a| format!("/{a}"))
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ")
|
||||
)
|
||||
.find(|a| a.to_ascii_lowercase().starts_with(&prefix_lower))
|
||||
.map(|a| a.to_string())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let desc = if info.aliases.is_empty() {
|
||||
info.description_for(locale).to_string()
|
||||
} else {
|
||||
format!(
|
||||
"{} (aliases: {})",
|
||||
info.description_for(locale),
|
||||
info.aliases
|
||||
.iter()
|
||||
.map(|a| format!("/{a}"))
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ")
|
||||
)
|
||||
};
|
||||
(desc, hint)
|
||||
} else {
|
||||
(String::from("User-defined command"), None)
|
||||
};
|
||||
(desc, hint)
|
||||
} else {
|
||||
(String::from("User-defined command"), None)
|
||||
};
|
||||
entries.push(SlashMenuEntry {
|
||||
name,
|
||||
description,
|
||||
|
||||
Reference in New Issue
Block a user