fmt
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
agent::{
|
||||
utils::AgentForPurposeDeterminationInfoConfigurationSource, AgentInstance, AgentPurpose,
|
||||
PublicIdentifier,
|
||||
AgentInstance, AgentPurpose, PublicIdentifier,
|
||||
utils::AgentForPurposeDeterminationInfoConfigurationSource,
|
||||
},
|
||||
entity::roomconfig::{
|
||||
SpeechToTextFlowType, SpeechToTextMessageTypeForNonThreadedOnlyTranscribedMessages,
|
||||
@@ -45,7 +45,9 @@ pub fn configuration_getter_used_with_extra_text(
|
||||
getter_name: &str,
|
||||
remaining_text: &str,
|
||||
) -> String {
|
||||
format!("You're invoking a getter command (`{getter_name}`), but passing additional text (`{remaining_text}`) as if you're invoking a setter.\n\nPerhaps you meant to invoke `set-{getter_name}`?")
|
||||
format!(
|
||||
"You're invoking a getter command (`{getter_name}`), but passing additional text (`{remaining_text}`) as if you're invoking a setter.\n\nPerhaps you meant to invoke `set-{getter_name}`?"
|
||||
)
|
||||
}
|
||||
|
||||
pub fn configuration_value_unrecognized(value: &str) -> String {
|
||||
@@ -53,7 +55,10 @@ pub fn configuration_value_unrecognized(value: &str) -> String {
|
||||
}
|
||||
|
||||
pub fn configuration_value_not_f32(value: &str) -> String {
|
||||
format!("The value `{}` could not be converted to a [floating point number](https://en.wikipedia.org/wiki/Floating-point_arithmetic).", value)
|
||||
format!(
|
||||
"The value `{}` could not be converted to a [floating point number](https://en.wikipedia.org/wiki/Floating-point_arithmetic).",
|
||||
value
|
||||
)
|
||||
}
|
||||
|
||||
pub fn status_room_config_handlers_heading() -> &'static str {
|
||||
|
||||
@@ -32,7 +32,9 @@ pub fn users_command_get(command_prefix: &str) -> String {
|
||||
}
|
||||
|
||||
pub fn users_command_set(command_prefix: &str) -> String {
|
||||
format!("- **Set** the list of allowed users: `{command_prefix} access set-users SPACE_SEPARATED_PATTERNS`")
|
||||
format!(
|
||||
"- **Set** the list of allowed users: `{command_prefix} access set-users SPACE_SEPARATED_PATTERNS`"
|
||||
)
|
||||
}
|
||||
|
||||
pub fn example_user_patterns(own_server_name: &str) -> String {
|
||||
@@ -64,7 +66,9 @@ pub fn room_local_agent_managers_heading() -> String {
|
||||
}
|
||||
|
||||
pub fn room_local_agent_managers_intro(command_prefix: &str) -> String {
|
||||
format!("Room-local agent managers are users privileged to **create their own agents** (see `{command_prefix} agent`) in rooms.")
|
||||
format!(
|
||||
"Room-local agent managers are users privileged to **create their own agents** (see `{command_prefix} agent`) in rooms."
|
||||
)
|
||||
}
|
||||
|
||||
pub fn room_local_agent_managers_security_warning() -> String {
|
||||
@@ -72,9 +76,13 @@ pub fn room_local_agent_managers_security_warning() -> String {
|
||||
}
|
||||
|
||||
pub fn room_local_agent_managers_command_get(command_prefix: &str) -> String {
|
||||
format!("- **Show** the currently allowed users: `{command_prefix} access room-local-agent-managers`")
|
||||
format!(
|
||||
"- **Show** the currently allowed users: `{command_prefix} access room-local-agent-managers`"
|
||||
)
|
||||
}
|
||||
|
||||
pub fn room_local_agent_managers_command_set(command_prefix: &str) -> String {
|
||||
format!("- **Set** the list of allowed users: `{command_prefix} access set-room-local-agent-managers SPACE_SEPARATED_PATTERNS`")
|
||||
format!(
|
||||
"- **Set** the list of allowed users: `{command_prefix} access set-room-local-agent-managers SPACE_SEPARATED_PATTERNS`"
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@ pub fn heading() -> String {
|
||||
}
|
||||
|
||||
pub fn intro(command_prefix: &str) -> String {
|
||||
format!("An agent is an instantiation and configuration of some **☁️ provider** (see `{command_prefix} provider`).")
|
||||
format!(
|
||||
"An agent is an instantiation and configuration of some **☁️ provider** (see `{command_prefix} provider`)."
|
||||
)
|
||||
}
|
||||
|
||||
pub fn intro_handler_relation(command_prefix: &str) -> String {
|
||||
@@ -25,7 +27,9 @@ pub fn list_agents(command_prefix: &str) -> String {
|
||||
}
|
||||
|
||||
pub fn show_agent_details(command_prefix: &str) -> String {
|
||||
format!("- **Show** full details for a given agent: `{command_prefix} agent details FULL_AGENT_IDENTIFIER`")
|
||||
format!(
|
||||
"- **Show** full details for a given agent: `{command_prefix} agent details FULL_AGENT_IDENTIFIER`"
|
||||
)
|
||||
}
|
||||
|
||||
pub fn create_agent_intro() -> &'static str {
|
||||
@@ -33,11 +37,15 @@ pub fn create_agent_intro() -> &'static str {
|
||||
}
|
||||
|
||||
pub fn create_agent_room_local(command_prefix: &str) -> String {
|
||||
format!("\t- (Accessible in **this room only**) `{command_prefix} agent create-room-local PROVIDER_ID AGENT_ID`")
|
||||
format!(
|
||||
"\t- (Accessible in **this room only**) `{command_prefix} agent create-room-local PROVIDER_ID AGENT_ID`"
|
||||
)
|
||||
}
|
||||
|
||||
pub fn create_agent_global(command_prefix: &str) -> String {
|
||||
format!("\t- (Accessible in **all rooms**) `{command_prefix} agent create-global PROVIDER_ID AGENT_ID`")
|
||||
format!(
|
||||
"\t- (Accessible in **all rooms**) `{command_prefix} agent create-global PROVIDER_ID AGENT_ID`"
|
||||
)
|
||||
}
|
||||
|
||||
pub fn create_agent_example(command_prefix: &str) -> String {
|
||||
|
||||
@@ -23,7 +23,9 @@ pub fn status_heading() -> String {
|
||||
}
|
||||
|
||||
pub fn status_intro(command_prefix: &str) -> String {
|
||||
format!("To **show a summary** of the configuration affecting the current room: `{command_prefix} config status`")
|
||||
format!(
|
||||
"To **show a summary** of the configuration affecting the current room: `{command_prefix} config status`"
|
||||
)
|
||||
}
|
||||
|
||||
pub fn handlers_heading() -> String {
|
||||
@@ -57,15 +59,21 @@ pub fn handlers_intro_purposes() -> String {
|
||||
}
|
||||
|
||||
pub fn handlers_show(command_prefix: &str) -> String {
|
||||
format!("**Show** the currently configured agent for the given purpose: `{command_prefix} config CONFIG_TYPE handler PURPOSE`")
|
||||
format!(
|
||||
"**Show** the currently configured agent for the given purpose: `{command_prefix} config CONFIG_TYPE handler PURPOSE`"
|
||||
)
|
||||
}
|
||||
|
||||
pub fn handlers_set(command_prefix: &str) -> String {
|
||||
format!("**Set** the agent to be used for the given purpose: `{command_prefix} config CONFIG_TYPE set-handler PURPOSE AGENT_ID`")
|
||||
format!(
|
||||
"**Set** the agent to be used for the given purpose: `{command_prefix} config CONFIG_TYPE set-handler PURPOSE AGENT_ID`"
|
||||
)
|
||||
}
|
||||
|
||||
pub fn handlers_unset(command_prefix: &str) -> String {
|
||||
format!("**Unset** the agent to be used for the given purpose: `{command_prefix} config CONFIG_TYPE set-handler PURPOSE`")
|
||||
format!(
|
||||
"**Unset** the agent to be used for the given purpose: `{command_prefix} config CONFIG_TYPE set-handler PURPOSE`"
|
||||
)
|
||||
}
|
||||
|
||||
pub fn text_generation_heading() -> String {
|
||||
@@ -99,7 +107,9 @@ pub fn text_generation_prefix_requirement_type_intro() -> String {
|
||||
}
|
||||
|
||||
pub fn text_generation_prefix_requirement_type_outro(bot_username: &str) -> String {
|
||||
format!("Regardless of the setting, the bot will always respond to **direct mentions** (e.g. `@{bot_username}`).")
|
||||
format!(
|
||||
"Regardless of the setting, the bot will always respond to **direct mentions** (e.g. `@{bot_username}`)."
|
||||
)
|
||||
}
|
||||
|
||||
pub fn text_generation_auto_usage_heading() -> &'static str {
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
use crate::agent::utils::get_effective_agent_for_purpose;
|
||||
use crate::agent::utils::AgentForPurposeDeterminationError;
|
||||
use crate::agent::utils::get_effective_agent_for_purpose;
|
||||
use crate::agent::{AgentPurpose, Manager as AgentManager};
|
||||
use crate::entity::roomconfig::TextGenerationPrefixRequirementType;
|
||||
use crate::entity::RoomConfigContext;
|
||||
use crate::entity::roomconfig::TextGenerationPrefixRequirementType;
|
||||
|
||||
fn hello() -> &'static str {
|
||||
"Hello! 👋"
|
||||
}
|
||||
|
||||
pub fn its_me(name: &str) -> String {
|
||||
let mut message = format!("I'm {name} - a bot exposing the power of [AI](https://en.wikipedia.org/wiki/Artificial_intelligence) ([Large Language Models](https://en.wikipedia.org/wiki/Large_language_model)) to you. 🤖");
|
||||
let mut message = format!(
|
||||
"I'm {name} - a bot exposing the power of [AI](https://en.wikipedia.org/wiki/Artificial_intelligence) ([Large Language Models](https://en.wikipedia.org/wiki/Large_language_model)) to you. 🤖"
|
||||
);
|
||||
|
||||
if name == crate::entity::cfg::defaults::name() {
|
||||
message.push('\n');
|
||||
@@ -179,7 +181,9 @@ fn send_a_text_message(
|
||||
"**Send a text message** in this room (e.g. `Hello!`) and see me reply.".to_owned()
|
||||
}
|
||||
TextGenerationPrefixRequirementType::CommandPrefix => {
|
||||
format!("In this room, I'm configured to require the command prefix (`{command_prefix}`) for text messages. **Send a prefixed text message** (e.g. `{command_prefix} Hello!`) and see me reply.")
|
||||
format!(
|
||||
"In this room, I'm configured to require the command prefix (`{command_prefix}`) for text messages. **Send a prefixed text message** (e.g. `{command_prefix} Hello!`) and see me reply."
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -191,9 +195,13 @@ fn learn_more_from_usage_or_help(command_prefix: &str) -> String {
|
||||
}
|
||||
|
||||
pub fn create_one_or_more_agents(command_prefix: &str) -> String {
|
||||
format!("**Create one or more agents** in this room or globally. The provider help message will show you **🗲 Quick start** commands, but you may also send a `{command_prefix} agent` command to see the guide.")
|
||||
format!(
|
||||
"**Create one or more agents** in this room or globally. The provider help message will show you **🗲 Quick start** commands, but you may also send a `{command_prefix} agent` command to see the guide."
|
||||
)
|
||||
}
|
||||
|
||||
pub fn set_new_agent_as_handler(command_prefix: &str) -> String {
|
||||
format!("**Set the new agent as a handler** for a given use-purpose like text-generation, image-generation, etc. The agent-creation wizard will tell you how, but you may also send a `{command_prefix} config` command to see the guide (in the 🤖 *Handler Agents* section).")
|
||||
format!(
|
||||
"**Set the new agent as a handler** for a given use-purpose like text-generation, image-generation, etc. The agent-creation wizard will tell you how, but you may also send a `{command_prefix} config` command to see the guide (in the 🤖 *Handler Agents* section)."
|
||||
)
|
||||
}
|
||||
|
||||
@@ -7,5 +7,8 @@ pub fn redaction_reason_failed() -> &'static str {
|
||||
}
|
||||
|
||||
pub fn language_code_invalid(value: &str) -> String {
|
||||
format!("The value `{}` is not a valid 2-letter language code as per [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes).", value)
|
||||
format!(
|
||||
"The value `{}` is not a valid 2-letter language code as per [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes).",
|
||||
value
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user