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