ok I think I fixed the ghost message

This commit is contained in:
dal 2025-04-09 17:17:05 -06:00
parent c49a2b4bde
commit fc5736a4b3
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
1 changed files with 7 additions and 0 deletions

View File

@ -210,11 +210,18 @@ pub async fn post_chat_handler(
}
if request.prompt.is_none() && asset_id.is_some() && asset_type.is_some() {
// Remove the initial empty message added by initialize_chat in this specific case
let message_id_str = message_id.to_string();
chat_with_messages.messages.remove(&message_id_str);
chat_with_messages.message_ids.retain(|id| id != &message_id_str);
let asset_id_value = asset_id.unwrap();
let asset_type_value = asset_type.unwrap();
let messages = generate_asset_messages(asset_id_value, asset_type_value, &user).await?;
println!("messages: {:?}", messages);
// Add messages to chat and associate with chat_id
let mut updated_messages = Vec::new();
for mut message in messages {