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