Matrix bots
This commit is contained in:
@@ -0,0 +1,185 @@
|
||||
---
|
||||
# tasks file for baibot
|
||||
- name: Create Baibot namespace
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: baibot
|
||||
|
||||
- name: Create a ConfigMap for Baibot
|
||||
k8s:
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: config
|
||||
namespace: baibot
|
||||
data:
|
||||
config.yml: |
|
||||
homeserver:
|
||||
# The canonical homeserver domain name
|
||||
server_name: synapse.eom.dev
|
||||
url: https://synapse.eom.dev/
|
||||
user:
|
||||
mxid_localpart: localai
|
||||
password: {{ localai_admin_password }}
|
||||
# The name the bot uses as a display name and when it refers to itself.
|
||||
# Leave empty to use the default (baibot).
|
||||
name: LocalAI
|
||||
encryption:
|
||||
# An optional passphrase to use for backing up and recovering the bot's encryption keys.
|
||||
# You can use any string here.
|
||||
#
|
||||
# If set to null, the recovery module will not be used and losing your session/database (see persistence)
|
||||
# will mean you lose access to old messages in encrypted room.
|
||||
#
|
||||
# Changing this subsequently will also cause you to lose access to old messages in encrypted rooms.
|
||||
# If you really need to change this:
|
||||
# - Set `encryption_recovery_reset_allowed` to `true` and adjust the passphrase
|
||||
# - Remove your session file and database (see persistence)
|
||||
# - Restart the bot
|
||||
# - Then restore `encryption_recovery_reset_allowed` to `false` to prevent accidental resets in the future
|
||||
recovery_passphrase: {{ localai_matrix_recovery_key }}
|
||||
# An optional flag to reset the encryption recovery passphrase.
|
||||
recovery_reset_allowed: false
|
||||
# Command prefix. Leave empty to use the default (!bai).
|
||||
command_prefix: "!bai"
|
||||
room:
|
||||
# Whether the bot should send an introduction message after joining a room.
|
||||
post_join_self_introduction_enabled: true
|
||||
access:
|
||||
# Space-separated list of MXID patterns which specify who is an admin.
|
||||
admin_patterns:
|
||||
- "@eric:eom.dev"
|
||||
persistence:
|
||||
# This is unset here, because we expect the configuration to come from an environment variable (BAIBOT_PERSISTENCE_DATA_DIR_PATH).
|
||||
# In your setup, you may wish to set this to a directory path.
|
||||
data_dir_path: null
|
||||
# An optional secret for encrypting the bot's session data (stored in data_dir_path).
|
||||
# This must be 32-bytes (64 characters when HEX-encoded).
|
||||
# Generate it with: `openssl rand -hex 32`
|
||||
# Leave null or empty to avoid using encryption.
|
||||
# Changing this subsequently requires that you also throw away all data stored in data_dir_path.
|
||||
session_encryption_key: {{ baibot_session_encryption_key }}
|
||||
# An optional secret for encrypting bot configuration stored in Matrix's account data.
|
||||
# This must be 32-bytes (64 characters when HEX-encoded).
|
||||
# Generate it with: `openssl rand -hex 32`
|
||||
# Leave null or empty to avoid using encryption.
|
||||
# Changing this subsequently will make you lose your configuration.
|
||||
config_encryption_key: {{ baibot_config_encryption_key }}
|
||||
agents:
|
||||
# A list of statically-defined agents.
|
||||
#
|
||||
# Below are a few common choices on popular providers, preconfigured for development purposes (see docs/development.md).
|
||||
# You may enable some of the ones you see below or define others.
|
||||
# You can also leave this list empty and only define agents dynamically (via chat).
|
||||
#
|
||||
# Uncomment one or more of these and potentially adjust their configuration (API key, etc).
|
||||
# Consider setting `initial_global_config.handler.*` to an agent that you enable here.
|
||||
static_definitions:
|
||||
- id: localai
|
||||
provider: localai
|
||||
config:
|
||||
base_url: https://localai.eom.dev/v1
|
||||
api_key: {{ localai_api_keys[1] }}
|
||||
text_generation:
|
||||
model_id: llama3-instruct
|
||||
prompt: "You are a brief, but helpful bot called LocalAI powered by the llama3-8b-instruct model. Format all responses in markdown."
|
||||
temperature: 1.0
|
||||
max_response_tokens: 16384
|
||||
max_context_tokens: 128000
|
||||
speech_to_text:
|
||||
model_id: whisper-1
|
||||
text_to_speech:
|
||||
model_id: tts-1
|
||||
voice: onyx
|
||||
speed: 1.0
|
||||
response_format: opus
|
||||
image_generation:
|
||||
model_id: stablediffusion
|
||||
style: vivid
|
||||
# Intentionally defaults to a small value to improve performance
|
||||
size: 256x256
|
||||
quality: standard
|
||||
# Initial global configuration. This only affects the first run of the bot.
|
||||
# Configuration is later managed at runtime.
|
||||
initial_global_config:
|
||||
handler:
|
||||
catch_all: static/localai
|
||||
text_generation: static/localai
|
||||
text_to_speech: static/localai
|
||||
speech_to_text: static/localai
|
||||
image_generation: static/localai
|
||||
# Space-separated list of MXID patterns which specify who can use the bot.
|
||||
# By default, we let anyone on the homeserver use the bot.
|
||||
user_patterns:
|
||||
- "@*:*"
|
||||
# Controls logging.
|
||||
#
|
||||
# Sets all tracing targets (external crates) to warn, and our own logs to debug.
|
||||
# For even more verbose logging, one may also use trace.
|
||||
#
|
||||
# matrix_sdk_crypto may be chatty and could be added with an error level.
|
||||
#
|
||||
# Learn more here: https://stackoverflow.com/a/73735203
|
||||
logging: warn,mxlink=debug,baibot=debug
|
||||
|
||||
- name: Create a persistent volume claim for Baibot
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: data
|
||||
namespace: baibot
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 256Gi
|
||||
|
||||
- name: Create a Deployment for Baibot
|
||||
k8s:
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: baibot
|
||||
namespace: baibot
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: baibot
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: baibot
|
||||
spec:
|
||||
containers:
|
||||
- name: baibot
|
||||
image: ghcr.io/etkecc/baibot
|
||||
tag: v1.0.0
|
||||
env:
|
||||
- name: BAIBOT_PERSISTENCE_DATA_DIR_PATH
|
||||
value: /data
|
||||
- name: BAIBOT_CONFIG_FILE_PATH
|
||||
value: /config/config.yml
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /config
|
||||
- name: data
|
||||
mountPath: /data
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: data
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
|
||||
Reference in New Issue
Block a user