chore: return no content (#523)
This commit is contained in:
parent
a9d49403ae
commit
c115414f5a
|
|
@ -1019,14 +1019,27 @@ async fn summary_row_handler(
|
||||||
return Err(AppError::InvalidRequest("Identity data is not supported".to_string()).into());
|
return Err(AppError::InvalidRequest("Identity data is not supported".to_string()).into());
|
||||||
},
|
},
|
||||||
SummarizeRowData::Content(content) => {
|
SummarizeRowData::Content(content) => {
|
||||||
let text = state
|
if content.is_empty() {
|
||||||
.ai_client
|
return Ok(
|
||||||
.summarize_row(&content)
|
AppResponse::Ok()
|
||||||
.await
|
.with_data(SummarizeRowResponse {
|
||||||
.map_err(|err| AppError::InvalidRequest(err.to_string()))?
|
text: "No content".to_string(),
|
||||||
.text;
|
})
|
||||||
|
.into(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let result = state.ai_client.summarize_row(&content).await;
|
||||||
|
let resp = match result {
|
||||||
|
Ok(resp) => SummarizeRowResponse { text: resp.text },
|
||||||
|
Err(err) => {
|
||||||
|
error!("Failed to summarize row: {:?}", err);
|
||||||
|
SummarizeRowResponse {
|
||||||
|
text: "No content".to_string(),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
let resp = SummarizeRowResponse { text };
|
|
||||||
Ok(AppResponse::Ok().with_data(resp).into())
|
Ok(AppResponse::Ok().with_data(resp).into())
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue