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

@@ -4,7 +4,8 @@ use super::globalconfig::GlobalConfig;
use super::roomconfig::RoomConfig;
use crate::entity::roomconfig::{
defaults as roomconfig_defaults, SpeechToTextFlowType, TextGenerationAutoUsage,
defaults as roomconfig_defaults, SpeechToTextFlowType,
SpeechToTextMessageTypeForNonThreadedOnlyTranscribedMessages, TextGenerationAutoUsage,
TextGenerationPrefixRequirementType, TextToSpeechBotMessagesFlowType,
TextToSpeechUserMessagesFlowType,
};
@@ -37,6 +38,24 @@ impl RoomConfigContext {
.unwrap_or(roomconfig_defaults::SPEECH_TO_TEXT_FLOW_TYPE)
}
pub fn speech_to_text_msg_type_for_non_threaded_only_transcribed_messages(
&self,
) -> SpeechToTextMessageTypeForNonThreadedOnlyTranscribedMessages {
self.room_config
.settings
.speech_to_text
.msg_type_for_non_threaded_only_transcribed_messages
.or({
self.global_config
.fallback_room_settings
.speech_to_text
.msg_type_for_non_threaded_only_transcribed_messages
})
.unwrap_or(
roomconfig_defaults::SPEECH_TO_TEXT_ONLY_TRANSCRIBE_NON_THREADED_MESSAGE_TYPE,
)
}
pub fn speech_to_text_language(&self) -> Option<String> {
self.room_config
.settings