fix: silent AI billing failures — add tracing::warn for billing errors
This commit is contained in:
parent
1e975c0837
commit
763d47dc45
@ -224,14 +224,17 @@ pub async fn process_message_ai_react_streaming(
|
|||||||
|
|
||||||
// Record billing (non-fatal)
|
// Record billing (non-fatal)
|
||||||
// TODO: ReAct agent does not track token counts yet; billing with 0/0
|
// TODO: ReAct agent does not track token counts yet; billing with 0/0
|
||||||
let _ = super::billing::record_ai_usage(
|
if let Err(e) = super::billing::record_ai_usage(
|
||||||
&db,
|
&db,
|
||||||
project_id_inner,
|
project_id_inner,
|
||||||
model_id,
|
model_id,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
.await;
|
.await
|
||||||
|
{
|
||||||
|
tracing::warn!(error = %e, "AI billing recording failed");
|
||||||
|
}
|
||||||
|
|
||||||
let msg_event = queue::RoomMessageEvent {
|
let msg_event = queue::RoomMessageEvent {
|
||||||
id: streaming_msg_id,
|
id: streaming_msg_id,
|
||||||
|
|||||||
@ -188,14 +188,17 @@ pub async fn process_message_ai_streaming(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Record billing (non-fatal)
|
// Record billing (non-fatal)
|
||||||
let _ = super::billing::record_ai_usage(
|
if let Err(e) = super::billing::record_ai_usage(
|
||||||
&db,
|
&db,
|
||||||
project_id_inner,
|
project_id_inner,
|
||||||
model_id,
|
model_id,
|
||||||
result.input_tokens,
|
result.input_tokens,
|
||||||
result.output_tokens,
|
result.output_tokens,
|
||||||
)
|
)
|
||||||
.await;
|
.await
|
||||||
|
{
|
||||||
|
tracing::warn!(error = %e, "AI billing recording failed");
|
||||||
|
}
|
||||||
|
|
||||||
let msg_event = queue::RoomMessageEvent {
|
let msg_event = queue::RoomMessageEvent {
|
||||||
id: streaming_msg_id,
|
id: streaming_msg_id,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user