aboutsummaryrefslogtreecommitdiffstats
path: root/crates/atuin-ai/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/atuin-ai/src')
-rw-r--r--crates/atuin-ai/src/commands/inline.rs26
1 files changed, 18 insertions, 8 deletions
diff --git a/crates/atuin-ai/src/commands/inline.rs b/crates/atuin-ai/src/commands/inline.rs
index e0ee05d6..7cfacc77 100644
--- a/crates/atuin-ai/src/commands/inline.rs
+++ b/crates/atuin-ai/src/commands/inline.rs
@@ -4,6 +4,7 @@ use crate::tui::{
App, AppEvent, AppMode, ConversationEvent, EventLoop, ExitAction, RenderContext, TerminalGuard,
calculate_needed_height, install_panic_hook,
};
+use atuin_client::distro::detect_linux_distribution;
use atuin_client::theme::ThemeManager;
use atuin_common::tls::ensure_crypto_provider;
use crossterm::{
@@ -185,16 +186,25 @@ fn create_chat_stream(
debug!("Sending SSE request to {endpoint}");
+ let os = detect_os();
+ let shell = detect_shell();
+
+ let mut context = serde_json::json!({
+ "os": os,
+ "shell": shell,
+ "pwd": if send_cwd { std::env::current_dir()
+ .ok()
+ .map(|path| path.to_string_lossy().into_owned()) } else { None },
+ });
+
+ if os == "linux" {
+ context["distro"] = serde_json::json!(detect_linux_distribution());
+ }
+
// Build request body
let mut request_body = serde_json::json!({
"messages": messages,
- "context": {
- "os": detect_os(),
- "shell": detect_shell(),
- "pwd": if send_cwd { std::env::current_dir()
- .ok()
- .map(|path| path.to_string_lossy().into_owned()) } else { None },
- }
+ "context": context,
});
// Include session_id only if present (not on first request)
@@ -331,7 +341,7 @@ fn detect_os() -> String {
"macos" => "macos".to_string(),
"linux" => "linux".to_string(),
"windows" => "windows".to_string(),
- _ => "linux".to_string(),
+ other => format!("Other: {other}"),
}
}