Compare commits

...

57 Commits

Author SHA1 Message Date
Slavi Pantaleev
20cb33bc66 Prepare 1.19.2 release
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 12:23:20 +03:00
Slavi Pantaleev
2791bdb08b Merge pull request #150 from etkecc/chore/update-dependencies
Update dependencies
2026-05-21 09:39:11 +03:00
Slavi Pantaleev
5dd505202a Update dependencies
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 09:33:28 +03:00
Slavi Pantaleev
d61078002c Merge pull request #149 from etkecc/renovate/async-openai-0.x
Update Rust crate async-openai to 0.40.0
2026-05-21 09:26:46 +03:00
renovate[bot]
cf5b346558 Update Rust crate async-openai to 0.40.0 2026-05-21 05:55:20 +00:00
renovate[bot]
ebbb6658e1 Update dependency prek to v0.4.1 2026-05-20 09:13:57 +03:00
renovate[bot]
369dc0c1ba Update ghcr.io/element-hq/synapse Docker tag to v1.153.0 2026-05-19 21:46:36 +03:00
renovate[bot]
3185f44a93 Update Rust crate quick_cache to v0.6.22 2026-05-18 07:32:20 +03:00
renovate[bot]
aa8ccde0ed Update docker.io/postgres Docker tag to v18.4 2026-05-15 12:48:23 +03:00
renovate[bot]
d5df0d7416 Update docker.io/ollama/ollama Docker tag to v0.24.0 2026-05-15 12:48:07 +03:00
renovate[bot]
140ca9ed68 Update dependency prek to v0.4.0 2026-05-14 16:40:26 +03:00
renovate[bot]
89d77d52b6 Update Rust crate async-openai to v0.38.2 2026-05-14 07:32:06 +03:00
renovate[bot]
5092700275 Update docker.io/ollama/ollama Docker tag to v0.23.4 2026-05-14 07:31:22 +03:00
renovate[bot]
10c365124e Update docker.io/ollama/ollama Docker tag to v0.23.3 2026-05-13 07:28:16 +03:00
renovate[bot]
08bdf4f7a2 Update ghcr.io/element-hq/element-web Docker tag to v1.12.18 2026-05-12 20:38:24 +03:00
Slavi Pantaleev
af557a7e45 Fix multi-arch manifest publish: use buildx imagetools
docker/build-push-action now wraps single-platform images in an OCI
image index (to carry provenance attestations), so the per-arch
`*-amd64`/`*-arm64` tags are manifest lists. `docker manifest create`
refuses manifest-list sources ("X is a manifest list"). Switch to
`docker buildx imagetools create`, which flattens index sources
correctly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 09:22:50 +03:00
renovate[bot]
fa7eb11b1d Update Rust crate async-openai to v0.38.1 2026-05-12 02:39:22 +03:00
Slavi Pantaleev
ff1e128f0e Fix versioned image publish under workflow_run trigger
e978d3c switched the publish trigger from `push` to `workflow_run` and
correctly migrated the `type=raw,value=latest` rule to read the upstream
head_branch from `github.event.workflow_run.*` — but left the
`type=semver,pattern={{raw}}` rule unchanged. That rule still reads
`github.ref`, which under workflow_run dispatch is always
`refs/heads/main` (the default branch where the workflow file lives),
not the triggering tag ref. As a result, no semver tag was extracted,
metadata-action produced no tags, and `buildx` failed with
"tag is needed when pushing to registry". The `latest` tag kept
publishing because its rule was migrated; versioned tags (v1.19.0,
v1.19.1) silently stopped publishing.

