mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-04 21:06:03 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3e23cbccb | ||
|
|
79132aa11d | ||
|
|
7bb9e6e951 | ||
|
|
37dc5b4135 | ||
|
|
d588faf470 | ||
|
|
8b51a81158 | ||
|
|
9f125974bf |
10
README.md
10
README.md
@@ -22,14 +22,8 @@
|
|||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<a href="http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=66-aWvn8cbP4c1ut_1YYkvvGVeEtyTH8&authKey=pTaKBK5C%2B8dFzQ4XlENf6MHTCLaHnlKcCRx7c14EeVVlpX2nRSaS8lJm8YeM4mCU&noverify=0&group_code=195992197">
|
|
||||||
<img alt="Static Badge" src="https://img.shields.io/badge/%E5%AE%98%E6%96%B9%E7%BE%A4-195992197-green">
|
|
||||||
</a>
|
|
||||||
<a href="https://qm.qq.com/q/PClALFK242">
|
|
||||||
<img alt="Static Badge" src="https://img.shields.io/badge/%E7%A4%BE%E5%8C%BA%E7%BE%A4-619154800-green">
|
|
||||||
</a>
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
|
[](https://qm.qq.com/q/PClALFK242)
|
||||||
[](https://github.com/RockChinQ/LangBot/releases/latest)
|
[](https://github.com/RockChinQ/LangBot/releases/latest)
|
||||||

|

|
||||||
<img src="https://img.shields.io/badge/python-3.10 | 3.11 | 3.12-blue.svg" alt="python">
|
<img src="https://img.shields.io/badge/python-3.10 | 3.11 | 3.12-blue.svg" alt="python">
|
||||||
@@ -39,7 +33,7 @@
|
|||||||
|
|
||||||
## ✨ Features
|
## ✨ Features
|
||||||
|
|
||||||
- 💬 大模型对话、Agent:支持多种大模型,适配群聊和私聊;具有多轮对话、工具调用、多模态能力,并深度适配 [Dify](https://dify.ai)。目前支持 QQ、QQ频道,后续还将支持微信、WhatsApp、Discord等平台。
|
- 💬 大模型对话、Agent:支持多种大模型,适配群聊和私聊;具有多轮对话、工具调用、多模态能力,并深度适配 [Dify](https://dify.ai)。目前支持 QQ、QQ频道、企业微信,后续还将支持微信、WhatsApp、Discord等平台。
|
||||||
- 🛠️ 高稳定性、功能完备:原生支持访问控制、限速、敏感词过滤等机制;配置简单,支持多种部署方式。
|
- 🛠️ 高稳定性、功能完备:原生支持访问控制、限速、敏感词过滤等机制;配置简单,支持多种部署方式。
|
||||||
- 🧩 插件扩展、活跃社区:支持事件驱动、组件扩展等插件机制;丰富生态,目前已有数十个[插件](https://docs.langbot.app/plugin/plugin-intro.html)
|
- 🧩 插件扩展、活跃社区:支持事件驱动、组件扩展等插件机制;丰富生态,目前已有数十个[插件](https://docs.langbot.app/plugin/plugin-intro.html)
|
||||||
- 😻 [New] Web 管理面板:支持通过浏览器管理 LangBot 实例,具体支持功能,查看[文档](https://docs.langbot.app/webui/intro.html)
|
- 😻 [New] Web 管理面板:支持通过浏览器管理 LangBot 实例,具体支持功能,查看[文档](https://docs.langbot.app/webui/intro.html)
|
||||||
|
|||||||
@@ -110,8 +110,17 @@ class WecomClient():
|
|||||||
"enable_duplicate_check": 0,
|
"enable_duplicate_check": 0,
|
||||||
"duplicate_check_interval": 1800
|
"duplicate_check_interval": 1800
|
||||||
}
|
}
|
||||||
response = await client.post(url,json=params)
|
try:
|
||||||
data = response.json()
|
response = await client.post(url,json=params)
|
||||||
|
data = response.json()
|
||||||
|
except Exception as e:
|
||||||
|
raise Exception("Failed to send image: "+str(e))
|
||||||
|
|
||||||
|
# 企业微信错误码40014和42001,代表accesstoken问题
|
||||||
|
if data['errcode'] == 40014 or data['errcode'] == 42001:
|
||||||
|
self.access_token = await self.get_access_token(self.secret)
|
||||||
|
return await self.send_image(user_id,agent_id,media_id)
|
||||||
|
|
||||||
if data['errcode'] != 0:
|
if data['errcode'] != 0:
|
||||||
raise Exception("Failed to send image: "+str(data))
|
raise Exception("Failed to send image: "+str(data))
|
||||||
|
|
||||||
@@ -136,7 +145,9 @@ class WecomClient():
|
|||||||
}
|
}
|
||||||
response = await client.post(url,json=params)
|
response = await client.post(url,json=params)
|
||||||
data = response.json()
|
data = response.json()
|
||||||
|
if data['errcode'] == 40014 or data['errcode'] == 42001:
|
||||||
|
self.access_token = await self.get_access_token(self.secret)
|
||||||
|
return await self.send_private_msg(user_id,agent_id,content)
|
||||||
if data['errcode'] != 0:
|
if data['errcode'] != 0:
|
||||||
raise Exception("Failed to send message: "+str(data))
|
raise Exception("Failed to send message: "+str(data))
|
||||||
|
|
||||||
@@ -286,11 +297,14 @@ class WecomClient():
|
|||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
response = await client.post(url, headers=headers, content=body)
|
response = await client.post(url, headers=headers, content=body)
|
||||||
data = response.json()
|
data = response.json()
|
||||||
|
if data['errcode'] == 40014 or data['errcode'] == 42001:
|
||||||
|
self.access_token = await self.get_access_token(self.secret)
|
||||||
|
media_id = await self.upload_to_work(image)
|
||||||
if data.get('errcode', 0) != 0:
|
if data.get('errcode', 0) != 0:
|
||||||
raise Exception("failed to upload file")
|
raise Exception("failed to upload file")
|
||||||
|
|
||||||
return data.get('media_id')
|
media_id = data.get('media_id')
|
||||||
|
return media_id
|
||||||
|
|
||||||
async def download_image_to_bytes(self,url:str) -> bytes:
|
async def download_image_to_bytes(self,url:str) -> bytes:
|
||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class AnthropicMessages(requester.LLMAPIRequester):
|
|||||||
timeout=typing.cast(httpx.Timeout, self.ap.provider_cfg.data['requester']['anthropic-messages']['timeout']),
|
timeout=typing.cast(httpx.Timeout, self.ap.provider_cfg.data['requester']['anthropic-messages']['timeout']),
|
||||||
limits=anthropic._constants.DEFAULT_CONNECTION_LIMITS,
|
limits=anthropic._constants.DEFAULT_CONNECTION_LIMITS,
|
||||||
follow_redirects=True,
|
follow_redirects=True,
|
||||||
proxies=self.ap.proxy_mgr.get_forward_proxies()
|
trust_env=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.client = anthropic.AsyncAnthropic(
|
self.client = anthropic.AsyncAnthropic(
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class OpenAIChatCompletions(requester.LLMAPIRequester):
|
|||||||
base_url=self.requester_cfg['base-url'],
|
base_url=self.requester_cfg['base-url'],
|
||||||
timeout=self.requester_cfg['timeout'],
|
timeout=self.requester_cfg['timeout'],
|
||||||
http_client=httpx.AsyncClient(
|
http_client=httpx.AsyncClient(
|
||||||
proxies=self.ap.proxy_mgr.get_forward_proxies()
|
trust_env=True,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
semantic_version = "v3.4.3"
|
semantic_version = "v3.4.3.2"
|
||||||
|
|
||||||
debug_mode = False
|
debug_mode = False
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user