Filter out chats with empty or whitespace-only titles

Co-authored-by: dallin <dallin@buster.so>
This commit is contained in:
Cursor Agent 2025-07-14 19:08:04 +00:00
parent 2cd3f0696f
commit 48027dccb9
2 changed files with 4 additions and 0 deletions

View File

@ -106,6 +106,7 @@ pub async fn list_chats_handler(
.inner_join(users::table.on(chats::created_by.eq(users::id)))
.filter(chats::deleted_at.is_null())
.filter(chats::title.ne("")) // Filter out empty titles
.filter(chats::title.ne(" ")) // Filter out single space
.into_boxed();
// Add user filter if not admin view
@ -143,6 +144,7 @@ pub async fn list_chats_handler(
let has_more = results.len() > request.page_size as usize;
let items: Vec<ChatListItem> = results
.into_iter()
.filter(|chat| !chat.title.trim().is_empty()) // Filter out titles with only whitespace
.take(request.page_size as usize)
.map(|chat| {
ChatListItem {

View File

@ -79,6 +79,7 @@ pub async fn list_logs_handler(
.filter(chats::deleted_at.is_null())
.filter(chats::organization_id.eq(organization_id))
.filter(chats::title.ne("")) // Filter out empty titles
.filter(chats::title.ne(" ")) // Filter out single space
.into_boxed();
// Calculate offset based on page number
@ -112,6 +113,7 @@ pub async fn list_logs_handler(
let has_more = results.len() > request.page_size as usize;
let items: Vec<LogListItem> = results
.into_iter()
.filter(|chat| !chat.title.trim().is_empty()) // Filter out titles with only whitespace
.take(request.page_size as usize)
.map(|chat| {
LogListItem {