cosmetic tool call stuff

This commit is contained in:
Dhanji Prasanna
2025-10-10 14:18:35 +11:00
parent 426a9b88a9
commit 57b7bcb0de
2 changed files with 32 additions and 31 deletions

View File

@@ -249,7 +249,7 @@ fn extract_readme_heading(readme_content: &str) -> Option<String> {
// Process the content line by line, skipping the prefix line if present
let lines_iter = readme_content.lines();
let mut content_lines = Vec::new();
for line in lines_iter {
// Skip the "📚 Project README (from ...):" line
if line.starts_with("📚 Project README") {
@@ -258,11 +258,11 @@ fn extract_readme_heading(readme_content: &str) -> Option<String> {
content_lines.push(line);
}
let content = content_lines.join("\n");
// Look for the first markdown heading
for line in content.lines() {
let trimmed = line.trim();
// Check for H1 heading (# Title)
if trimmed.starts_with("# ") {
let title = trimmed[2..].trim();
@@ -271,17 +271,21 @@ fn extract_readme_heading(readme_content: &str) -> Option<String> {
return Some(title.to_string());
}
}
// Skip other markdown headings for now (##, ###, etc.)
// We're only looking for the main H1 heading
}
// If no H1 heading found, look for the first non-empty, non-metadata line as a fallback
for line in content.lines().take(5) {
let trimmed = line.trim();
// Skip empty lines, other heading markers, and metadata
if !trimmed.is_empty() && !trimmed.starts_with("📚") && !trimmed.starts_with('#')
&& !trimmed.starts_with("==") && !trimmed.starts_with("--") {
if !trimmed.is_empty()
&& !trimmed.starts_with("📚")
&& !trimmed.starts_with('#')
&& !trimmed.starts_with("==")
&& !trimmed.starts_with("--")
{
// Limit length for display
return Some(if trimmed.len() > 100 {
format!("{}...", &trimmed[..97])
@@ -334,7 +338,10 @@ async fn run_interactive_retro(
} else {
"PROJECT DOCUMENTATION LOADED".to_string()
};
tui.output(&format!("SYSTEM: PROJECT README LOADED - {}\n\n", readme_snippet));
tui.output(&format!(
"SYSTEM: PROJECT README LOADED - {}\n\n",
readme_snippet
));
}
tui.output("SYSTEM: READY FOR INPUT\n\n");
tui.output("\n\n");
@@ -561,27 +568,10 @@ async fn run_interactive<W: UiWriter>(
let output = SimpleOutput::new();
output.print("");
output.print("🪿 G3 AI Coding Agent - Interactive Mode");
output.print("I solve problems by writing and executing code. what shall we build today?");
output.print("🪿 G3 AI Coding Agent");
output.print(" >> what shall we build today?");
output.print("");
// Display message if README was loaded
if readme_content.is_some() {
// Extract the first heading or title from the README
let readme_snippet = if let Some(ref content) = readme_content {
extract_readme_heading(content)
.unwrap_or_else(|| "Project documentation loaded".to_string())
} else {
"Project documentation loaded".to_string()
};
output.print(&format!("📚 Project README loaded: {}", readme_snippet));
if readme_snippet.len() > 80 {
output.print(" (Full README available in context)");
}
output.print("");
}
// Display provider and model information
match agent.get_provider_info() {
Ok((provider, model)) => {
@@ -592,8 +582,19 @@ async fn run_interactive<W: UiWriter>(
}
}
output.print("");
output.print("CTRL-D to quit; ↑/↓ for history");
// Display message if README was loaded
if readme_content.is_some() {
// Extract the first heading or title from the README
let readme_snippet = if let Some(ref content) = readme_content {
extract_readme_heading(content)
.unwrap_or_else(|| "Project documentation loaded".to_string())
} else {
"Project documentation loaded".to_string()
};
output.print(&format!("📚 detected: {}", readme_snippet));
}
output.print("");
// Initialize rustyline editor with history