📝 Update script metadata and improve AI message handling logic

This commit is contained in:
2026-04-05 00:10:33 +08:00
parent 2cd8cf7150
commit f1983d35a0
3 changed files with 10 additions and 10 deletions

View File

@@ -32,11 +32,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.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<PathBuf> {
}
}
// @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=