Add support for making Text-To-Speech send regular text messages instead of notices

When speech-to-text/flow-type = `only_transcribe`, the bot will now send
text messages by default, not notices.

While notice messages may be less desirable with other bots in the room,
it's probably a better default for most people who enable "transcribe-only" mode.

This is an improvement related to https://github.com/etkecc/baibot/issues/14
This commit is contained in:
Slavi Pantaleev
2025-02-26 13:39:43 +02:00
parent e4e1fe0e7b
commit a1bd292752
23 changed files with 355 additions and 32 deletions

View File

@@ -6,11 +6,11 @@ use crate::agent::provider::ImageGenerationParams;
use crate::agent::AgentPurpose;
use crate::agent::ControllerTrait;
use crate::controller::utils::agent::get_effective_agent_for_purpose_or_complain;
use crate::controller::utils::mime::get_file_extension;
use crate::conversation::create_llm_conversation_for_matrix_thread;
use crate::conversation::matrix::MatrixMessageProcessingParams;
use crate::strings;
use crate::{entity::MessageContext, Bot};
use crate::controller::utils::mime::get_file_extension;
// We may make this configurable (per room, etc.) in the future, but for now it's hardcoded.
const STICKER_SIZE: &str = "256x256";
@@ -82,7 +82,10 @@ pub async fn handle_image(
.await;
}
let attachment_body_text = format!("generated-image.{}", get_file_extension(&response.mime_type));
let attachment_body_text = format!(
"generated-image.{}",
get_file_extension(&response.mime_type)
);
let mut event_content = matrix_link
.media()
@@ -158,7 +161,10 @@ pub async fn handle_sticker(
.instrument(span)
.await?;
let attachment_body_text = format!("generated-sticker.{}", get_file_extension(&response.mime_type));
let attachment_body_text = format!(
"generated-sticker.{}",
get_file_extension(&response.mime_type)
);
let mut event_content = matrix_link
.media()