Skip to content

Commit b621594

Browse files
committed
feat: save review to ~/.config/arxiv-explorer/reviews/ on generation
1 parent 79ced0a commit b621594

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

tui-rs/src/commands/ai.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,28 @@ pub fn run_translate(tx: mpsc::UnboundedSender<AppEvent>, job_id: String, arxiv_
7171

7272
pub fn run_review(tx: mpsc::UnboundedSender<AppEvent>, job_id: String, arxiv_id: String) {
7373
tokio::spawn(async move {
74+
// Save review to ~/.config/arxiv-explorer/reviews/<id>_review.md
75+
let config_dir = dirs::config_dir()
76+
.unwrap_or_else(|| std::path::PathBuf::from("."))
77+
.join("arxiv-explorer")
78+
.join("reviews");
79+
let _ = tokio::fs::create_dir_all(&config_dir).await;
80+
let normalized = arxiv_id.replace("/", "_");
81+
let out_path = config_dir.join(format!("{normalized}_review.md"));
82+
7483
let output = Command::new("uv")
75-
.args(["run", "axp", "review", &arxiv_id, "--force"])
84+
.args([
85+
"run", "axp", "review", &arxiv_id, "--force",
86+
"--output", &out_path.to_string_lossy(),
87+
])
7688
.output()
7789
.await;
7890

7991
match output {
8092
Ok(out) if out.status.success() => {
8193
let _ = tx.send(AppEvent::JobCompleted {
8294
job_id,
83-
message: format!("Review ready for {arxiv_id}"),
95+
message: format!("Review saved: {}", out_path.display()),
8496
});
8597
}
8698
Ok(out) => {

0 commit comments

Comments
 (0)