feat(bots): add LLM chatbot with Ollama provider (#74) #111
No reviewers
Labels
No labels
area:api
area:core
area:docs
area:infra
area:ux
dependencies
documentation
duplicate
good first issue
help wanted
invalid
question
rust
status:complete
status:partial
status:planned
type:bug
type:design
type:feature
type:infra
type:refactor
type:refactor
type:research
type:ux
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
icub3d/decentcom!111
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/74-chatbot"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements #74: a reference LLM-powered bot (
decentcom-chatbot) that replies to@mentionsusing a pluggable provider architecture, starting with Ollama.Closes #74.
What it does
tools/bots/chatbot/— built on thedecentcom-botSDK. On every message: skip our own messages (loop-safe), detect@{mention_name}(ASCII-case-insensitive, word-boundary; "email@chatbot.dev" and "@chatbotter" don't match), strip all mentions, send the remainder to the provider, and reply in-channel. Provider failures produce a friendly in-channel message plus a detailed log line; replies are truncated atmax_reply_chars(default 4000).Mention offsets are computed byte-wise with ASCII case folding, so stripping is safe in multibyte content (Unicode
to_lowercasecan shift byte offsets).Provider architecture
Provideris enum-dispatched (no async-trait dep): a new backend is one variant, one config struct, one match arm.OllamaProvidercalls the non-streaming/api/chatendpoint via reqwest withsystem_prompt,temperature, and optionalnum_predict(max_tokens), with a configurable timeout.Config
Flattened
decentcom_bot::Config(sameBOT_*env overrides as every bot) plusmention_name(defaults todisplay_name),max_reply_chars,provider, and an[ollama]table.$CHATBOT_CONFIGselects the file;CHATBOT_OLLAMA_URL/CHATBOT_OLLAMA_MODEL/CHATBOT_MENTION_NAMEoverride. See the crate README andchatbot.example.toml.Dev-loop wiring
Procfilegainschatbot: CHATBOT_CONFIG=test-configs/chatbot.toml cargo run -q --bin chatbot, somake devstarts it.test-configs/chatbot.tomluses the seededbot-betaidentity ([0x11; 32]) and points at a local Ollama.sdk-seednow registers and approvesbot-betaon the Open Server (previously onlybot-alpha).Verification
cargo test --workspace,cargo clippy --workspace --all-targets -- -D warnings,cargo fmt --checkall clean.make devdoes, sent@chatbot In one short sentence, what is Rust?as alice via the SDK, and received a real completion from a local Ollama (gemma4:12b): "Rust is a high-performance programming language focused on memory safety and concurrency."Open questions from the issue resolved as recommended: stateless per-message responses (no history), truncation for over-long replies.
🤖 Generated with Claude Code