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

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

官方QQ群: 1072982923

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

claude3mattermostchatbot
elehiggle/claude3mattermostchatbot
elehiggle
An AI-powered Mattermost Claude 3 chatbot that provides helpful responses to user messages.
0 次下载
🚀 稳定镜像源 = 更少宕机 + 更低运维成本
镜像简介版本下载
🚀 稳定镜像源 = 更少宕机 + 更低运维成本

![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 登录认证访问私有仓库

Linux

在 Linux 系统配置镜像服务

Windows/Mac

在 Docker Desktop 配置镜像

Docker Compose

Docker Compose 项目配置

K8s Containerd

Kubernetes 集群配置 Containerd

K3s

K3s 轻量级 Kubernetes 镜像加速

Dev Containers

VS Code Dev Containers 配置

MacOS OrbStack

MacOS OrbStack 容器配置

宝塔面板

在宝塔面板一键配置镜像

群晖

Synology 群晖 NAS 配置

飞牛

飞牛 fnOS 系统配置镜像

极空间

极空间 NAS 系统配置服务

爱快路由

爱快 iKuai 路由系统配置

绿联

绿联 NAS 系统配置镜像

威联通

QNAP 威联通 NAS 配置

Podman

Podman 容器引擎配置

Singularity/Apptainer

HPC 科学计算容器配置

其他仓库配置

ghcr、Quay、nvcr 等镜像仓库

专属域名拉取

无需登录使用专属域名

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

镜像拉取常见问题

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

免费版仅支持 Docker Hub 访问,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。

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

专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等;免费版仅支持 docker.io。

流量耗尽错误提示

当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。

410 错误问题

通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。

manifest unknown 错误

先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。

镜像拉取成功后,如何去掉轩辕镜像域名前缀?

使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。

查看全部问题→

用户好评

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

用户头像

oldzhang

运维工程师

Linux服务器

5

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

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