Pass the upstream head_branch to the semver rule explicitly via `value`,
gated by `enable` so it only fires for v* tags. Mirrors the migration
the raw rule already received.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 17:28:54 +03:00
Slavi Pantaleev
c9da927c66 Prepare 1.19.1 release
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 16:40:24 +03:00
Slavi Pantaleev
7b16c5c1c3 Update async-openai to v0.38.0
Closes #137. The 0.36 -> 0.38 bump (skipping 0.37) introduces Tower-based
middleware support and a fix to the ReasoningItem `type` field, but
neither affects baibot's call sites — no code adaptation was needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 16:40:10 +03:00
Slavi Pantaleev
f809bf8d7c Prepare 1.19.0 release
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 16:34:49 +03:00
Slavi Pantaleev
44aea427fc Update matrix-sdk to v0.17.0 and Rust toolchain to 1.95.0
matrix-sdk 0.17.0 brings a few breaking API changes that we adapt to:

- Drop the `native-tls` feature on matrix-sdk; it was removed upstream
  in 2026-04 (matrix-sdk now hardwires rustls). The previous workaround
  comment referencing rust-mxlink issue #1 is no longer relevant.
- `Relation::Reply` is now a tuple variant wrapping a `Reply` struct;
  pattern matches updated to bind through `reply.in_reply_to.event_id`.

