Merge branch 'evals' of https://github.com/buster-so/buster into evals

This commit is contained in:
Nate Kelley 2025-04-09 14:32:34 -06:00
commit f31294918b
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
1 changed files with 16 additions and 11 deletions

View File

@ -737,17 +737,6 @@ pub async fn post_chat_handler(
if let Some(title) = title.title {
chat_with_messages.title = title.clone();
// Update the chat title in the database to match
let update_result = diesel::update(chats::table)
.filter(chats::id.eq(chat_id))
.set((chats::title.eq(title), chats::updated_at.eq(Utc::now())))
.execute(&mut conn)
.await?;
if update_result == 0 {
tracing::warn!("Failed to update chat title in database");
}
}
// Send final completed state
@ -2152,6 +2141,22 @@ pub async fn generate_conversation_title(
.await?;
}
let mut conn = match get_pg_pool().get().await {
Ok(conn) => conn,
Err(e) => {
return Err(anyhow::anyhow!("Failed to get database connection: {}", e));
}
};
diesel::update(chats::table)
.filter(chats::id.eq(*session_id))
.set((
chats::title.eq(title.title.clone().unwrap_or_default()),
chats::updated_at.eq(Utc::now()),
))
.execute(&mut conn)
.await?;
Ok(title)
}