修复: unwrap 吞错 + lock 中毒 panic 高危项(数据吞 warn 跳过 / lock 降级返 Err)
This commit is contained in:
@@ -446,7 +446,17 @@ async fn route_load_messages(state: &State<'_, AppState>, conversation_id: Strin
|
||||
conv_id = %conversation_id,
|
||||
"[remote_bridge] load_messages ai_messages 表空,回退旧 messages JSON 列(老库未迁移)"
|
||||
);
|
||||
serde_json::from_str(&rec.messages).unwrap_or_default()
|
||||
match serde_json::from_str::<Vec<ChatMessage>>(&rec.messages) {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
tracing::warn!(
|
||||
error = %e,
|
||||
conv_id = %conversation_id,
|
||||
"[remote_bridge] load_messages 老 messages JSON 解析失败,跳过(推送空列表)"
|
||||
);
|
||||
Vec::new()
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => Vec::new(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user