Also bumps the Rust toolchain from 1.93.0 to 1.95.0 (closes #85, which
proposed the Dockerfile bump in isolation). rustc 1.94+ trips a
query-depth overflow when computing async layouts in the matrix-sdk
timeline future graph; matrix-rust-sdk PR #6489 raises the limit, but
\`recursion_limit\` is per-crate, so we repeat \`#![recursion_limit = "256"]\`
on this crate root.

Bumps the mxlink floor to 1.14.0, which carries the matching adapter.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 16:29:41 +03:00
renovate[bot]
8f45a57ced Update docker.io/ollama/ollama Docker tag to v0.23.2 2026-05-09 16:06:25 +03:00
renovate[bot]
6a9100309c Update ghcr.io/element-hq/synapse Docker tag to v1.152.1 2026-05-09 16:06:17 +03:00
renovate[bot]
1953878e6b Update Rust crate tokio to v1.52.3 2026-05-09 08:12:03 +03:00
renovate[bot]
35761a5bf7 Update ghcr.io/element-hq/element-web Docker tag to v1.12.17 2026-05-09 08:11:38 +03:00
renovate[bot]
c7fa0cc0ee Update forgejo.ellis.link/continuwuation/continuwuity Docker tag to v0.5.9 2026-05-09 08:11:25 +03:00
renovate[bot]
87fcf9d019 Update dependency prek to v0.3.13 2026-05-09 08:11:04 +03:00
renovate[bot]
4b52bc906c Update forgejo.ellis.link/continuwuation/continuwuity Docker tag to v0.5.8 2026-04-25 22:16:54 +03:00
renovate[bot]
517a6c5e33 Update docker.io/ollama/ollama Docker tag to v0.21.2 2026-04-24 08:17:02 +03:00
renovate[bot]
636c8a35eb Update Rust crate async-openai to 0.36.0 2026-04-24 06:54:26 +03:00
renovate[bot]
a50de600da Update docker.io/ollama/ollama Docker tag to v0.21.1 2026-04-22 07:15:30 +03:00
Slavi Pantaleev
e978d3cb2f Publish only after successful CI
Run the publish workflow from the workflow_run event so Docker publishing happens only after the CI workflow completes successfully for push events on main or v* tags.

Check out the exact SHA validated by CI and derive Docker metadata from the upstream CI ref, so publishing follows the tested revision instead of the default branch tip.
2026-04-20 22:09:37 +03:00
Slavi Pantaleev
2b1bdbd3d2 Split CI and publish workflows
This supersedes 7d183b9 ("Run CI for pull requests"), which mixed validation and publishing in one workflow and regressed docker-manifest by dropping the package-write permission it needs to publish the manifest.

Split the workflows so CI handles pull requests, branch pushes, tags, and manual runs, while publishing stays focused on Docker delivery with the manifest permission fixed explicitly at the job level.
2026-04-20 22:08:07 +03:00
Slavi Pantaleev
7d183b91d1 Run CI for pull requests 2026-04-20 21:40:03 +03:00
renovate[bot]
420f380417 Update Rust crate async-openai to 0.35.0 (#125)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-04-20 21:39:09 +03:00
renovate[bot]
6f541e2361 Update forgejo.ellis.link/continuwuation/continuwuity Docker tag to v0.5.7 2026-04-17 21:52:46 +03:00
renovate[bot]
0737c2761e Update docker.io/ollama/ollama Docker tag to v0.21.0 2026-04-17 10:41:04 +03:00
renovate[bot]
45852a0d53 Update Rust crate tokio to v1.52.1 2026-04-17 10:38:22 +03:00
renovate[bot]
0fcf8d8703 Update Rust crate tokio to 1.52.* 2026-04-15 09:43:04 +03:00
renovate[bot]
41905b006a Update docker.io/ollama/ollama Docker tag to v0.20.7 2026-04-14 07:33:22 +03:00
renovate[bot]
ee3d27701b Update docker.io/ollama/ollama Docker tag to v0.20.6 2026-04-13 08:58:29 +03:00
Slavi Pantaleev
1b5c2fbdc1 Prepare 1.18.0 release
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 10:55:55 +03:00
Slavi Pantaleev
a865a26093 Update tiktoken-rs to 0.11, adding support for newer GPT models
Supersedes https://github.com/etkecc/baibot/pull/116

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 10:52:22 +03:00
Slavi Pantaleev
1563e83672 Update dependencies 2026-04-11 10:40:09 +03:00
renovate[bot]
cf114b37b3 Update docker.io/ollama/ollama Docker tag to v0.20.5 2026-04-10 09:21:42 +03:00
renovate[bot]
b8ef2b978b Update Rust crate tokio to v1.51.1 2026-04-08 19:25:58 +03:00
renovate[bot]
7e37aee1b9 Update ghcr.io/element-hq/synapse Docker tag to v1.151.0 2026-04-08 11:57:52 +03:00
renovate[bot]
53836e556a Update ghcr.io/element-hq/element-web Docker tag to v1.12.15 2026-04-08 11:57:29 +03:00
renovate[bot]
89052bbfd9 Update ghcr.io/element-hq/element-web Docker tag to v1.12.14 2026-04-07 19:53:11 +03:00
renovate[bot]
07eb12d406 Update docker.io/ollama/ollama Docker tag to v0.20.3 2026-04-07 08:45:11 +03:00
renovate[bot]
3272cd6fb2 Update Rust crate tokio to 1.51.* 2026-04-04 15:52:04 +03:00
renovate[bot]
7ab97a39ca Update docker.io/ollama/ollama Docker tag to v0.20.2 2026-04-04 10:35:45 +03:00
renovate[bot]
11c5a9942e Update docker.io/ollama/ollama Docker tag to v0.20.1 2026-04-04 09:17:02 +03:00
renovate[bot]
251dec454c Update docker.io/ollama/ollama Docker tag to v0.20.0 2026-04-03 07:40:18 +03:00
renovate[bot]
1031dbf672 Update docker.io/ollama/ollama Docker tag to v0.19.0 2026-03-30 08:31:02 +03:00
renovate[bot]
581f00b9fb Update docker.io/ollama/ollama Docker tag to v0.18.3 2026-03-26 08:18:33 +02:00
16 changed files with 681 additions and 646 deletions

26
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,26 @@
name: CI
on:
workflow_dispatch:
pull_request:
branches: [ "main" ]
push:
branches:
- "**"
tags: [ "v*" ]
permissions:
contents: read
pull-requests: read
concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test-and-clippy:
name: Unit testing and linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@1.93.0
- name: Install SQLite3
run: sudo apt-get update && sudo apt-get install -y libsqlite3-dev
- run: cargo test --all-features
- run: cargo clippy

View File

@@ -1,33 +1,31 @@
name: CI (main and tags)
name: Publish
on:
push:
branches: [ "main" ]
tags: [ "v*" ]
workflow_run:
workflows: [ "CI" ]
types: [ "completed" ]
permissions:
checks: write
contents: write
packages: write
pull-requests: read
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: publish-${{ github.event.workflow_run.id || github.ref }}
cancel-in-progress: false
jobs:
test-and-clippy:
name: Unit testing and linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@1.93.0
- name: Install SQLite3
run: sudo apt-get update && sudo apt-get install -y libsqlite3-dev
- run: cargo test --all-features
- run: cargo clippy
docker-clean-metadata:
if: |
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'push' &&
(
github.event.workflow_run.head_branch == 'main' ||
startsWith(github.event.workflow_run.head_branch || '', 'v')
)
runs-on: ubuntu-latest
outputs:
json: ${{ steps.meta.outputs.json }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ github.event.workflow_run.head_sha }}
fetch-depth: 0
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v6
@@ -35,10 +33,17 @@ jobs:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest,enable=${{ github.ref_name == 'main' }}
type=semver,pattern={{raw}}
type=raw,value=latest,enable=${{ github.event.workflow_run.head_branch == 'main' }}
type=semver,pattern={{raw}},value=${{ github.event.workflow_run.head_branch }},enable=${{ startsWith(github.event.workflow_run.head_branch || '', 'v') }}
docker-build:
if: |
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'push' &&
(
github.event.workflow_run.head_branch == 'main' ||
startsWith(github.event.workflow_run.head_branch || '', 'v')
)
permissions:
contents: read
packages: write
@@ -57,6 +62,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ github.event.workflow_run.head_sha }}
fetch-depth: 0
- name: Log in to the GitHub Container registry
uses: docker/login-action@v4
with:
@@ -68,8 +76,8 @@ jobs:
uses: docker/metadata-action@v6
with:
tags: |
type=raw,value=latest,enable=${{ github.ref_name == 'main' }}
type=semver,pattern={{raw}}
type=raw,value=latest,enable=${{ github.event.workflow_run.head_branch == 'main' }}
type=semver,pattern={{raw}},value=${{ github.event.workflow_run.head_branch }},enable=${{ startsWith(github.event.workflow_run.head_branch || '', 'v') }}
flavor: |
latest=auto
suffix=-${{ matrix.arch }},onlatest=true
@@ -84,6 +92,16 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
docker-manifest:
if: |
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'push' &&
(
github.event.workflow_run.head_branch == 'main' ||
startsWith(github.event.workflow_run.head_branch || '', 'v')
)
permissions:
contents: read
packages: write
needs:
- docker-build
- docker-clean-metadata
@@ -103,5 +121,4 @@ jobs:
- name: Create and push manifest
run: |
docker manifest create ${{ matrix.image }} ${{ matrix.image }}-amd64 ${{ matrix.image }}-arm64
docker manifest push ${{ matrix.image }}
docker buildx imagetools create -t ${{ matrix.image }} ${{ matrix.image }}-amd64 ${{ matrix.image }}-arm64

View File

@@ -1,3 +1,35 @@
# (2026-05-21) Version 1.19.2
- (**Internal Improvement**) Update [async-openai](https://crates.io/crates/async-openai) to 0.40.0.
- (**Internal Improvement**) Dependency updates.
# (2026-05-09) Version 1.19.1
- (**Internal Improvement**) Update [async-openai](https://crates.io/crates/async-openai) to 0.38.0.
- (**Internal Improvement**) Dependency updates.
# (2026-05-09) Version 1.19.0
- (**Internal Improvement**) Update [matrix-sdk](https://crates.io/crates/matrix-sdk) from 0.16 to 0.17 and [mxlink](https://crates.io/crates/mxlink) to 1.14.0. matrix-sdk 0.17 dropped its `native-tls` feature and now uses [rustls](https://github.com/rustls/rustls) exclusively as its TLS backend.
- (**Internal Improvement**) Bump the pinned Rust toolchain from 1.93.0 to 1.95.0 (in `rust-toolchain.toml` and the Docker build images).
- (**Internal Improvement**) Dependency updates.
# (2026-04-11) Version 1.18.0
- (**Bugfix**) Fix the bot not sending a welcome message when joining a room on homeservers (like [Continuwuity](https://continuwuity.org/)) that place the join membership event in the sync response's `state` block rather than the `timeline` block, via [mxlink](https://crates.io/crates/mxlink) 1.13.1
- (**Improvement**) Update [tiktoken-rs](https://crates.io/crates/tiktoken-rs) to 0.11, adding tokenization support for newer GPT models (gpt-5.x, codex, etc.) and fixing context sizes for o1-mini/chatgpt-4o/gpt-4.5
- (**Internal Improvement**) Dependency updates
# (2026-03-25) Version 1.17.0
- (**Feature**) Add `text-generation sender-context-mode` for attaching sender metadata to conversation messages. See the [💬 Text Generation](./docs/configuration/text-generation.md#-sender-context-mode) documentation for details. Thanks to [kschwank](https://github.com/kschwank) for the contribution in [#104](https://github.com/etkecc/baibot/pull/104)!

1125
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,7 +7,7 @@ license = "AGPL-3.0-or-later"
readme = "README.md"
keywords = ["matrix", "chat", "bot", "AI", "LLM"]
include = ["/etc/assets/baibot-torso-768.png", "/src", "/README.md", "/CHANGELOG.md", "/LICENSE"]
version = "1.17.0"
version = "1.19.2"
edition = "2024"
[lib]
@@ -17,15 +17,14 @@ path = "src/lib.rs"
[dependencies]
anthropic = { git = "https://github.com/etkecc/anthropic-rs.git", branch = "fix-content-block-image" }
anyhow = "1.0.*"
async-openai = { version = "0.34.0", features = ["audio", "chat-completion", "image", "responses"] }
async-openai = { version = "0.40.0", features = ["audio", "chat-completion", "image", "responses"] }
base64 = "0.22.*"
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 add the `native-tls` feature, because of https://github.com/etkecc/rust-mxlink/issues/1
matrix-sdk = { version = "0.16.0", default-features = false, features = ["native-tls"] }
matrix-sdk = { version = "0.17.0", default-features = false }
mime_guess = "2.0.*"
mxidwc = "1.0.*"
mxlink = ">=1.13.0"
mxlink = ">=1.14.0"
etke_openai_api_rust = "0.1.*"
quick_cache = "0.6.*"
regex = "1.12.*"
@@ -33,8 +32,8 @@ serde = { version = "1.0.*", features = ["derive"], default-features = false }
serde_json = "1.0.*"
serde_yaml_ng = "0.10.*"
tempfile = "3.27.*"
tiktoken-rs = { version = "0.9.*", default-features = false }
tokio = { version = "1.50.*", features = ["rt", "rt-multi-thread", "macros"] }
tiktoken-rs = { version = "0.11.*", default-features = false }
tokio = { version = "1.52.*", features = ["rt", "rt-multi-thread", "macros"] }
tracing = "0.1.*"
tracing-subscriber = { version = "0.3.*", features = ["env-filter"] }
url = "2.5.*"

View File

@@ -4,7 +4,7 @@
# #
#######################################
FROM docker.io/rust:1.93.1-slim-trixie AS build
FROM docker.io/rust:1.95.0-slim-trixie AS build
RUN apt-get update && apt-get install -y build-essential pkg-config libssl-dev libsqlite3-dev

View File

@@ -4,7 +4,7 @@
# #
#######################################
FROM docker.io/rust:1.93.1-slim-trixie AS build
FROM docker.io/rust:1.95.0-slim-trixie AS build
RUN apt-get update && apt-get install -y build-essential pkg-config libssl-dev libsqlite3-dev

View File

@@ -1,6 +1,6 @@
services:
continuwuity:
image: forgejo.ellis.link/continuwuation/continuwuity:v0.5.6
image: forgejo.ellis.link/continuwuation/continuwuity:v0.5.9
user: "${UID}:${GID}"
restart: unless-stopped
cap_drop:

View File

@@ -1,6 +1,6 @@
services:
element-web:
image: ghcr.io/element-hq/element-web:v1.12.13
image: ghcr.io/element-hq/element-web:v1.12.18
user: "${UID}:${GID}"
restart: unless-stopped
environment:

View File

@@ -1,6 +1,6 @@
services:
ollama:
image: docker.io/ollama/ollama:0.18.2
image: docker.io/ollama/ollama:0.24.0
restart: unless-stopped
ports:
- "${SERVICE_OLLAMA_BIND_PORT_HTTP}:11434"

View File

@@ -1,6 +1,6 @@
services:
postgres:
image: docker.io/postgres:18.3-alpine
image: docker.io/postgres:18.4-alpine
user: ${UID}:${GID}
restart: unless-stopped
environment:
@@ -14,7 +14,7 @@ services:
- /etc/passwd:/etc/passwd:ro
synapse:
image: ghcr.io/element-hq/synapse:v1.150.0
image: ghcr.io/element-hq/synapse:v1.153.0
user: "${UID}:${GID}"
restart: unless-stopped
entrypoint: python

View File

@@ -1,5 +1,5 @@
[tools]
prek = "0.3.2"
prek = "0.4.1"
[settings]
# Disable automatic trust prompts - we trust this config

View File

@@ -1,4 +1,4 @@
[toolchain]
channel = "1.93.0"
channel = "1.95.0"
components = ["rustfmt", "clippy"]
profile = "default"

View File

@@ -1,15 +1,15 @@
use tiktoken_rs::CoreBPE;
use tiktoken_rs::get_bpe_from_tokenizer;
use tiktoken_rs::bpe_for_tokenizer;
use tiktoken_rs::tokenizer;
use super::{Author, Message, MessageContent};
fn get_bpe_for_model(model: &str) -> CoreBPE {
fn get_bpe_for_model(model: &str) -> &'static CoreBPE {
let tokenizer = tokenizer::get_tokenizer(model)
.or_else(|| tokenizer::get_tokenizer("gpt-4"))
.unwrap();
get_bpe_from_tokenizer(tokenizer).unwrap()
bpe_for_tokenizer(tokenizer).unwrap()
}
pub fn shorten_messages_list_to_context_size(
@@ -26,7 +26,7 @@ pub fn shorten_messages_list_to_context_size(
// We want to retain the prompt in all cases, so we always count it first.
// We also always reserve enough tokens for the maximum response we expect.
let mut current_context_length: u32 = if let Some(prompt_message) = prompt_message {
calculate_token_size_for_message(&bpe, model, prompt_message)
calculate_token_size_for_message(bpe, model, prompt_message)
+ max_response_tokens.unwrap_or(0)
} else {
0
@@ -37,7 +37,7 @@ pub fn shorten_messages_list_to_context_size(
let mut messages_to_keep: Vec<Message> = Vec::new();
for message in messages {
let tokens_for_message = calculate_token_size_for_message(&bpe, model, &message);
let tokens_for_message = calculate_token_size_for_message(bpe, model, &message);
if current_context_length + tokens_for_message > max_context_tokens {
break;
@@ -94,7 +94,7 @@ pub mod test {
timestamp: chrono::Utc::now(),
};
let tokens = super::calculate_token_size_for_message(&bpe, model, &message);
let tokens = super::calculate_token_size_for_message(bpe, model, &message);
assert_eq!(8, tokens);
}
@@ -117,7 +117,7 @@ pub mod test {
assert_eq!(
prompt_length,
super::calculate_token_size_for_message(&bpe, model, &prompt)
super::calculate_token_size_for_message(bpe, model, &prompt)
);
let mut conversation_messages = Vec::new();
@@ -132,7 +132,7 @@ pub mod test {
assert_eq!(
first_length,
super::calculate_token_size_for_message(&bpe, model, &first)
super::calculate_token_size_for_message(bpe, model, &first)
);
conversation_messages.push(first);
@@ -147,7 +147,7 @@ pub mod test {
assert_eq!(
second_length,
super::calculate_token_size_for_message(&bpe, model, &second)
super::calculate_token_size_for_message(bpe, model, &second)
);
conversation_messages.push(second);
@@ -164,7 +164,7 @@ pub mod test {
assert_eq!(
third_length,
super::calculate_token_size_for_message(&bpe, model, &third)
super::calculate_token_size_for_message(bpe, model, &third)
);
conversation_messages.push(third.clone());
@@ -181,7 +181,7 @@ pub mod test {
assert_eq!(
forth_length,
super::calculate_token_size_for_message(&bpe, model, &forth)
super::calculate_token_size_for_message(bpe, model, &forth)
);
conversation_messages.push(forth.clone());
@@ -227,7 +227,7 @@ pub mod test {
assert_eq!(
prompt_length,
super::calculate_token_size_for_message(&bpe, model, &prompt)
super::calculate_token_size_for_message(bpe, model, &prompt)
);
let mut conversation_messages = Vec::new();
@@ -242,7 +242,7 @@ pub mod test {
assert_eq!(
first_length,
super::calculate_token_size_for_message(&bpe, model, &first)
super::calculate_token_size_for_message(bpe, model, &first)
);
conversation_messages.push(first);
@@ -257,7 +257,7 @@ pub mod test {
assert_eq!(
second_length,
super::calculate_token_size_for_message(&bpe, model, &second)
super::calculate_token_size_for_message(bpe, model, &second)
);
conversation_messages.push(second);
@@ -274,7 +274,7 @@ pub mod test {
assert_eq!(
third_length,
super::calculate_token_size_for_message(&bpe, model, &third)
super::calculate_token_size_for_message(bpe, model, &third)
);
conversation_messages.push(third.clone());
@@ -291,7 +291,7 @@ pub mod test {
assert_eq!(
forth_length,
super::calculate_token_size_for_message(&bpe, model, &forth)
super::calculate_token_size_for_message(bpe, model, &forth)
);
conversation_messages.push(forth.clone());

View File

@@ -119,7 +119,7 @@ async fn get_matrix_messages_in_reply_chain_native(
AnySyncMessageLikeEvent::RoomMessage(room_message) => {
if let SyncMessageLikeEvent::Original(room_message_original) = room_message {
match room_message_original.content.relates_to {
Some(Relation::Reply { in_reply_to }) => Some(in_reply_to.event_id.clone()),
Some(Relation::Reply(reply)) => Some(reply.in_reply_to.event_id.clone()),
_ => None,
}
} else {
@@ -420,11 +420,11 @@ pub async fn determine_interaction_context_for_room_event(
)
.await
}
Relation::Reply { in_reply_to } => {
Relation::Reply(reply) => {
determine_interaction_context_for_room_event_related_to_reply(
current_event,
current_event_is_mentioning_bot,
in_reply_to.event_id.clone(),
reply.in_reply_to.event_id.clone(),
)
.await
}

View File

@@ -1,3 +1,9 @@
// rustc 1.94+ trips a query-depth overflow when computing async layouts in
// the matrix-sdk timeline future graph. matrix-rust-sdk PR #6489 raises the
// limit, but `recursion_limit` is per-crate and applies to the crate currently
// being compiled — so the consumer has to repeat it.
#![recursion_limit = "256"]
mod agent;
mod bot;
mod controller;