专属域名
文档搜索
轩辕助手
Run助手
邀请有礼
返回顶部
快速返回页面顶部
收起
收起工具栏
轩辕镜像 官方专业版
轩辕镜像 官方专业版轩辕镜像 官方专业版官方专业版
首页个人中心搜索镜像

交易
充值流量我的订单
工具
提交工单镜像收录一键安装
Npm 源Pip 源Homebrew 源
帮助
常见问题
其他
关于我们网站地图

官方QQ群: 1072982923

elehiggle/claude3mattermostchatbot Docker 镜像 - 轩辕镜像 | Docker 镜像高效稳定拉取服务

热门搜索:openclaw🔥nginx🔥redis🔥mysqlopenjdkcursorweb2apimemgraphzabbixetcdubuntucorednsjdk
claude3mattermostchatbot
elehiggle/claude3mattermostchatbot
elehiggle
An AI-powered Mattermost Claude 3 chatbot that provides helpful responses to user messages.
下载次数: 0状态:社区镜像维护者:elehiggle仓库类型:镜像最近更新:2 个月前
轩辕镜像,加速的不只是镜像。点击查看
镜像简介版本下载
轩辕镜像,加速的不只是镜像。点击查看

![GitHub Repo stars]([] ![GitHub Actions Workflow Status]([] ![Docker Stars]([] ![Docker Pulls]([] ![GitHub last commit]([] ![Codacy Badge]([] ![GitHub License]([***]

Claude3MattermostChatbot

!Mattermost chat with bot example

This project is a chatbot for Mattermost that integrates with the Anthropic API to provide helpful responses to user messages. The chatbot - like this readme - is mostly written by Claude 3 AI, listens for messages mentioning the chatbot or direct messages, processes the messages, and sends the responses back to the Mattermost channel.

Features

  • Responds to messages mentioning "@chatbot" (or rather the chatbot's username) or direct messages
  • Extracts images, PDFs and other files from message attachments and from URL links in messages
  • Supports ******* to bypass Javascript/CAPTCHA restrictions
  • Supports the Vision API for describing images. Images from PDFs will also be sent here
  • Gets transcripts of *** videos for easy tl;dw summarizations. Title, description and uploader are also provided
  • Ability to create custom emoji from image URLs, optionally with removing the background
  • Accesses additional live information via function calling (requires TOOL_USE_ENABLED="TRUE"). Currently supported: stock data (via *** Finance, eg. ask about AAPL) ***currency data ( via Coingecko), fiat currency exchange rates (via ECB)
  • Sends screenshots of rendered raw HTML code or from URLs (via function calling).
  • Maintains context of the conversation within a thread
  • Sends typing indicators to show that the chatbot is processing the message
  • Utilizes a thread pool to handle multiple requests concurrently (due to mattermostdriver-asyncio being outdated)
  • Offers Docker support for easy deployment
  • Supports rudimentary caching. Anthropic charges for written cache, so if your environment simply says "hi" often without any meaningful conversations, you might have increased costs. Hit me up if you need an option to disable caching.

Prerequisites

  • Python 3.11 or just a server with Docker (you can get away with using 3.8 if you use datetime.datetime.utcnow() instead of datetime.datetime.now(datetime.UTC))
  • Anthropic API key
  • Mattermost Bot token (alternatively personal access token or login/password for a dedicated Mattermost user account for the chatbot)
  • The bot account needs to be added to the team and to the channels you want it to watch

Installation

  1. Prepare a Mattermost bot account token and Anthropic API key

    • Create an Anthropic API key here
    • Create a Mattermost bot account token directly in the chat: Left menu -> Integrations -> Bot accounts. Give it the post:channels permission (this also suffices for DMs)
  2. Clone the repository:

    bash
    git clone [***]
    cd Claude3MattermostChatbot
    
  3. Install the required dependencies:

    bash
    pip3 install -r requirements.txt
    
  4. Set the following environment variables with your own values:

ParameterDescription
AI_API_KEYRequired. Your Anthropic API key
AI_MODELThe Anthropic model to use. Default: "claude-3-5-sonnet-20240620"
MATTERMOST_URLRequired. The URL of your Mattermost server
MATTERMOST_TOKENRequired if not using user/password. The bot token (alternatively personal access token) with relevant permissions created specifically for the chatbot. Don't forget to add the bot account to the team
MATTERMOST_USERNAMERequired if not using token. The username of the dedicated Mattermost user account for the chatbot (if using username/password login)
MATTERMOST_PASSWORDRequired if not using token. The password of the dedicated Mattermost user account for the chatbot (if using username/password login)
MATTERMOST_MFA_TOKENThe MFA token of the dedicated Mattermost user account for the chatbot (if using MFA)
TOOL_USE_ENABLEDAllows tool function calling for live data and image generation. It works but its IMO poorly implemented in the Anthropic API and messes with the output and has extra cost. Default: "FALSE"
Extended optional configuration variables:
ParameterDescription
AI_SYSTEM_PROMPTThe system prompt/instructions. Default: click (Subject to change. current_time and CHATBOT_USERNAME variables inside the prompt will be auto-formatted and substituted.
AI_TIMEOUTThe timeout for the AI API call in seconds. Default: "120"
MAX_TOKENSThe maximum number of tokens to generate in the response. Default: "8192" (max)
TEMPERATUREThe temperature value for controlling the randomness of the generated responses (0.0 = analytical, 1.0 = fully random). Default: "0.15"
TYPE_INDICATOR_MODE"FULL" = typing indicator will be sent to main thread/channel and the subthread; "THREAD" = only to the subthread, unless there is none (this is kinda expected behaviour, but I prefer full). Default: "FULL"
MAX_RESPONSE_SIZE_MBThe maximum size of the website or file content to extract (in megabytes, per URL/file). Default: "100"
***_ENDPOINTEndpoint URL to your *** instance (eg. "<[***]>"). If you use this, MAX_RESPONSE_SIZE_MB won't be honored since it can't stream content. For most effectiveness, use a residential IP endpoint
BROWSER_EXECUTABLE_PATHPath to a Chromium binary which is used for the raw_html_to_image function call capability. Fully optional. Chromium is auto installed on the docker image. Default: "/usr/bin/chromium"
DISABLE_SPECIFIC_TOOL_CALLSDisable certain function call tools like create_custom_emoji_by_url or get_exchange_rates. Supports multiple, separated by comma
KEEP_ALL_URL_CONTENTWhether to feed the AI all URL content from the whole conversation thread. The website result is cached in memory. If you only want it to know about the current message's URL content (due to context size or cost), set to "FALSE". Default: "TRUE"
MATTERMOST_IGNORE_SENDER_IDThe user ID of a user to ignore (optional, useful if you have multiple chatbots that are not real bot accounts to prevent endless loops). Supports multiple, separated by comma
MATTERMOST_PORTThe port of your Mattermost server. Default: "443"
MATTERMOST_SCHEMEThe scheme of the connection. Default: "https"
MATTERMOST_BASEPATHThe basepath of your Mattermost server. Default: "/api/v4"
MATTERMOST_CERT_VERIFYCert verification. Default: "TRUE" (also: path to your certificate file)
MATTERMOST_TIMEOUTThe timeout for the Mattermost server in seconds. Default: "10"
AI_API_BASEURLAI API Base URL. Default: None (which will use "<[***]>"). Useful if you want to use a different AI with Anthropic compatible endpoint
LOG_LEVELThe log level. Default: "INFO"
LOG_LEVEL_ROOTThe root log level (for other modules than this chatbot). Default: "INFO"

Usage

Run the script:

bash
python3 chatbot.py

The chatbot will connect to the Mattermost server and start listening for messages. When a user mentions the chatbot in a message or sends a direct message to the chatbot, the chatbot will process the message, extract content from links (if any), process images, PDFs and other files, handle image content using the Vision API, and send the response back to the Mattermost channel.

Note: If you don't trust your users at all, it's recommended to disable the URL/image grabbing feature, even though the chatbot filters out local addresses and IPs.

Running with Docker

You can also run the chatbot using Docker. Use the following command to run the chatbot container:

bash
docker run -d --name chatbotclaude \
  -e AI_API_KEY="your_ai_api_key" \
  -e AI_MODEL="claude-3-5-sonnet-20240620" \
  -e MATTERMOST_URL="mattermostinstance.example.com" \
  -e MATTERMOST_TOKEN="your_mattermost_token" \
  -e MAX_TOKENS="4096" \
  -e TEMPERATURE="0.15" \
  ghcr.io/elehiggle/claude3mattermostchatbot:latest
Using Custom emoji generation

!Mattermost Custom emoji bot example

The bot will take an image URL, optionally remove the background, and create a custom emoji on the Mattermost server with a provided or generated name.

How does this bot differ from the official Mattermost AI plugin?

The official Mattermost AI plugin is a great way to integrate AI into your Mattermost server with its own advantages, like a nice UI. However, the features differ greatly. It requires direct access to the server, whereas this bot merely needs a bot token and can be conveniently used in a Docker environment.

Also there is:

  • no fine granular control over certain settings (especially AI settings)
  • no CAPTCHA bypass
  • no Vision API
  • no PDF parsing
  • no *** transcript fetching
  • and more

While the official plugin certainly will improve over time, this bot here will too and there will be certain features that will absolutely never make it into the official plugin, due to it primarily focusing on features for developers like function calling to retrieve GitHub issues, for example.

Known Issues

While the chatbot works great for me, there might still be some bugs lurking inside. I have done my best to address them, but if you encounter any issues, please let me know!

Monkey Patch

Please note that the monkey patch in the code is necessary due to some SSL errors that occur because of a mistake within the mattermostdriver library. The patch ensures that the chatbot can establish a secure connection with the Mattermost server.

Related Projects

OpenAI *** Mattermost Chatbot

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

Acknowledgements

  • Anthropic for providing the API for generating responses
  • Mattermost for the messaging platform
  • mattermostdriver for the Mattermost API client library
  • ***-mattermost-bot for inspiring me to write this python code
  • ***-transcript-api for the *** Transcript Fetch library
  • *** for the *** API that allows us to fetch details
  • PyMuPDF for the comprehensive PDF parsing library
  • beautifulsoup4 for the HTML parsing library
  • pillow for the image processing library
  • httpx for the HTTP client library
  • certifi for the certificate verification library

轩辕镜像配置手册

探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式

Docker 配置

登录仓库拉取

通过 Docker 登录认证访问私有仓库

专属域名拉取

无需登录使用专属域名

K8s Containerd

Kubernetes 集群配置 Containerd

K3s

K3s 轻量级 Kubernetes 镜像加速

Dev Containers

VS Code Dev Containers 配置

Podman

Podman 容器引擎配置

Singularity/Apptainer

HPC 科学计算容器配置

其他仓库配置

ghcr、Quay、nvcr 等镜像仓库

Harbor 镜像源配置

Harbor Proxy Repository 对接专属域名

Portainer 镜像源配置

Portainer Registries 加速拉取

Nexus 镜像源配置

Nexus3 Docker Proxy 内网缓存

系统配置

Linux

在 Linux 系统配置镜像服务

Windows/Mac

在 Docker Desktop 配置镜像

MacOS OrbStack

MacOS OrbStack 容器配置

Docker Compose

Docker Compose 项目配置

NAS 设备

群晖

Synology 群晖 NAS 配置

飞牛

飞牛 fnOS 系统配置镜像

绿联

绿联 NAS 系统配置镜像

威联通

QNAP 威联通 NAS 配置

极空间

极空间 NAS 系统配置服务

网络设备

爱快路由

爱快 iKuai 路由系统配置

宝塔面板

在宝塔面板一键配置镜像

需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单

镜像拉取常见问题

使用与功能问题

配置了专属域名后,docker search 为什么会报错?

docker search 限制

Docker Hub 上有的镜像,为什么在轩辕镜像网站搜不到?

站内搜不到镜像

机器不能直连外网时,怎么用 docker save / load 迁镜像?

离线 save/load

docker pull 拉插件报错(plugin v1+json)怎么办?

插件要用 plugin install

WSL 里 Docker 拉镜像特别慢,怎么排查和优化?

WSL 拉取慢

轩辕镜像安全吗?如何用 digest 校验镜像没被篡改?

安全与 digest

第一次用轩辕镜像拉 Docker 镜像,要怎么登录和配置?

新手拉取配置

错误码与失败问题

docker pull 提示 manifest unknown 怎么办?

manifest unknown

docker pull 提示 no matching manifest 怎么办?

no matching manifest(架构)

镜像已拉取完成,却提示 invalid tar header 或 failed to register layer 怎么办?

invalid tar header(解压)

Docker pull 时 HTTPS / TLS 证书验证失败怎么办?

TLS 证书失败

Docker pull 时 DNS 解析超时或连不上仓库怎么办?

DNS 超时

Docker 拉取出现 410 Gone 怎么办?

410 Gone 排查

出现 402 或「流量用尽」提示怎么办?

402 与流量用尽

Docker 拉取提示 UNAUTHORIZED(401)怎么办?

401 认证失败

遇到 429 Too Many Requests(请求太频繁)怎么办?

429 限流

docker login 提示 Cannot autolaunch D-Bus,还算登录成功吗?

D-Bus 凭证提示

为什么会出现「单层超过 20GB」或 413,无法加速拉取?

413 与超大单层

账号 / 计费 / 权限

轩辕镜像免费版和专业版有什么区别?

免费版与专业版区别

轩辕镜像支持哪些 Docker 镜像仓库?

支持的镜像仓库

镜像拉取失败还会不会扣流量?

失败是否计费

麒麟 V10 / 统信 UOS 提示 KYSEC 权限不够怎么办?

KYSEC 拦截脚本

如何在轩辕镜像申请开具发票?

申请开票

怎么修改轩辕镜像的网站登录和仓库登录密码?

修改登录密码

如何注销轩辕镜像账户?要注意什么?

注销账户

配置与原理类

写了 registry-mirrors,为什么还是走官方或仍然报错?

mirrors 不生效

怎么用 docker tag 去掉镜像名里的轩辕域名前缀?

去掉域名前缀

如何拉取指定 CPU 架构的镜像(如 ARM64、AMD64)?

指定架构拉取

用轩辕镜像拉镜像时快时慢,常见原因有哪些?

拉取速度原因

查看全部问题→

用户好评

来自真实用户的反馈,见证轩辕镜像的优质服务

用户头像

oldzhang

运维工程师

Linux服务器

5

"Docker访问体验非常流畅,大镜像也能快速完成下载。"

轩辕镜像
镜像详情
...
elehiggle/claude3mattermostchatbot
博客公告Docker 镜像公告与技术博客
热门镜像查看热门 Docker 镜像推荐
一键安装一键安装 Docker 并配置镜像源
镜像拉取问题咨询请 提交工单,官方技术交流群:1072982923。轩辕镜像所有镜像均来源于原始仓库,本站不存储、不修改、不传播任何镜像内容。
镜像拉取问题咨询请提交工单,官方技术交流群:。轩辕镜像所有镜像均来源于原始仓库,本站不存储、不修改、不传播任何镜像内容。
商务合作:点击复制邮箱
©2024-2026 源码跳动
商务合作:点击复制邮箱Copyright © 2024-2026 杭州源码跳动科技有限公司. All rights reserved.