Initial commit
This commit is contained in:
80
src/strings/help/access.rs
Normal file
80
src/strings/help/access.rs
Normal file
@@ -0,0 +1,80 @@
|
||||
pub fn heading() -> String {
|
||||
"🔒 Access".to_owned()
|
||||
}
|
||||
|
||||
pub fn intro() -> String {
|
||||
"This bot employs access control to decide who can use its services and manage its configuration.".to_string()
|
||||
}
|
||||
|
||||
pub fn room_auto_join_heading() -> String {
|
||||
"👋 Joining rooms".to_owned()
|
||||
}
|
||||
|
||||
pub fn room_auto_join_intro() -> String {
|
||||
"The bot automatically joins rooms when invited by someone considered a bot user (see below)."
|
||||
.to_string()
|
||||
}
|
||||
|
||||
pub fn users_heading() -> String {
|
||||
"👥 Users".to_owned()
|
||||
}
|
||||
|
||||
pub fn users_intro() -> String {
|
||||
"The bot will ignore messages (and room invitations) from unallowed users.".to_string()
|
||||
}
|
||||
|
||||
pub fn users_access() -> String {
|
||||
"Users can **use all the bot's features** (text-generation, speech-to-text, etc.), but cannot manage the bot's configuration.".to_string()
|
||||
}
|
||||
|
||||
pub fn users_command_get(command_prefix: &str) -> String {
|
||||
format!("- **Show** the currently allowed users: `{command_prefix} access users`")
|
||||
}
|
||||
|
||||
pub fn users_command_set(command_prefix: &str) -> String {
|
||||
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 {
|
||||
format!("Example patterns: `@*:{own_server_name} @*:another.com @someone:company.org`")
|
||||
}
|
||||
|
||||
pub fn administrators_heading() -> String {
|
||||
"👮♂️ Administrators".to_owned()
|
||||
}
|
||||
|
||||
pub fn administrators_intro() -> String {
|
||||
"Administrators can **manage the bot's configuration and access control**.".to_string()
|
||||
}
|
||||
|
||||
pub fn administrators_now_match_patterns(patterns: &[String]) -> String {
|
||||
format!(
|
||||
"The bot can be administrated by users with a [Matrix user id](https://spec.matrix.org/v1.11/#users) matching the following patterns: `{}`",
|
||||
patterns.join(" "),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn administrators_outro() -> String {
|
||||
"Administrators cannot be changed without adjusting the bot's configuration on the server."
|
||||
.to_string()
|
||||
}
|
||||
|
||||
pub fn room_local_agent_managers_heading() -> String {
|
||||
"💼 Room-local agent managers".to_owned()
|
||||
}
|
||||
|
||||
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.")
|
||||
}
|
||||
|
||||
pub fn room_local_agent_managers_security_warning() -> String {
|
||||
"Letting regular users create agents which contact arbitrary network services **may be a security issue**.".to_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`")
|
||||
}
|
||||
|
||||
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`")
|
||||
}
|
||||
60
src/strings/help/agent.rs
Normal file
60
src/strings/help/agent.rs
Normal file
@@ -0,0 +1,60 @@
|
||||
pub fn heading() -> String {
|
||||
"🤖 Agents".to_owned()
|
||||
}
|
||||
|
||||
pub fn intro(command_prefix: &str, can_see_providers: bool) -> String {
|
||||
format!(
|
||||
"An agent is an instantiation and configuration of some **☁️ provider**{}.",
|
||||
if can_see_providers {
|
||||
format!(" (see `{command_prefix} provider`)")
|
||||
} else {
|
||||
"".to_owned()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
pub fn intro_handler_relation(command_prefix: &str) -> String {
|
||||
format!(
|
||||
"Agents can be set as **handlers for various purposes** (text-generation, speech-to-text, etc.) globally or in specific rooms. Send a `{command_prefix} config status` command to see the current configuration."
|
||||
)
|
||||
}
|
||||
|
||||
pub fn intro_capabilities() -> String {
|
||||
"It can support different capabilities (text-generation, speech-to-text, etc.) depending on the provider used and on the configuration of the agent.".to_string()
|
||||
}
|
||||
|
||||
pub fn no_permission_to_create_agents() -> &'static str {
|
||||
"You are neither an administrator, nor a room-local agent manager, so **you cannot create new agents by yourself**."
|
||||
}
|
||||
|
||||
pub fn list_agents(command_prefix: &str) -> String {
|
||||
format!("- **List** all available agents: `{command_prefix} agent list`")
|
||||
}
|
||||
|
||||
pub fn show_agent_details(command_prefix: &str) -> String {
|
||||
format!("- **Show** full details for a given agent: `{command_prefix} agent details FULL_AGENT_IDENTIFIER`")
|
||||
}
|
||||
|
||||
pub fn create_agent_intro() -> &'static str {
|
||||
"- **Create** a new agent:"
|
||||
}
|
||||
|
||||
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`")
|
||||
}
|
||||
|
||||
pub fn create_agent_global(command_prefix: &str) -> String {
|
||||
format!("\t- (Accessible in **all rooms**) `{command_prefix} agent create-global PROVIDER_ID AGENT_ID`")
|
||||
}
|
||||
|
||||
pub fn create_agent_example(command_prefix: &str) -> String {
|
||||
format!("\t- Example: `{command_prefix} agent create-room-local openai my-openai-agent`")
|
||||
}
|
||||
|
||||
pub fn delete_agent(command_prefix: &str) -> String {
|
||||
format!("- **Delete** an agent: `{command_prefix} agent delete FULL_AGENT_IDENTIFIER`")
|
||||
}
|
||||
|
||||
pub fn available_commands_outro_update_note() -> &'static str {
|
||||
"To **update** a given agent's configuration: show the agent's **details** (current configuration), then **delete** it and finally **re-create** it."
|
||||
}
|
||||
273
src/strings/help/cfg.rs
Normal file
273
src/strings/help/cfg.rs
Normal file
@@ -0,0 +1,273 @@
|
||||
use crate::agent::AgentPurpose;
|
||||
|
||||
pub fn heading() -> String {
|
||||
"🛠️ Configuration".to_owned()
|
||||
}
|
||||
|
||||
pub fn intro_short() -> &'static str {
|
||||
"Various settings for this bot can be configured **📍 per-room** and **🌐 globally**."
|
||||
}
|
||||
|
||||
pub fn intro_long() -> String {
|
||||
format!(
|
||||
"{}\n\n{}\n{}\n\n{}",
|
||||
intro_short(),
|
||||
"Room-specific configuration values override the global configuration.",
|
||||
"When no configuration values are set, the bot uses hardcoded defaults.",
|
||||
"In commands below, **replace the `CONFIG_TYPE` value** with either `room` (for room-specific configuration) or `global` (for global configuration)."
|
||||
)
|
||||
}
|
||||
|
||||
pub fn status_heading() -> String {
|
||||
"📃 Status".to_owned()
|
||||
}
|
||||
|
||||
pub fn status_intro(command_prefix: &str) -> String {
|
||||
format!("To **show a summary** of the configuration affecting the current room: `{command_prefix} config status`")
|
||||
}
|
||||
|
||||
pub fn handlers_heading() -> String {
|
||||
"🤖 Handler Agents".to_owned()
|
||||
}
|
||||
|
||||
pub fn handlers_intro_common() -> String {
|
||||
format!(
|
||||
"{}\n\n{}",
|
||||
"Different messages (text, audio, requests for image generation, etc.) in the room are handled differently and can potentially be served by different agents.",
|
||||
"When no specific agent is configured for a given purpose, the catch-all agent would be used.",
|
||||
)
|
||||
}
|
||||
|
||||
pub fn handlers_intro_purposes() -> String {
|
||||
let mut message = String::new();
|
||||
|
||||
message.push_str("The following purposes are available:");
|
||||
message.push('\n');
|
||||
|
||||
for purpose in AgentPurpose::choices() {
|
||||
message.push_str(&format!(
|
||||
"\n- {} {}: {}",
|
||||
purpose.emoji(),
|
||||
purpose.as_str(),
|
||||
super::super::agent::purpose_howto(purpose),
|
||||
));
|
||||
}
|
||||
|
||||
message
|
||||
}
|
||||
|
||||
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`")
|
||||
}
|
||||
|
||||
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`")
|
||||
}
|
||||
|
||||
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`")
|
||||
}
|
||||
|
||||
pub fn text_generation_heading() -> String {
|
||||
format!(
|
||||
"{} {}",
|
||||
AgentPurpose::TextGeneration.emoji(),
|
||||
AgentPurpose::TextGeneration.heading()
|
||||
)
|
||||
}
|
||||
|
||||
pub fn text_generation_common() -> String {
|
||||
let text_generation_description =
|
||||
"Text Generation is the bot's ability to generate text based on the input it receives.";
|
||||
|
||||
let input_types = format!(
|
||||
"This input may be received directly as text, or as audio (a voice message) transcribed to text by the bot itself (see {} {}).",
|
||||
AgentPurpose::SpeechToText.emoji(),
|
||||
AgentPurpose::SpeechToText.heading()
|
||||
);
|
||||
|
||||
format!("{}\n{}", text_generation_description, input_types)
|
||||
}
|
||||
|
||||
pub fn text_generation_prefix_requirement_type_heading() -> &'static str {
|
||||
"🗟 Prefix Requirement Type"
|
||||
}
|
||||
|
||||
pub fn text_generation_prefix_requirement_type_intro() -> String {
|
||||
"Controls whether all messages trigger text generation or just those prefixed in a certain way."
|
||||
.to_owned()
|
||||
}
|
||||
|
||||
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}`).")
|
||||
}
|
||||
|
||||
pub fn text_generation_auto_usage_heading() -> &'static str {
|
||||
"🪄 Auto usage"
|
||||
}
|
||||
|
||||
pub fn text_generation_auto_usage_intro() -> String {
|
||||
"Controls how automatic text-generation functions.".to_owned()
|
||||
}
|
||||
|
||||
pub fn text_generation_context_management_heading() -> &'static str {
|
||||
"♻️ Context Management"
|
||||
}
|
||||
|
||||
pub fn text_generation_context_management_intro() -> String {
|
||||
format!(
|
||||
"{}\n{}",
|
||||
"Controls the bot's ability to **intelligently drop old messages from the conversation context** when it gets too large.",
|
||||
"This feature relies on [tokenization](https://en.wikipedia.org/wiki/Large_language_model#Tokenization) performed by the [tiktoken-rs](https://github.com/zurawiki/tiktoken-rs) library which is [poorly well-maintained](https://github.com/zurawiki/tiktoken-rs/issues/50) and only works well for [OpenAI](./providers.md#openai) models.",
|
||||
)
|
||||
}
|
||||
|
||||
pub fn text_generation_prompt_override_heading() -> &'static str {
|
||||
"⌨️ Prompt Override"
|
||||
}
|
||||
|
||||
pub fn text_generation_prompt_override_intro() -> String {
|
||||
"Lets you override the [system prompt](https://huggingface.co/docs/transformers/en/tasks/prompting) parameter configured at the agent level.".to_string()
|
||||
}
|
||||
|
||||
pub fn text_generation_temperature_override_heading() -> &'static str {
|
||||
"🌡️ Temperature Override"
|
||||
}
|
||||
|
||||
pub fn text_generation_temperature_override_intro() -> String {
|
||||
"Lets you override the [temperature](https://blogs.novita.ai/what-are-large-language-model-settings-temperature-top-p-and-max-tokens/#what-is-llm-temperature) (randomness / creativity) parameter configured at the agent level.".to_string()
|
||||
}
|
||||
|
||||
pub fn current_setting_show(command_prefix: &str, setting_path_parts: &str) -> String {
|
||||
format!(
|
||||
"**Show** the current setting: `{command_prefix} config CONFIG_TYPE {setting_path_parts}`"
|
||||
)
|
||||
}
|
||||
|
||||
pub fn current_setting_set(command_prefix: &str, setting_path_parts: &str) -> String {
|
||||
format!("**Set**: `{command_prefix} config CONFIG_TYPE {setting_path_parts}`")
|
||||
}
|
||||
|
||||
pub fn current_setting_unset(command_prefix: &str, setting_path_parts: &str) -> String {
|
||||
format!("**Unset**: `{command_prefix} config CONFIG_TYPE {setting_path_parts}`")
|
||||
}
|
||||
|
||||
pub fn the_following_configuration_values_are_recognized(
|
||||
values: Vec<impl std::fmt::Display>,
|
||||
) -> String {
|
||||
let values_with_backticks = values
|
||||
.iter()
|
||||
.map(|v| format!("`{}`", v))
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
format!(
|
||||
"The following configuration values are recognized: {}",
|
||||
values_with_backticks.join(", ")
|
||||
)
|
||||
}
|
||||
|
||||
pub fn speech_to_text_heading() -> String {
|
||||
format!(
|
||||
"{} {}",
|
||||
AgentPurpose::SpeechToText.emoji(),
|
||||
AgentPurpose::SpeechToText.heading()
|
||||
)
|
||||
}
|
||||
|
||||
pub fn speech_to_text_common() -> String {
|
||||
let intro = "Speech-to-Text is the bot's ability to **turn audio (voice) messages into text**.";
|
||||
|
||||
let text_gen = format!(
|
||||
"The generated text can be used for {} {}, or not (transcription only).",
|
||||
AgentPurpose::TextGeneration.emoji(),
|
||||
AgentPurpose::TextGeneration.heading()
|
||||
);
|
||||
|
||||
let text_to_speech = format!(
|
||||
"The bot may also turn the generated text response back into a voice message (see {} {}).",
|
||||
AgentPurpose::TextToSpeech.emoji(),
|
||||
AgentPurpose::TextToSpeech.heading()
|
||||
);
|
||||
|
||||
format!("{}\n{}\n{}", intro, text_gen, text_to_speech)
|
||||
}
|
||||
|
||||
pub fn speech_to_text_flow_type_heading() -> &'static str {
|
||||
"🪄 Flow Type"
|
||||
}
|
||||
|
||||
pub fn speech_to_text_flow_type_intro() -> &'static str {
|
||||
"Controls how voice messages are handled."
|
||||
}
|
||||
|
||||
pub fn speech_to_text_language_heading() -> &'static str {
|
||||
"🔤 Language"
|
||||
}
|
||||
|
||||
pub fn speech_to_text_language_intro() -> &'static str {
|
||||
"Lets you specify the language of the input voice messages, to avoid using auto-detection.\nSupplying the input language using a 2-letter code (e.g. `ja`) as per [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) may improve accuracy & latency.\n\nIf different users are using different languages, do not specify a language."
|
||||
}
|
||||
|
||||
pub fn text_to_speech_heading() -> String {
|
||||
format!(
|
||||
"{} {}",
|
||||
AgentPurpose::TextToSpeech.emoji(),
|
||||
AgentPurpose::TextToSpeech.heading()
|
||||
)
|
||||
}
|
||||
|
||||
pub fn text_to_speech_common() -> &'static str {
|
||||
"Text-to-Speech is the bot's ability to **turn text messages into voice messages**."
|
||||
}
|
||||
|
||||
pub fn text_to_speech_bot_msgs_flow_type_heading() -> &'static str {
|
||||
"🪄 Bot Messages Flow Type"
|
||||
}
|
||||
|
||||
pub fn text_to_speech_bot_msgs_flow_type_intro() -> String {
|
||||
"Controls how automatic text-to-speech functions for **messages sent by the bot**.".to_owned()
|
||||
}
|
||||
|
||||
pub fn text_to_speech_user_msgs_flow_type_heading() -> &'static str {
|
||||
"🪄 User Messages Flow Type"
|
||||
}
|
||||
|
||||
pub fn text_to_speech_user_msgs_flow_type_intro() -> String {
|
||||
"Controls how automatic text-to-speech functions for **messages sent by users**.\n**Only works when automatic text-generation is disabled** (see Text Generation / Auto usage).".to_owned()
|
||||
}
|
||||
|
||||
pub fn text_to_speech_speed_override_heading() -> &'static str {
|
||||
"🗲 Speed override"
|
||||
}
|
||||
|
||||
pub fn text_to_speech_speed_override_intro() -> String {
|
||||
format!(
|
||||
"{}\n{}",
|
||||
"Lets you speed up/down speech relative to the default speed (`1.0` when unset).",
|
||||
"Values typically range from `0.25` to `4.0`, but may vary depending on the selected model.",
|
||||
)
|
||||
}
|
||||
|
||||
pub fn text_to_speech_voice_override_heading() -> &'static str {
|
||||
"👫 Voice override"
|
||||
}
|
||||
|
||||
pub fn text_to_speech_voice_override_intro() -> String {
|
||||
format!(
|
||||
"{}\n\n{}",
|
||||
"Lets you change the default voice configured in the agent configuration.",
|
||||
"Possible values (e.g. `onyx`) depend on the model you're using. For example, for OpenAI's Whisper model, [these voices](https://platform.openai.com/docs/guides/text-to-speech/voice-options) are available.",
|
||||
)
|
||||
}
|
||||
|
||||
pub fn image_generation_heading() -> String {
|
||||
format!(
|
||||
"{} {}",
|
||||
AgentPurpose::ImageGeneration.emoji(),
|
||||
AgentPurpose::ImageGeneration.heading()
|
||||
)
|
||||
}
|
||||
|
||||
pub fn image_generation_common() -> &'static str {
|
||||
"Image-generation is the bot's ability to **generate images** based on text prompts.\n\nThis feature is not configurable at the moment."
|
||||
}
|
||||
17
src/strings/help/mod.rs
Normal file
17
src/strings/help/mod.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
pub mod access;
|
||||
pub mod agent;
|
||||
pub mod cfg;
|
||||
pub mod provider;
|
||||
pub mod usage;
|
||||
|
||||
pub fn heading_introduction() -> String {
|
||||
"👋 Introduction".to_owned()
|
||||
}
|
||||
|
||||
pub fn available_commands_intro() -> &'static str {
|
||||
"You can run the following commands:"
|
||||
}
|
||||
|
||||
pub fn learn_more_send_a_command(command_prefix: &str, command_parts: &str) -> String {
|
||||
format!("To learn more, send a `{command_prefix} {command_parts}` command.")
|
||||
}
|
||||
7
src/strings/help/provider.rs
Normal file
7
src/strings/help/provider.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
pub fn heading() -> String {
|
||||
"☁️ Providers".to_owned()
|
||||
}
|
||||
|
||||
pub fn intro() -> String {
|
||||
"Agents are powered by a provider. The provider could be powered by a local service or a cloud service.".to_string()
|
||||
}
|
||||
7
src/strings/help/usage.rs
Normal file
7
src/strings/help/usage.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
pub fn heading() -> &'static str {
|
||||
"📖 Usage"
|
||||
}
|
||||
|
||||
pub fn intro() -> &'static str {
|
||||
"The bot can perform various tasks, such as 💬 Text Generation, 🗣️ Text-to-Speech, 🦻 Speech-to-Text, 🖌️ Image Generation, and more."
|
||||
}
|
||||
Reference in New Issue
Block a user