Add Chat Completions API support and expand REPL debugging

- Add NearAiChatProvider using /v1/chat/completions endpoint with API key auth
- Add NEARAI_API_KEY and NEARAI_API_MODE config options
- Auto-detect API mode from presence of API key
- Keep existing Responses API (NearAiProvider) for session-based auth
- Fix response parsing to accept input_text/output_text/text content types
- Expand REPL with /help, /debug toggle, colored output
- Better tool status display (dots vs verbose based on debug mode)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
This commit is contained in:
Illia Polosukhin
2026-02-03 21:55:05 -08:00
co-authored by Claude Opus 4.5
parent 74d94d33b0
commit 7ef6362d83
8 changed files with 665 additions and 42 deletions
+7 -2
View File
@@ -142,12 +142,17 @@ async fn main() -> anyhow::Result<()> {
}
Ok(_) => {
let _ = event_tx
.send(AppEvent::ErrorMessage("No models available from API".into()))
.send(AppEvent::ErrorMessage(
"No models available from API".into(),
))
.await;
}
Err(e) => {
let _ = event_tx
.send(AppEvent::ErrorMessage(format!("Failed to fetch models: {}", e)))
.send(AppEvent::ErrorMessage(format!(
"Failed to fetch models: {}",
e
)))
.await;
}
}