Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea760ce755 | ||
|
|
1528df6a55 | ||
|
|
b0fa024297 | ||
|
|
3ec203128a | ||
|
|
da97361e1b | ||
|
|
b430fe0189 | ||
|
|
f03126a9e1 | ||
|
|
7d46b926c1 | ||
|
|
6f3c048195 | ||
|
|
b47cf598b5 | ||
|
|
265ad7e1cb | ||
|
|
a159f67e45 | ||
|
|
624b9de35b | ||
|
|
941bf7ca42 | ||
|
|
ef0f1671da | ||
|
|
b43f61f5ff | ||
|
|
1967d2b34c | ||
|
|
bb3734ad24 | ||
|
|
eb6db34177 | ||
|
|
6e845caa2e | ||
|
|
1004966785 | ||
|
|
7ae1864c2e | ||
|
|
68a2fb161f | ||
|
|
3a3eb58d7b | ||
|
|
74d988e650 | ||
|
|
ed8bedcd7e | ||
|
|
2842632969 | ||
|
|
10a5bd2abb | ||
|
|
5308b75f52 | ||
|
|
dad61e1270 | ||
|
|
91986a129c | ||
|
|
264f683d6a | ||
|
|
62f0f4fa0d | ||
|
|
69627abd74 | ||
|
|
d2660be33c |
40
CHANGELOG.md
40
CHANGELOG.md
@@ -1,3 +1,43 @@
|
|||||||
|
# (2025-11-20) Version 1.8.2
|
||||||
|
|
||||||
|
- (**Internal Improvement**) Dependency and compiler updates (Rust 1.89.0 -> 1.91.1).
|
||||||
|
|
||||||
|
# (2025-09-12) Version 1.8.1
|
||||||
|
|
||||||
|
- (**Internal Improvement**) Dependency updates.
|
||||||
|
|
||||||
|
# (2025-09-08) Version 1.8.0
|
||||||
|
|
||||||
|
- (**Internal Improvement**) Upgrade [mxlink](https://crates.io/crates/mxlink) (1.9.0 -> 1.10.0) and [matrix-sdk](https://crates.io/crates/matrix-sdk) (0.13.0 -> 0.14.0)
|
||||||
|
|
||||||
|
- (**Internal Improvement**) Upgrade [Rust](https://www.rust-lang.org/) (1.88.0 -> 1.89.0)
|
||||||
|
|
||||||
|
- (**Internal Improvement**) Upgrade Debian base for container images (12/bookworm -> 13/trixie)
|
||||||
|
|
||||||
|
# (2025-07-11) Version 1.7.6
|
||||||
|
|
||||||
|
- (**Internal Improvement**) Dependency updates. This version is based on [mxlink](https://crates.io/crates/mxlink)@1.9.0 (which is based on the newly released [matrix-sdk](https://crates.io/crates/matrix-sdk)@[0.13.0](https://github.com/matrix-org/matrix-rust-sdk/releases/tag/matrix-sdk-0.13.0), which contains fixes for some security vulnerabilities)
|
||||||
|
|
||||||
|
# (2025-06-10) Version 1.7.5
|
||||||
|
|
||||||
|
- (**Internal Improvement**) Dependency and compiler updates (Rust 1.86 -> 1.86).
|
||||||
|
|
||||||
|
# (2025-06-10) Version 1.7.4
|
||||||
|
|
||||||
|
- (**Internal Improvement**) Dependency updates.
|
||||||
|
|
||||||
|
# (2025-06-10) Version 1.7.3
|
||||||
|
|
||||||
|
- (**Internal Improvement**) Dependency updates. This version is based on [mxlink](https://crates.io/crates/mxlink)@1.8.0 (which is based on the newly released [matrix-sdk](https://crates.io/crates/matrix-sdk)@[0.12.0](https://github.com/matrix-org/matrix-rust-sdk/releases/tag/matrix-sdk-0.12.0), which contains fixes for important security vulnerabilities)
|
||||||
|
|
||||||
|
# (2025-05-11) Version 1.7.2
|
||||||
|
|
||||||
|
- (**Bugfix**) Allow `image_generation.size` configuration value for OpenAI to be `null` to allow the model to choose the size automatically and default to that
|
||||||
|
|
||||||
|
# (2025-05-11) Version 1.7.1
|
||||||
|
|
||||||
|
- (**Bugfix**) Fix lack of documentation for the new [image-editing](./docs/features.md#-image-editing) feature in the `!bai usage` command's output
|
||||||
|
|
||||||
# (2025-05-10) Version 1.7.0
|
# (2025-05-10) Version 1.7.0
|
||||||
|
|
||||||
- (**Feature**) Add vision support to the OpenAI and Anthropic providers. You can now mix text and images in your conversations - fixes [issue #5](https://github.com/etkecc/baibot/issues/5)
|
- (**Feature**) Add vision support to the OpenAI and Anthropic providers. You can now mix text and images in your conversations - fixes [issue #5](https://github.com/etkecc/baibot/issues/5)
|
||||||
|
|||||||
2403
Cargo.lock
generated
2403
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
14
Cargo.toml
14
Cargo.toml
@@ -7,7 +7,7 @@ license = "AGPL-3.0-or-later"
|
|||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
keywords = ["matrix", "chat", "bot", "AI", "LLM"]
|
keywords = ["matrix", "chat", "bot", "AI", "LLM"]
|
||||||
include = ["/etc/assets/baibot-torso-768.png", "/src", "/README.md", "/CHANGELOG.md", "/LICENSE"]
|
include = ["/etc/assets/baibot-torso-768.png", "/src", "/README.md", "/CHANGELOG.md", "/LICENSE"]
|
||||||
version = "1.7.0"
|
version = "1.8.2"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
@@ -22,18 +22,18 @@ base64 = "0.22.*"
|
|||||||
chrono = { version = "0.4.*", default-features = false, features = ["std", "now"] }
|
chrono = { version = "0.4.*", default-features = false, features = ["std", "now"] }
|
||||||
# We'd rather not depend on this, but we cannot use the ruma-events EventContent macro without it.
|
# We'd rather not depend on this, but we cannot use the ruma-events EventContent macro without it.
|
||||||
# We add the `native-tls` feature, because of https://github.com/etkecc/rust-mxlink/issues/1
|
# We add the `native-tls` feature, because of https://github.com/etkecc/rust-mxlink/issues/1
|
||||||
matrix-sdk = { version = "0.11.0", default-features = false, features = ["native-tls"] }
|
matrix-sdk = { version = "0.14.0", default-features = false, features = ["native-tls"] }
|
||||||
mxidwc = "1.0.*"
|
mxidwc = "1.0.*"
|
||||||
mxlink = ">=1.7.0"
|
mxlink = ">=1.10.0"
|
||||||
etke_openai_api_rust = "0.1.*"
|
etke_openai_api_rust = "0.1.*"
|
||||||
quick_cache = "0.6.*"
|
quick_cache = "0.6.*"
|
||||||
regex = "1.11.*"
|
regex = "1.12.*"
|
||||||
serde = { version = "1.0.*", features = ["derive"], default-features = false }
|
serde = { version = "1.0.*", features = ["derive"], default-features = false }
|
||||||
serde_json = "1.0.*"
|
serde_json = "1.0.*"
|
||||||
serde_yaml = "0.9.*"
|
serde_yaml = "0.9.*"
|
||||||
tempfile = "3.19.*"
|
tempfile = "3.23.*"
|
||||||
tiktoken-rs = { version = "0.6.*", features = ["async-openai"] }
|
tiktoken-rs = { version = "0.9.*", default-features = false }
|
||||||
tokio = { version = "1.45.*", features = ["rt", "rt-multi-thread", "macros"] }
|
tokio = { version = "1.48.*", features = ["rt", "rt-multi-thread", "macros"] }
|
||||||
tracing = "0.1.*"
|
tracing = "0.1.*"
|
||||||
tracing-subscriber = { version = "0.3.*", features = ["env-filter"] }
|
tracing-subscriber = { version = "0.3.*", features = ["env-filter"] }
|
||||||
url = "2.5.*"
|
url = "2.5.*"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# #
|
# #
|
||||||
#######################################
|
#######################################
|
||||||
|
|
||||||
FROM docker.io/rust:1.86.0-slim-bookworm AS build
|
FROM docker.io/rust:1.91.1-slim-trixie AS build
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y build-essential pkg-config libssl-dev libsqlite3-dev
|
RUN apt-get update && apt-get install -y build-essential pkg-config libssl-dev libsqlite3-dev
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ RUN --mount=type=cache,target=/target,sharing=locked \
|
|||||||
# #
|
# #
|
||||||
#######################################
|
#######################################
|
||||||
|
|
||||||
FROM docker.io/debian:bookworm-slim
|
FROM docker.io/debian:trixie-slim
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y ca-certificates sqlite3 && \
|
RUN apt-get update && apt-get install -y ca-certificates sqlite3 && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# #
|
# #
|
||||||
#######################################
|
#######################################
|
||||||
|
|
||||||
FROM docker.io/rust:1.86.0-slim-bookworm AS build
|
FROM docker.io/rust:1.91.1-slim-trixie AS build
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y build-essential pkg-config libssl-dev libsqlite3-dev
|
RUN apt-get update && apt-get install -y build-essential pkg-config libssl-dev libsqlite3-dev
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ RUN cargo build --release
|
|||||||
# #
|
# #
|
||||||
#######################################
|
#######################################
|
||||||
|
|
||||||
FROM docker.io/debian:bookworm-slim
|
FROM docker.io/debian:trixie-slim
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y ca-certificates sqlite3 && \
|
RUN apt-get update && apt-get install -y ca-certificates sqlite3 && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ CONTAINER_IMAGE_NAME=ghcr.io/etkecc/baibot:v1.0.0
|
|||||||
--env BAIBOT_PERSISTENCE_DATA_DIR_PATH=/data \
|
--env BAIBOT_PERSISTENCE_DATA_DIR_PATH=/data \
|
||||||
--mount type=bind,src=/path/to/config.yml,dst=/app/config.yml,ro \
|
--mount type=bind,src=/path/to/config.yml,dst=/app/config.yml,ro \
|
||||||
--mount type=bind,src=/path/to/data,dst=/data \
|
--mount type=bind,src=/path/to/data,dst=/data \
|
||||||
|
--tmpfs=/tmp:rw,noexec,nosuid,size=1024m \
|
||||||
$CONTAINER_IMAGE_NAME
|
$CONTAINER_IMAGE_NAME
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -125,10 +125,7 @@ For services which are not fully compatible with the OpenAI API, consider using
|
|||||||
- create a room-local agent: `!bai agent create-room-local openai my-openai-agent`
|
- create a room-local agent: `!bai agent create-room-local openai my-openai-agent`
|
||||||
- create a global agent: `!bai agent create-global openai my-openai-agent`
|
- create a global agent: `!bai agent create-global openai my-openai-agent`
|
||||||
|
|
||||||
💡 When creating an agent, the bot will show you an up-to-date sample configuration for this provider which:
|
💡 When creating an agent, the bot will show you an up-to-date sample configuration for this provider which looks [like this](./sample-provider-configs/openai.yml).
|
||||||
|
|
||||||
- in the general case looks [like this](./sample-provider-configs/openai.yml)
|
|
||||||
- for the [o1](https://platform.openai.com/docs/models/o1) models needs to look [like this](./sample-provider-configs/openai-o1.yml)
|
|
||||||
|
|
||||||
|
|
||||||
### OpenAI Compatible
|
### OpenAI Compatible
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
base_url: https://api.openai.com/v1
|
|
||||||
api_key: YOUR_API_KEY_HERE
|
|
||||||
text_generation:
|
|
||||||
model_id: o1-mini
|
|
||||||
# o1 models do not support a system prompt
|
|
||||||
prompt: null
|
|
||||||
temperature: 1.0
|
|
||||||
# o1 models do not support max_response_tokens.
|
|
||||||
# They use `max_completion_tokens` as an alternative
|
|
||||||
max_response_tokens: null
|
|
||||||
max_completion_tokens: 16384
|
|
||||||
max_context_tokens: 128000
|
|
||||||
speech_to_text:
|
|
||||||
model_id: whisper-1
|
|
||||||
text_to_speech:
|
|
||||||
model_id: tts-1-hd
|
|
||||||
voice: onyx
|
|
||||||
speed: 1.0
|
|
||||||
response_format: opus
|
|
||||||
image_generation:
|
|
||||||
model_id: gpt-image-1
|
|
||||||
style: null
|
|
||||||
size: 1024x1024
|
|
||||||
quality: null
|
|
||||||
@@ -1,11 +1,14 @@
|
|||||||
base_url: https://api.openai.com/v1
|
base_url: https://api.openai.com/v1
|
||||||
api_key: YOUR_API_KEY_HERE
|
api_key: YOUR_API_KEY_HERE
|
||||||
text_generation:
|
text_generation:
|
||||||
model_id: gpt-4.1
|
model_id: gpt-5.1
|
||||||
prompt: "You are a brief, but helpful bot called {{ baibot_name }} powered by the {{ baibot_model_id }} model. The date/time of this conversation's start is: {{ baibot_conversation_start_time_utc }}."
|
prompt: "You are a brief, but helpful bot called {{ baibot_name }} powered by the {{ baibot_model_id }} model. The date/time of this conversation's start is: {{ baibot_conversation_start_time_utc }}."
|
||||||
temperature: 1.0
|
temperature: 1.0
|
||||||
max_response_tokens: 16384
|
# Reasoning models need to use `max_completion_tokens` instead of `max_response_tokens`.
|
||||||
max_context_tokens: 128000
|
# If you're dealing with a non-reasoning model, specify `max_response_tokens` and unset `max_completion_tokens`.
|
||||||
|
max_response_tokens: null
|
||||||
|
max_completion_tokens: 128000
|
||||||
|
max_context_tokens: 400000
|
||||||
speech_to_text:
|
speech_to_text:
|
||||||
model_id: whisper-1
|
model_id: whisper-1
|
||||||
text_to_speech:
|
text_to_speech:
|
||||||
@@ -16,5 +19,5 @@ text_to_speech:
|
|||||||
image_generation:
|
image_generation:
|
||||||
model_id: gpt-image-1
|
model_id: gpt-image-1
|
||||||
style: null
|
style: null
|
||||||
size: 1024x1024
|
size: null
|
||||||
quality: null
|
quality: null
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ Simply send a command like `!bai image create A beautiful sunset over the ocean`
|
|||||||
|
|
||||||
See a [🖼️ Screenshot of the Image Creation feature](./screenshots/image-creation.webp).
|
See a [🖼️ Screenshot of the Image Creation feature](./screenshots/image-creation.webp).
|
||||||
|
|
||||||
You can then, respond in the same message thread with:
|
You can then respond in the same message thread with:
|
||||||
|
|
||||||
- more messages, to add more criteria to your prompt.
|
- more messages, to add more criteria to your prompt.
|
||||||
- a message saying `again`, to generate one more image with the current prompt.
|
- a message saying `again`, to generate one more image with the current prompt.
|
||||||
@@ -91,7 +91,7 @@ Simply send a command like `!bai image edit Turn the following image into an ani
|
|||||||
|
|
||||||
See a [🖼️ Screenshot of the Image Editing feature (manipulating a single image)](./screenshots/image-editing-single-image.webp) and a [🖼️ Screenshot of the Image Editing feature (manipulating multiple images)](./screenshots/image-editing-multiple-images.webp).
|
See a [🖼️ Screenshot of the Image Editing feature (manipulating a single image)](./screenshots/image-editing-single-image.webp) and a [🖼️ Screenshot of the Image Editing feature (manipulating multiple images)](./screenshots/image-editing-multiple-images.webp).
|
||||||
|
|
||||||
You can then, respond in the same message thread with:
|
You can then respond in the same message thread with:
|
||||||
|
|
||||||
- more messages, to add more criteria to your prompt.
|
- more messages, to add more criteria to your prompt.
|
||||||
- one or more images, to provide the images that the bot will operate on.
|
- one or more images, to provide the images that the bot will operate on.
|
||||||
@@ -101,7 +101,7 @@ You can then, respond in the same message thread with:
|
|||||||
|
|
||||||
#### 🫵 Creating stickers
|
#### 🫵 Creating stickers
|
||||||
|
|
||||||
A variation of [creating images](#creating-images) is to create "sticker images".
|
A variation of [creating images](#creating-images) is creating "sticker images".
|
||||||
|
|
||||||
See a [🖼️ Screenshot of the Sticker Creation feature](./screenshots/sticker-generation.webp).
|
See a [🖼️ Screenshot of the Sticker Creation feature](./screenshots/sticker-generation.webp).
|
||||||
|
|
||||||
|
|||||||
@@ -76,13 +76,14 @@ agents:
|
|||||||
# base_url: https://api.openai.com/v1
|
# base_url: https://api.openai.com/v1
|
||||||
# api_key: ""
|
# api_key: ""
|
||||||
# text_generation:
|
# text_generation:
|
||||||
# model_id: gpt-4o
|
# model_id: gpt-5.1
|
||||||
# prompt: "You are a brief, but helpful bot called {{ baibot_name }} powered by the {{ baibot_model_id }} model. The date/time of this conversation's start is: {{ baibot_conversation_start_time_utc }}."
|
# prompt: "You are a brief, but helpful bot called {{ baibot_name }} powered by the {{ baibot_model_id }} model. The date/time of this conversation's start is: {{ baibot_conversation_start_time_utc }}."
|
||||||
# temperature: 1.0
|
# temperature: 1.0
|
||||||
# max_response_tokens: 16384
|
|
||||||
# # Reasoning models need to use `max_completion_tokens` instead of `max_response_tokens`.
|
# # Reasoning models need to use `max_completion_tokens` instead of `max_response_tokens`.
|
||||||
# max_completion_tokens: ~
|
# # If you're dealing with a non-reasoning model, specify `max_response_tokens` and unset `max_completion_tokens`.
|
||||||
# max_context_tokens: 128000
|
# max_response_tokens: null
|
||||||
|
# max_completion_tokens: 128000
|
||||||
|
# max_context_tokens: 400000
|
||||||
# speech_to_text:
|
# speech_to_text:
|
||||||
# model_id: whisper-1
|
# model_id: whisper-1
|
||||||
# text_to_speech:
|
# text_to_speech:
|
||||||
@@ -91,10 +92,10 @@ agents:
|
|||||||
# speed: 1.0
|
# speed: 1.0
|
||||||
# response_format: opus
|
# response_format: opus
|
||||||
# image_generation:
|
# image_generation:
|
||||||
# model_id: dall-e-3
|
# model_id: gpt-image-1
|
||||||
# style: vivid
|
# style: null
|
||||||
# size: 1024x1024
|
# size: null
|
||||||
# quality: standard
|
# quality: null
|
||||||
#
|
#
|
||||||
# - id: localai
|
# - id: localai
|
||||||
# provider: localai
|
# provider: localai
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: docker.io/postgres:16.8-alpine
|
image: docker.io/postgres:18.1-alpine
|
||||||
user: ${UID}:${GID}
|
user: ${UID}:${GID}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
@@ -8,12 +8,13 @@ services:
|
|||||||
POSTGRES_PASSWORD: synapse-password
|
POSTGRES_PASSWORD: synapse-password
|
||||||
POSTGRES_DB: homeserver
|
POSTGRES_DB: homeserver
|
||||||
POSTGRES_INITDB_ARGS: --lc-collate C --lc-ctype C --encoding UTF8
|
POSTGRES_INITDB_ARGS: --lc-collate C --lc-ctype C --encoding UTF8
|
||||||
|
PGDATA: /data
|
||||||
volumes:
|
volumes:
|
||||||
- ./postgres:/var/lib/postgresql/data
|
- ./postgres:/data
|
||||||
- /etc/passwd:/etc/passwd:ro
|
- /etc/passwd:/etc/passwd:ro
|
||||||
|
|
||||||
synapse:
|
synapse:
|
||||||
image: ghcr.io/element-hq/synapse:v1.129.0
|
image: ghcr.io/element-hq/synapse:v1.142.1
|
||||||
user: "${UID}:${GID}"
|
user: "${UID}:${GID}"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
entrypoint: python
|
entrypoint: python
|
||||||
@@ -26,7 +27,7 @@ services:
|
|||||||
- ./synapse/media-store:/media-store
|
- ./synapse/media-store:/media-store
|
||||||
|
|
||||||
element-web:
|
element-web:
|
||||||
image: ghcr.io/element-hq/element-web:v1.11.100
|
image: ghcr.io/element-hq/element-web:v1.12.4
|
||||||
user: "${UID}:${GID}"
|
user: "${UID}:${GID}"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
ollama:
|
ollama:
|
||||||
image: docker.io/ollama/ollama:0.6.8
|
image: docker.io/ollama/ollama:0.13.0
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "${SERVICE_OLLAMA_BIND_PORT_HTTP}:11434"
|
- "${SERVICE_OLLAMA_BIND_PORT_HTTP}:11434"
|
||||||
|
|||||||
@@ -72,15 +72,15 @@ impl Default for TextGenerationConfig {
|
|||||||
model_id: default_text_model_id(),
|
model_id: default_text_model_id(),
|
||||||
prompt: Some(default_prompt().to_owned()),
|
prompt: Some(default_prompt().to_owned()),
|
||||||
temperature: super::super::default_temperature(),
|
temperature: super::super::default_temperature(),
|
||||||
max_response_tokens: Some(16_384),
|
max_response_tokens: None,
|
||||||
max_completion_tokens: None,
|
max_completion_tokens: Some(128_000),
|
||||||
max_context_tokens: 128_000,
|
max_context_tokens: 400_000,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_text_model_id() -> String {
|
fn default_text_model_id() -> String {
|
||||||
"gpt-4.1".to_owned()
|
"gpt-5.1".to_owned()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
@@ -153,7 +153,7 @@ pub struct ImageGenerationConfig {
|
|||||||
pub style: Option<async_openai::types::ImageStyle>,
|
pub style: Option<async_openai::types::ImageStyle>,
|
||||||
|
|
||||||
#[serde(default = "default_image_size")]
|
#[serde(default = "default_image_size")]
|
||||||
pub size: async_openai::types::ImageSize,
|
pub size: Option<async_openai::types::ImageSize>,
|
||||||
|
|
||||||
#[serde(default = "default_image_quality")]
|
#[serde(default = "default_image_quality")]
|
||||||
pub quality: Option<async_openai::types::ImageQuality>,
|
pub quality: Option<async_openai::types::ImageQuality>,
|
||||||
@@ -186,8 +186,8 @@ fn default_image_style() -> Option<async_openai::types::ImageStyle> {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_image_size() -> async_openai::types::ImageSize {
|
fn default_image_size() -> Option<async_openai::types::ImageSize> {
|
||||||
async_openai::types::ImageSize::S1024x1024
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_image_quality() -> Option<async_openai::types::ImageQuality> {
|
fn default_image_quality() -> Option<async_openai::types::ImageQuality> {
|
||||||
|
|||||||
@@ -284,11 +284,8 @@ impl ControllerTrait for Controller {
|
|||||||
|
|
||||||
let size = params
|
let size = params
|
||||||
.size_override
|
.size_override
|
||||||
.map(|s| {
|
.map(|s| convert_string_to_enum::<async_openai::types::ImageSize>(&s).unwrap())
|
||||||
convert_string_to_enum::<async_openai::types::ImageSize>(&s)
|
.or(image_generation_config.size);
|
||||||
.unwrap_or(image_generation_config.size)
|
|
||||||
})
|
|
||||||
.unwrap_or(image_generation_config.size);
|
|
||||||
|
|
||||||
let response_format = match model.clone() {
|
let response_format = match model.clone() {
|
||||||
ImageModel::DallE2 => Some(ImageResponseFormat::B64Json),
|
ImageModel::DallE2 => Some(ImageResponseFormat::B64Json),
|
||||||
@@ -303,10 +300,7 @@ impl ControllerTrait for Controller {
|
|||||||
|
|
||||||
let mut request_builder = CreateImageRequestArgs::default();
|
let mut request_builder = CreateImageRequestArgs::default();
|
||||||
|
|
||||||
request_builder
|
request_builder.model(model).prompt(prompt.to_owned());
|
||||||
.model(model)
|
|
||||||
.prompt(prompt.to_owned())
|
|
||||||
.size(size);
|
|
||||||
|
|
||||||
if let Some(response_format) = response_format {
|
if let Some(response_format) = response_format {
|
||||||
request_builder.response_format(response_format);
|
request_builder.response_format(response_format);
|
||||||
@@ -320,6 +314,10 @@ impl ControllerTrait for Controller {
|
|||||||
request_builder.quality(quality.clone());
|
request_builder.quality(quality.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(size) = size {
|
||||||
|
request_builder.size(size);
|
||||||
|
}
|
||||||
|
|
||||||
let request = request_builder.build()?;
|
let request = request_builder.build()?;
|
||||||
|
|
||||||
tracing::trace!(
|
tracing::trace!(
|
||||||
@@ -382,9 +380,9 @@ impl ControllerTrait for Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let dalle2_size = match image_generation_config.size {
|
let dalle2_size = match image_generation_config.size {
|
||||||
async_openai::types::ImageSize::S256x256 => Some(DallE2ImageSize::S256x256),
|
Some(async_openai::types::ImageSize::S256x256) => Some(DallE2ImageSize::S256x256),
|
||||||
async_openai::types::ImageSize::S512x512 => Some(DallE2ImageSize::S512x512),
|
Some(async_openai::types::ImageSize::S512x512) => Some(DallE2ImageSize::S512x512),
|
||||||
async_openai::types::ImageSize::S1024x1024 => Some(DallE2ImageSize::S1024x1024),
|
Some(async_openai::types::ImageSize::S1024x1024) => Some(DallE2ImageSize::S1024x1024),
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -224,9 +224,11 @@ impl TryInto<OpenAIImageGenerationConfig> for ImageGenerationConfig {
|
|||||||
|
|
||||||
fn try_into(self) -> Result<OpenAIImageGenerationConfig, Self::Error> {
|
fn try_into(self) -> Result<OpenAIImageGenerationConfig, Self::Error> {
|
||||||
let size = if let Some(size) = &self.size {
|
let size = if let Some(size) = &self.size {
|
||||||
convert_string_to_enum::<async_openai::types::ImageSize>(size)?
|
Some(convert_string_to_enum::<async_openai::types::ImageSize>(
|
||||||
|
size,
|
||||||
|
)?)
|
||||||
} else {
|
} else {
|
||||||
async_openai::types::ImageSize::S1024x1024
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
let style = if let Some(style) = &self.style {
|
let style = if let Some(style) = &self.style {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use mxlink::matrix_sdk::media::{MediaFormat, MediaRequestParameters};
|
|||||||
use mxlink::matrix_sdk::ruma::{
|
use mxlink::matrix_sdk::ruma::{
|
||||||
MilliSecondsSinceUnixEpoch, OwnedUserId, events::room::MediaSource,
|
MilliSecondsSinceUnixEpoch, OwnedUserId, events::room::MediaSource,
|
||||||
};
|
};
|
||||||
|
use mxlink::matrix_sdk::ruma::api::client::profile::{AvatarUrl, DisplayName};
|
||||||
|
|
||||||
use mxlink::{
|
use mxlink::{
|
||||||
InitConfig, LoginConfig, LoginCredentials, LoginEncryption, MatrixLink, PersistenceConfig,
|
InitConfig, LoginConfig, LoginCredentials, LoginEncryption, MatrixLink, PersistenceConfig,
|
||||||
@@ -285,24 +286,27 @@ impl Bot {
|
|||||||
async fn do_prepare_profile(&self) -> anyhow::Result<()> {
|
async fn do_prepare_profile(&self) -> anyhow::Result<()> {
|
||||||
tracing::debug!("Preparing profile..");
|
tracing::debug!("Preparing profile..");
|
||||||
|
|
||||||
|
let desired_display_name = self.inner.config.user.name.clone();
|
||||||
|
|
||||||
let account = self.inner.matrix_link.client().account();
|
let account = self.inner.matrix_link.client().account();
|
||||||
let media = self.inner.matrix_link.client().media();
|
let media = self.inner.matrix_link.client().media();
|
||||||
|
|
||||||
let desired_display_name = self.inner.config.user.name.clone();
|
|
||||||
|
|
||||||
let profile = account
|
let profile = account
|
||||||
.fetch_user_profile()
|
.fetch_user_profile()
|
||||||
.await
|
.await
|
||||||
.map_err(|e| anyhow::anyhow!("Failed fetching profile: {:?}", e))?;
|
.map_err(|e| anyhow::anyhow!("Failed fetching profile: {:?}", e))?;
|
||||||
|
|
||||||
let should_update_display_name = match &profile.displayname {
|
let current_display_name = profile.get_static::<DisplayName>()?;
|
||||||
|
let current_avatar_url = profile.get_static::<AvatarUrl>()?;
|
||||||
|
|
||||||
|
let should_update_display_name = match ¤t_display_name {
|
||||||
Some(displayname) => displayname != &desired_display_name,
|
Some(displayname) => displayname != &desired_display_name,
|
||||||
None => true,
|
None => true,
|
||||||
};
|
};
|
||||||
|
|
||||||
if should_update_display_name {
|
if should_update_display_name {
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
?profile.displayname,
|
?current_display_name,
|
||||||
?desired_display_name,
|
?desired_display_name,
|
||||||
"Updating display name.."
|
"Updating display name.."
|
||||||
);
|
);
|
||||||
@@ -312,7 +316,7 @@ impl Bot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let should_update_avatar = match &profile.avatar_url {
|
let should_update_avatar = match ¤t_avatar_url {
|
||||||
Some(avatar_url) => {
|
Some(avatar_url) => {
|
||||||
let request = MediaRequestParameters {
|
let request = MediaRequestParameters {
|
||||||
source: MediaSource::Plain(avatar_url.to_owned()),
|
source: MediaSource::Plain(avatar_url.to_owned()),
|
||||||
|
|||||||
@@ -3,5 +3,5 @@ pub fn heading() -> &'static str {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn intro() -> &'static str {
|
pub fn intro() -> &'static str {
|
||||||
"The bot can perform various tasks, such as 💬 Text Generation, 🗣️ Text-to-Speech, 🦻 Speech-to-Text, 🖌️ Image Creation, and more."
|
"The bot can perform various tasks, such as 💬 Text Generation, 🗣️ Text-to-Speech, 🦻 Speech-to-Text, 🖌️ Image Generation, and more."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,20 +34,31 @@ By default, the bot will also perform 💬 Text Generation on the text. This is
|
|||||||
If all your messages are in the same language, you can improve accuracy & latency by configuring the language via the **🦻 Speech-to-Text / 🔤 Language** setting.
|
If all your messages are in the same language, you can improve accuracy & latency by configuring the language via the **🦻 Speech-to-Text / 🔤 Language** setting.
|
||||||
|
|
||||||
|
|
||||||
### 🖌️ Image Creation
|
### Image Generation
|
||||||
|
|
||||||
#### Creating images
|
#### 🖌️ Creating images
|
||||||
|
|
||||||
Simply send a command like `%command_prefix% image create A beautiful sunset over the ocean` and the bot will start a threaded conversation and post an image based on your prompt.
|
Simply send a command like `%command_prefix% image create A beautiful sunset over the ocean` and the bot will start a threaded conversation and post an image based on your prompt.
|
||||||
|
|
||||||
You can then, respond in the same message thread with:
|
You can then respond in the same message thread with:
|
||||||
|
|
||||||
- more messages, to add more criteria to your prompt.
|
- more messages, to add more criteria to your prompt.
|
||||||
- a message saying `again`, to generate one more image with the current prompt.
|
- a message saying `again`, to generate one more image with the current prompt.
|
||||||
|
|
||||||
#### Creating stickers
|
#### 🎨 Editing images
|
||||||
|
|
||||||
A variation of **creating images** is to create "sticker images".
|
Simply send a command like `%command_prefix% image edit Turn the following image into an anime-style drawing` and the bot will start a threaded conversation asking for more details.
|
||||||
|
|
||||||
|
You can then respond in the same message thread with:
|
||||||
|
|
||||||
|
- more messages, to add more criteria to your prompt.
|
||||||
|
- one or more images, to provide the images that the bot will operate on.
|
||||||
|
- a message saying `go`, to start the image generation process.
|
||||||
|
- a message saying `again`, to prompt the bot to generate one more image edit with the current prompt.
|
||||||
|
|
||||||
|
#### 🫵 Creating stickers
|
||||||
|
|
||||||
|
A variation of **creating images** is creating "sticker images".
|
||||||
|
|
||||||
To create a sticker, send a command like `%command_prefix% sticker A huge bowl of steaming ramen with a mountain of beansprouts on top`.
|
To create a sticker, send a command like `%command_prefix% sticker A huge bowl of steaming ramen with a mountain of beansprouts on top`.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user