refactor(service): update observability push, chat conversation and search service

This commit is contained in:
ZhenYi 2026-05-12 13:04:46 +08:00
parent 395fa1b498
commit 9d091d3dfb
3 changed files with 6 additions and 8 deletions

View File

@ -308,10 +308,10 @@ mod tests {
#[test]
fn payload_serialises_to_json() {
let pusher = MetricsPusher::new("http://localhost:9090", "test-app");
let _pusher = MetricsPusher::new("http://localhost:9090", "test-app");
let metrics = HttpMetrics::new();
metrics.request_count.fetch_add(42, std::sync::atomic::Ordering::Relaxed);
let handle = metrics_exporter_prometheus::PrometheusBuilder::new()
let _handle = metrics_exporter_prometheus::PrometheusBuilder::new()
.build_recorder()
.handle();
// Don't set global recorder in tests — it conflicts with other tests.

View File

@ -193,8 +193,10 @@ impl AppService {
}
}
} else {
// Personal scope — only own chats
query = query.filter(ai_conversation::Column::UserId.eq(user_id));
// Personal scope — only own chats without a project
query = query
.filter(ai_conversation::Column::UserId.eq(user_id))
.filter(ai_conversation::Column::ProjectId.is_null());
}
let convs = query.paginate(self.db.reader(), page_size).fetch_page(0).await?;

View File

@ -242,10 +242,6 @@ impl AppService {
let page = Ord::max(params.page.unwrap_or(1), 1u32);
let per_page = Ord::min(params.per_page.unwrap_or(20), 100u32);
let query = params.q.trim();
if query.is_empty() {
return Err(AppError::BadRequest("q is required".to_string()));
}
let types = parse_types(params.r#type);
let user_id = ctx.user();
let accessible = accessible_project_ids(&self.db, user_id).await?;