{"id":19185953,"url":"https://github.com/ma-pony/langchain-wechat","last_synced_at":"2025-05-08T01:16:44.654Z","repository":{"id":225511709,"uuid":"765218634","full_name":"ma-pony/langchain-wechat","owner":"ma-pony","description":"基于langchain + fastapi + itchat搭建的微信聊天机器人，灵感来自于chatgpt-on-wechat ","archived":false,"fork":false,"pushed_at":"2024-07-06T01:38:52.000Z","size":254,"stargazers_count":49,"open_issues_count":10,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-08T01:16:39.366Z","etag":null,"topics":["ai","chatbot","chatgpt","fastapi","fastapi-framework","langchain","llm","openai","python","python3","wechat","wechat-bot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ma-pony.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-02-29T14:00:24.000Z","updated_at":"2025-02-28T18:06:41.000Z","dependencies_parsed_at":"2025-04-20T05:31:50.251Z","dependency_job_id":"79cabe1f-5de0-4524-9732-ac4cb27e6d16","html_url":"https://github.com/ma-pony/langchain-wechat","commit_stats":null,"previous_names":["ma-pony/langchain-wechat"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ma-pony%2Flangchain-wechat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ma-pony%2Flangchain-wechat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ma-pony%2Flangchain-wechat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ma-pony%2Flangchain-wechat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ma-pony","download_url":"https://codeload.github.com/ma-pony/langchain-wechat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252978811,"owners_count":21834920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","chatbot","chatgpt","fastapi","fastapi-framework","langchain","llm","openai","python","python3","wechat","wechat-bot"],"created_at":"2024-11-09T11:12:35.265Z","updated_at":"2025-05-08T01:16:44.624Z","avatar_url":"https://github.com/ma-pony.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# langchain-wechat\n\n基于fastapi + langchain + itchat 搭建的微信聊天机器人，灵感来自于 chatgpt-on-wechat 项目\n\n**你的star就是对我最大的鼓励🤩**\n\n---\n\n\u003e [!NOTE]\n\u003e 本项目仅供个人学习交流使用，使用者必须遵循 OpenAI 的[使用条款](https://openai.com/policies/terms-of-use)以及 **中国法律法规\n** 使用，不得用于非法用途。\n\u003e\n\u003e 根据[《生成式人工智能服务管理暂行办法》](http://www.cac.gov.cn/2023-07/13/c_1690898327029107.htm)\n\u003e 的要求，请勿对中国地区公众提供一切未经备案的生成式人工智能服务。\n\n## 功能\n\n### Assistants\n默认助理模式执行，会配置各种工具，LLM自动选择合适的工具进行调用，例如调用DuCKDuckGo搜索引擎，对搜索后的结果进行总结，返回给用户。\n\n#### 支持的消息类型\n\n- 接收单人文本消息回复\n- 接收群消息@当前用户 文本消息回复\n- ...\n\n#### 支持的模型\n\n- openai\n- ...\n\n#### tools\n\n- duckduckgo 搜索\n- ...\n\n### RAGBot(开发中)\n需要提供一组文档，然后根据用户的问题，返回最相关的文档片段。\n\n\n## 环境搭建\n\n1. 准备OpenAI账号\n   项目默认使用OpenAI接口，需前往[OpenAI注册页面](https://beta.openai.com/signup)\n   创建账号，创建完账号则前往[API管理页面](https://beta.openai.com/account/api-keys)创建一个 API Key\n   并保存下来，接口需要海外网络访问及绑定信用卡支付。\n\n2. 将API Key添加到环境变量中\n    ```shell\n    export OPENAI_API_KEY=\"sk-xxxxxxxxxxxxxxxxxxxxxx\"\n    \n    ```\n3. 安装Python\n   代码通过Python3.10进行开发测试，需要安装[python 3.10](https://www.python.org/ftp/python/3.10.10/python-3.10.10-macos11.pkg)\n   ，下载后点击安装傻瓜式下一步。\n\n### 安装redis\n\nredis用于存储微信用户聊天记录\n\n```shell\ndocker run -d -p 6379:6379 -p 8001:8001 redis/redis-stack:latest\n```\n\n### 安装依赖\n\n```shell\npoetry install\n```\n\n或者\n\n```shell\npip install -r requirements.txt\n```\n\n### copy .env\n\n```shell\ncp config/.env.example config/.env\n```\n\n## 运行\n\n```shell\nuvicorn src.main:app\n```\n\n## 配置项\n\n在config/.env文件中配置\n\n```shell\n# openai 模型\nOPENAI_MODEL=\"gpt-3.5-turbo-1106\"\n# openai api key\nOPENAI_API_KEY=\"your-openai-api-key\"\n\n# 模型 temperature\nAI_TEMPERATURE=0.7\n# 模型系统角色提示词\nAI_SYSTEM_ROLE_PROMPT=\"系统：\"\n\n# 聊天记录保存最大长度\nCHAT_MAX_MESSAGE_HISTORY_LENGTH=10\n# 触发聊天记录总结的阈值\nCHAT_MESSAGE_HISTORY_SUMMARY_THRESHOLD=5\n\n\n# 微信是否开启热重载\nWECHAT_HOT_RELOAD=False\n# 微信用户数据保存路径\nWECHAT_USER_DATA_STORAGE_PATH=\"wechat.pkl\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fma-pony%2Flangchain-wechat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fma-pony%2Flangchain-wechat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fma-pony%2Flangchain-wechat/lists"}