From f1983d35a0cd68060a3bbb379c3b8ab4e4b050e4 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sun, 5 Apr 2026 00:10:33 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Update=20script=20metadata=20and?= =?UTF-8?q?=20improve=20AI=20message=20handling=20logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script-meta-v2.json | 6 +++--- script-meta.json | 4 ++-- sync-rs/src/main.rs | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/script-meta-v2.json b/script-meta-v2.json index f0eab74..b57bce3 100644 --- a/script-meta-v2.json +++ b/script-meta-v2.json @@ -138,11 +138,11 @@ }, "sync.rs": { "script_name": "sync.rs", - "script_length": 2973, - "script_sha256": "a94a20258431e8dd7534e1078f9894de799a220f99b993ba9f2e56dc760804ea", + "script_length": 3026, + "script_sha256": "ed2cc2f3238ae892a2dc2bcf0c4b74485939f926242c50aa0d0e6affb8eec337", "script_full_url": "https://git.hatter.ink/rust-scripts/scriptbase/raw/branch/main/sync-rs/src/main.rs", "publish_time": 1737272563310, - "update_time": 1775318648698 + "update_time": 1775319019530 }, "xattr.rs": { "script_name": "xattr.rs", diff --git a/script-meta.json b/script-meta.json index 49938a4..faa7c8b 100644 --- a/script-meta.json +++ b/script-meta.json @@ -81,8 +81,8 @@ }, "sync-rs": { "script_name": "sync-rs", - "script_length": 2973, - "script_sha256": "a94a20258431e8dd7534e1078f9894de799a220f99b993ba9f2e56dc760804ea" + "script_length": 3026, + "script_sha256": "ed2cc2f3238ae892a2dc2bcf0c4b74485939f926242c50aa0d0e6affb8eec337" }, "xattr-rs": { "script_name": "xattr-rs", diff --git a/sync-rs/src/main.rs b/sync-rs/src/main.rs index e3cbc01..8511c77 100755 --- a/sync-rs/src/main.rs +++ b/sync-rs/src/main.rs @@ -32,11 +32,11 @@ fn main() -> Result<(), Box> { .args(&["-c", r##"xh --ignore-stdin https://hatter.ink/ai/commit-summarize.json -f "Authorization:Bearer $(get-secret.ts --id ai-commit-summarize-token)" gitStatus="$(git status)" gitDiff="$(git diff)" | jq .data.summary -r"##]) .output()?; let mut message = "auto sync".to_string(); - information!("{:?}", ai_summarize_output); if ai_summarize_output.status.success() { if let Ok(summarized_message) = String::from_utf8(ai_summarize_output.stdout) { - success!("AI summarized message: {}", summarized_message); - message = summarized_message; + let trimmed_summarized_message = summarized_message.trim().to_string(); + success!("AI summarized message: {}", trimmed_summarized_message); + message = trimmed_summarized_message; } else { warning!("AI summarized message is not UTF-8"); } @@ -84,5 +84,5 @@ pub fn find_parents_exists_dir(dir: &str) -> Option { } } -// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260405T000314+08:00.MEYCIQCOflkXKihoc6wfiGml -// TObfzEuzkqKg3yEfU+swKk7aJgIhALHUGopxnHNXjSoWziiQt9U1xb8qGpamrsHdd20nrTjx +// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260405T001005+08:00.MEUCIBhzMsJYPxHUITwCPoB5 +// JxIUiRym6BFp4/1yvTBcxCNAAiEA1Eq79zvr+IkpnuIvgz+m5wEeEXqpCIu7moSX9qssaZY=