Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e845caa2e | ||
|
|
1004966785 | ||
|
|
7ae1864c2e | ||
|
|
68a2fb161f | ||
|
|
3a3eb58d7b | ||
|
|
74d988e650 | ||
|
|
ed8bedcd7e | ||
|
|
2842632969 | ||
|
|
10a5bd2abb | ||
|
|
5308b75f52 | ||
|
|
dad61e1270 | ||
|
|
91986a129c | ||
|
|
264f683d6a |
16
CHANGELOG.md
16
CHANGELOG.md
@@ -1,3 +1,19 @@
|
|||||||
|
# (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
|
# (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
|
- (**Bugfix**) Fix lack of documentation for the new [image-editing](./docs/features.md#-image-editing) feature in the `!bai usage` command's output
|
||||||
|
|||||||
1342
Cargo.lock
generated
1342
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
10
Cargo.toml
10
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.1"
|
version = "1.7.5"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
@@ -22,17 +22,17 @@ 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.12.0", default-features = false, features = ["native-tls"] }
|
||||||
mxidwc = "1.0.*"
|
mxidwc = "1.0.*"
|
||||||
mxlink = ">=1.7.0"
|
mxlink = ">=1.8.1"
|
||||||
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.11.*"
|
||||||
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.20.*"
|
||||||
tiktoken-rs = { version = "0.6.*", features = ["async-openai"] }
|
tiktoken-rs = { version = "0.7.*", default-features = false }
|
||||||
tokio = { version = "1.45.*", features = ["rt", "rt-multi-thread", "macros"] }
|
tokio = { version = "1.45.*", 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"] }
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# #
|
# #
|
||||||
#######################################
|
#######################################
|
||||||
|
|
||||||
FROM docker.io/rust:1.86.0-slim-bookworm AS build
|
FROM docker.io/rust:1.88.0-slim-bookworm 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
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# #
|
# #
|
||||||
#######################################
|
#######################################
|
||||||
|
|
||||||
FROM docker.io/rust:1.86.0-slim-bookworm AS build
|
FROM docker.io/rust:1.88.0-slim-bookworm 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
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -20,5 +20,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
|
||||||
|
|||||||
@@ -16,5 +16,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
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ 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-4.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
|
# max_response_tokens: 16384
|
||||||
@@ -93,7 +93,7 @@ agents:
|
|||||||
# 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
|
||||||
#
|
#
|
||||||
# - id: localai
|
# - id: localai
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user