Fix summarize response handling
This commit is contained in:
parent
a85cb7891e
commit
27467b462e
@ -73,10 +73,15 @@ struct Message {
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct SummarizeResponse {
|
||||
struct SummarizeResult {
|
||||
summary: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct SummarizeResponse {
|
||||
result: SummarizeResult,
|
||||
}
|
||||
|
||||
async fn request_ai_summarization(
|
||||
base_url: &str,
|
||||
api_key: &str,
|
||||
@ -101,7 +106,7 @@ async fn request_ai_summarization(
|
||||
if response.status().is_success() {
|
||||
console_log!("request_ai_summarization success");
|
||||
let summarize_response: SummarizeResponse = response.json().await?;
|
||||
Ok(summarize_response.summary)
|
||||
Ok(summarize_response.result.summary)
|
||||
} else {
|
||||
let error_message = response.text().await?;
|
||||
console_log!("request_ai_summarization error: {}", error_message);
|
||||
|
Loading…
Reference in New Issue
Block a user