修复kimi返回信息的读取错误
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "quicommit"
|
||||
version = "0.2.3"
|
||||
version = "0.2.4"
|
||||
edition = "2024"
|
||||
authors = ["Sidney Zhang <zly@lyzhang.me>"]
|
||||
description = "A powerful Git assistant tool with AI-powered commit/tag/changelog generation(alpha version)"
|
||||
@@ -86,7 +86,7 @@ wiremock = "0.6"
|
||||
[profile.release]
|
||||
opt-level = "s"
|
||||
lto = "thin"
|
||||
codegen-units = 2
|
||||
codegen-units = 1
|
||||
panic = "abort"
|
||||
strip = true
|
||||
debug = false
|
||||
|
||||
@@ -346,7 +346,17 @@ impl KimiClient {
|
||||
.choices
|
||||
.into_iter()
|
||||
.next()
|
||||
.map(|c| c.message.content.trim().to_string())
|
||||
.map(|c| {
|
||||
let content = c.message.content.trim().to_string();
|
||||
if content.is_empty() {
|
||||
c.reasoning_content
|
||||
.or(c.message.reasoning_content)
|
||||
.map(|r| r.trim().to_string())
|
||||
.unwrap_or_default()
|
||||
} else {
|
||||
content
|
||||
}
|
||||
})
|
||||
.filter(|s| !s.is_empty())
|
||||
.ok_or_else(|| anyhow::anyhow!("No response from Kimi"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user