Compare commits

...

25 Commits

Author SHA1 Message Date
Junyan Qin
c67caf18df chore: release v3.4.10.3 2025-03-10 22:58:23 +08:00
Junyan Qin (Chin)
fe956fe4a5 Merge pull request #1181 from wangcham/master
fix: wrong group id in qqofficial web hook
2025-03-10 19:38:00 +08:00
wangcham
0e52f679a2 fix: wrong group id in webhook qq 2025-03-10 06:56:15 -04:00
Junyan Qin
b9500283ec fix(gewechat): remove necessary await in send_message 2025-03-10 15:16:10 +08:00
Junyan Qin (Chin)
441b69b528 Merge pull request #1174 from Muffeter/master 2025-03-07 18:37:18 +08:00
sonmu
898bcdc96b typo: fix README 2025-03-07 18:33:27 +08:00
Junyan Qin
02bc1fc45e chore: release v3.4.10.2 2025-03-05 21:12:52 +08:00
Junyan Qin (Chin)
5585981dc3 Merge pull request #1165 from fdc310/master
修复因为gewe将字段修改回原版而导致的我的判断逻辑问题
2025-03-05 21:12:21 +08:00
Dong_master
a4777f194b 修复因为gewe将字段修改回原版而导致的我的判断逻辑问题 2025-03-05 19:56:28 +08:00
Junyan Qin
41aeda8dc0 chore: release v3.4.10.1 2025-03-05 17:16:05 +08:00
Junyan Qin (Chin)
2ed522667e Merge pull request #1162 from fdc310/master
'修复了gewe更新回调参数data和typename字段改变造成的不回复的问题'
2025-03-05 17:14:27 +08:00
Dong_master
1932444666 '修复了gewe更新回调参数data和typename字段改变造成的不回复的问题' 2025-03-05 16:48:46 +08:00
Dong_master
b49b7e963d '修复了gewe更新回调参数data和typename字段改变造成的不回复的问题' 2025-03-05 00:54:39 +08:00
Junyan Qin
435c11ff27 doc(README): add more model in README 2025-03-03 21:26:39 +08:00
Junyan Qin
2e93600437 feat: update llm-models.json template 2025-03-03 21:02:48 +08:00
Junyan Qin (Chin)
faecb70d0f Merge pull request #1154 from Yi-Lyu/master
将微信消息时间戳传递给 dify,便于 dify 通过消息时间戳来做业务逻辑。
2025-03-02 20:21:08 +08:00
Junyan Qin
92e1ac5c3a feat: add supports for passing time to dify workflow 2025-03-02 20:18:33 +08:00
Junyan Qin
8963a2117b feat: add field time in MessageEvent 2025-03-02 20:16:34 +08:00
Ethan
aa300258ab feat: enhance user message preprocessing to include message creation timestamp 2025-03-02 19:45:10 +08:00
Ethan
48841daff5 feat: enhance user message preprocessing to include message creation timestamp 2025-03-02 19:30:07 +08:00
Ethan
8878f1ed87 feat: enhance user message preprocessing to include message creation timestamp 2025-03-02 19:20:10 +08:00
Ethan
f6205d79c0 feat: enhance user message preprocessing to include message creation timestamp 2025-03-02 19:18:26 +08:00
Ethan
d6d5dac6b3 feat: enhance user message preprocessing to include message creation timestamp 2025-03-02 19:10:53 +08:00
Ethan
05b979e68a feat: enhance user message preprocessing to include message creation timestamp 2025-03-02 19:10:09 +08:00
Ethan
9f7d9e4c0d feat: enhance user message preprocessing to include message creation timestamp 2025-03-02 18:49:32 +08:00
11 changed files with 79 additions and 29 deletions

View File

@@ -9,7 +9,7 @@
<a href="https://trendshift.io/repositories/12901" target="_blank"><img src="https://trendshift.io/api/badge/repositories/12901" alt="RockChinQ%2FLangBot | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a> <a href="https://trendshift.io/repositories/12901" target="_blank"><img src="https://trendshift.io/api/badge/repositories/12901" alt="RockChinQ%2FLangBot | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
<a href="https://docs.langbot.app">项目主页</a> <a href="https://docs.langbot.app">项目主页</a>
<a href="https://docs.langbot.app/insight/intro.htmll">功能介绍</a> <a href="https://docs.langbot.app/insight/intro.html">功能介绍</a>
<a href="https://docs.langbot.app/insight/guide.html">部署文档</a> <a href="https://docs.langbot.app/insight/guide.html">部署文档</a>
<a href="https://docs.langbot.app/usage/faq.html">常见问题</a> <a href="https://docs.langbot.app/usage/faq.html">常见问题</a>
<a href="https://docs.langbot.app/plugin/plugin-intro.html">插件介绍</a> <a href="https://docs.langbot.app/plugin/plugin-intro.html">插件介绍</a>
@@ -115,6 +115,20 @@
| [阿里云百炼](https://bailian.console.aliyun.com/) | ✅ | 大模型聚合平台, LLMOps 平台 | | [阿里云百炼](https://bailian.console.aliyun.com/) | ✅ | 大模型聚合平台, LLMOps 平台 |
| [火山方舟](https://console.volcengine.com/ark/region:ark+cn-beijing/model?vendor=Bytedance&view=LIST_VIEW) | ✅ | 大模型聚合平台, LLMOps 平台 | | [火山方舟](https://console.volcengine.com/ark/region:ark+cn-beijing/model?vendor=Bytedance&view=LIST_VIEW) | ✅ | 大模型聚合平台, LLMOps 平台 |
### TTS
| 平台/模型 | 备注 |
| --- | --- |
| [FishAudio](https://fish.audio/zh-CN/discovery/) | [插件](https://github.com/the-lazy-me/NewChatVoice) |
| [海豚 AI](https://www.ttson.cn/?source=thelazy) | [插件](https://github.com/the-lazy-me/NewChatVoice) |
| [AzureTTS](https://portal.azure.com/) | [插件](https://github.com/Ingnaryk/LangBot_AzureTTS) |
### 文生图
| 平台/模型 | 备注 |
| --- | --- |
| 阿里云百炼 | [插件](https://github.com/Thetail001/LangBot_BailianTextToImagePlugin)
## 😘 社区贡献 ## 😘 社区贡献
LangBot 离不开以下贡献者和社区内所有人的贡献,我们欢迎任何形式的贡献和反馈。 LangBot 离不开以下贡献者和社区内所有人的贡献,我们欢迎任何形式的贡献和反馈。

View File

@@ -8,7 +8,7 @@
<a href="https://trendshift.io/repositories/12901" target="_blank"><img src="https://trendshift.io/api/badge/repositories/12901" alt="RockChinQ%2FLangBot | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a> <a href="https://trendshift.io/repositories/12901" target="_blank"><img src="https://trendshift.io/api/badge/repositories/12901" alt="RockChinQ%2FLangBot | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
<a href="https://docs.langbot.app">Home</a> <a href="https://docs.langbot.app">Home</a>
<a href="https://docs.langbot.app/insight/intro.htmll">Features</a> <a href="https://docs.langbot.app/insight/intro.html">Features</a>
<a href="https://docs.langbot.app/insight/guide.html">Deployment</a> <a href="https://docs.langbot.app/insight/guide.html">Deployment</a>
<a href="https://docs.langbot.app/usage/faq.html">FAQ</a> <a href="https://docs.langbot.app/usage/faq.html">FAQ</a>
<a href="https://docs.langbot.app/plugin/plugin-intro.html">Plugin</a> <a href="https://docs.langbot.app/plugin/plugin-intro.html">Plugin</a>

View File

@@ -8,7 +8,7 @@
<a href="https://trendshift.io/repositories/12901" target="_blank"><img src="https://trendshift.io/api/badge/repositories/12901" alt="RockChinQ%2FLangBot | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a> <a href="https://trendshift.io/repositories/12901" target="_blank"><img src="https://trendshift.io/api/badge/repositories/12901" alt="RockChinQ%2FLangBot | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
<a href="https://docs.langbot.app">ホーム</a> <a href="https://docs.langbot.app">ホーム</a>
<a href="https://docs.langbot.app/insight/intro.htmll">機能</a> <a href="https://docs.langbot.app/insight/intro.html">機能</a>
<a href="https://docs.langbot.app/insight/guide.html">デプロイ</a> <a href="https://docs.langbot.app/insight/guide.html">デプロイ</a>
<a href="https://docs.langbot.app/usage/faq.html">FAQ</a> <a href="https://docs.langbot.app/usage/faq.html">FAQ</a>
<a href="https://docs.langbot.app/plugin/plugin-intro.html">プラグイン</a> <a href="https://docs.langbot.app/plugin/plugin-intro.html">プラグイン</a>

View File

@@ -77,7 +77,7 @@ class DingTalkEventConverter(adapter.EventConverter):
remark="" remark=""
), ),
message_chain = message_chain, message_chain = message_chain,
time = datetime.datetime.now(), time = event.incoming_message.create_at,
source_platform_object=event, source_platform_object=event,
) )
elif event.conversation == 'GroupMessage': elif event.conversation == 'GroupMessage':
@@ -95,7 +95,7 @@ class DingTalkEventConverter(adapter.EventConverter):
last_speak_timestamp=0, last_speak_timestamp=0,
mute_time_remaining=0 mute_time_remaining=0
) )
time = datetime.datetime.now(), time = event.incoming_message.create_at
return platform_events.GroupMessage( return platform_events.GroupMessage(
sender =sender, sender =sender,
message_chain = message_chain, message_chain = message_chain,

View File

@@ -227,6 +227,13 @@ class GeWeChatAdapter(adapter.MessagePlatformAdapter):
async def gewechat_callback(): async def gewechat_callback():
data = await quart.request.json data = await quart.request.json
# print(json.dumps(data, indent=4, ensure_ascii=False)) # print(json.dumps(data, indent=4, ensure_ascii=False))
if 'data' in data:
data['Data'] = data['data']
if 'type_name' in data:
data['TypeName'] = data['type_name']
# print(json.dumps(data, indent=4, ensure_ascii=False))
if 'testMsg' in data: if 'testMsg' in data:
return 'ok' return 'ok'
@@ -248,17 +255,17 @@ class GeWeChatAdapter(adapter.MessagePlatformAdapter):
target_id: str, target_id: str,
message: platform_message.MessageChain message: platform_message.MessageChain
): ):
geweap_msg = await GewechatMessageConverter.yiri2target(message) geweap_msg = await self.message_converter.yiri2target(message)
# 此处加上群消息at处理 # 此处加上群消息at处理
# ats = [item["target"] for item in geweap_msg if item["type"] == "at"] # ats = [item["target"] for item in geweap_msg if item["type"] == "at"]
for msg in geweap_msg: for msg in geweap_msg:
if msg['type'] == 'text': if msg['type'] == 'text':
await self.bot.post_text(app_id=self.config['app_id'], to_wxid=target_id, content=msg['content']) self.bot.post_text(app_id=self.config['app_id'], to_wxid=target_id, content=msg['content'])
elif msg['type'] == 'image': elif msg['type'] == 'image':
await self.bot.post_image(app_id=self.config['app_id'], to_wxid=target_id, img_url=msg["image"]) self.bot.post_image(app_id=self.config['app_id'], to_wxid=target_id, img_url=msg["image"])

View File

@@ -74,7 +74,11 @@ class QQOfficialEventConverter(adapter.EventConverter):
remark = "", remark = "",
) )
return platform_events.FriendMessage( return platform_events.FriendMessage(
sender = friend,message_chain = yiri_chain,time = event.timestamp, sender = friend,message_chain = yiri_chain,time = int(
datetime.datetime.strptime(
event.timestamp, "%Y-%m-%dT%H:%M:%S%z"
).timestamp()
),
source_platform_object=event source_platform_object=event
) )
@@ -96,7 +100,7 @@ class QQOfficialEventConverter(adapter.EventConverter):
member_name= event.t, member_name= event.t,
permission= 'MEMBER', permission= 'MEMBER',
group = platform_entities.Group( group = platform_entities.Group(
id = 0, id = event.group_openid,
name = 'MEMBER', name = 'MEMBER',
permission= platform_entities.Permission.Member permission= platform_entities.Permission.Member
), ),
@@ -105,7 +109,11 @@ class QQOfficialEventConverter(adapter.EventConverter):
last_speak_timestamp=0, last_speak_timestamp=0,
mute_time_remaining=0 mute_time_remaining=0
) )
time = event.timestamp time = int(
datetime.datetime.strptime(
event.timestamp, "%Y-%m-%dT%H:%M:%S%z"
).timestamp()
)
return platform_events.GroupMessage( return platform_events.GroupMessage(
sender = sender, sender = sender,
message_chain=yiri_chain, message_chain=yiri_chain,
@@ -119,7 +127,7 @@ class QQOfficialEventConverter(adapter.EventConverter):
member_name=event.t, member_name=event.t,
permission= 'MEMBER', permission= 'MEMBER',
group = platform_entities.Group( group = platform_entities.Group(
id = 0, id = event.channel_id,
name = 'MEMBER', name = 'MEMBER',
permission=platform_entities.Permission.Member permission=platform_entities.Permission.Member
), ),
@@ -128,7 +136,11 @@ class QQOfficialEventConverter(adapter.EventConverter):
last_speak_timestamp=0, last_speak_timestamp=0,
mute_time_remaining=0 mute_time_remaining=0
) )
time = event.timestamp, time = int(
datetime.datetime.strptime(
event.timestamp, "%Y-%m-%dT%H:%M:%S%z"
).timestamp()
)
return platform_events.GroupMessage( return platform_events.GroupMessage(
sender =sender, sender =sender,
message_chain = yiri_chain, message_chain = yiri_chain,

View File

@@ -2,18 +2,15 @@ from __future__ import annotations
import typing import typing
import asyncio import asyncio
import traceback import traceback
import time
import datetime import datetime
import aiocqhttp
import aiohttp
from libs.wecom_api.api import WecomClient from libs.wecom_api.api import WecomClient
from pkg.platform.adapter import MessagePlatformAdapter from pkg.platform.adapter import MessagePlatformAdapter
from pkg.platform.types import events as platform_events, message as platform_message from pkg.platform.types import events as platform_events, message as platform_message
from libs.wecom_api.wecomevent import WecomEvent from libs.wecom_api.wecomevent import WecomEvent
from pkg.core import app from pkg.core import app
from .. import adapter from .. import adapter
from ...pipeline.longtext.strategies import forward
from ...core import app from ...core import app
from ..types import message as platform_message from ..types import message as platform_message
from ..types import events as platform_events from ..types import events as platform_events

View File

@@ -57,6 +57,9 @@ class MessageEvent(Event):
message_chain: platform_message.MessageChain message_chain: platform_message.MessageChain
"""消息内容。""" """消息内容。"""
time: float | None = None
"""消息发送时间戳。"""
source_platform_object: typing.Optional[typing.Any] = None source_platform_object: typing.Optional[typing.Any] = None
"""原消息平台对象。 """原消息平台对象。
供消息平台适配器开发者使用,如果回复用户时需要使用原消息事件对象的信息, 供消息平台适配器开发者使用,如果回复用户时需要使用原消息事件对象的信息,

View File

@@ -5,6 +5,7 @@ import json
import uuid import uuid
import re import re
import base64 import base64
import datetime
import aiohttp import aiohttp
@@ -69,6 +70,7 @@ class DifyServiceAPIRunner(runner.RequestRunner):
""" """
plain_text = "" plain_text = ""
image_ids = [] image_ids = []
if isinstance(query.user_message.content, list): if isinstance(query.user_message.content, list):
for ce in query.user_message.content: for ce in query.user_message.content:
if ce.type == "text": if ce.type == "text":
@@ -230,6 +232,9 @@ class DifyServiceAPIRunner(runner.RequestRunner):
plain_text, image_ids = await self._preprocess_user_message(query) plain_text, image_ids = await self._preprocess_user_message(query)
# 尝试获取 CreateTime
create_time = int(query.message_event.time) if query.message_event.time else int(datetime.datetime.now().timestamp())
files = [ files = [
{ {
"type": "image", "type": "image",
@@ -246,6 +251,7 @@ class DifyServiceAPIRunner(runner.RequestRunner):
"langbot_user_message_text": plain_text, "langbot_user_message_text": plain_text,
"langbot_session_id": f"{query.session.launcher_type.value}_{query.session.launcher_id}", "langbot_session_id": f"{query.session.launcher_type.value}_{query.session.launcher_id}",
"langbot_conversation_id": cov_id, "langbot_conversation_id": cov_id,
"langbot_msg_create_time": create_time,
}, },
user=f"{query.session.launcher_type.value}_{query.session.launcher_id}", user=f"{query.session.launcher_type.value}_{query.session.launcher_id}",
files=files, files=files,

View File

@@ -1,4 +1,4 @@
semantic_version = "v3.4.10" semantic_version = "v3.4.10.3"
debug_mode = False debug_mode = False

View File

@@ -166,61 +166,72 @@
{ {
"name": "glm-4-plus", "name": "glm-4-plus",
"requester": "zhipuai-chat-completions", "requester": "zhipuai-chat-completions",
"token_mgr": "zhipuai" "token_mgr": "zhipuai",
"tool_call_supported": true
}, },
{ {
"name": "glm-4-0520", "name": "glm-4-0520",
"requester": "zhipuai-chat-completions", "requester": "zhipuai-chat-completions",
"token_mgr": "zhipuai" "token_mgr": "zhipuai",
"tool_call_supported": true
}, },
{ {
"name": "glm-4-air", "name": "glm-4-air",
"requester": "zhipuai-chat-completions", "requester": "zhipuai-chat-completions",
"token_mgr": "zhipuai" "token_mgr": "zhipuai",
"tool_call_supported": true
}, },
{ {
"name": "glm-4-airx", "name": "glm-4-airx",
"requester": "zhipuai-chat-completions", "requester": "zhipuai-chat-completions",
"token_mgr": "zhipuai" "token_mgr": "zhipuai",
"tool_call_supported": true
}, },
{ {
"name": "glm-4-long", "name": "glm-4-long",
"requester": "zhipuai-chat-completions", "requester": "zhipuai-chat-completions",
"token_mgr": "zhipuai" "token_mgr": "zhipuai",
"tool_call_supported": true
}, },
{ {
"name": "glm-4-flashx", "name": "glm-4-flashx",
"requester": "zhipuai-chat-completions", "requester": "zhipuai-chat-completions",
"token_mgr": "zhipuai" "token_mgr": "zhipuai",
"tool_call_supported": true
}, },
{ {
"name": "glm-4-flash", "name": "glm-4-flash",
"requester": "zhipuai-chat-completions", "requester": "zhipuai-chat-completions",
"token_mgr": "zhipuai" "token_mgr": "zhipuai",
"tool_call_supported": true
}, },
{ {
"name": "glm-4v-plus", "name": "glm-4v-plus",
"requester": "zhipuai-chat-completions", "requester": "zhipuai-chat-completions",
"token_mgr": "zhipuai", "token_mgr": "zhipuai",
"vision_supported": true "vision_supported": true,
"tool_call_supported": true
}, },
{ {
"name": "glm-4v", "name": "glm-4v",
"requester": "zhipuai-chat-completions", "requester": "zhipuai-chat-completions",
"token_mgr": "zhipuai", "token_mgr": "zhipuai",
"vision_supported": true "vision_supported": true,
"tool_call_supported": true
}, },
{ {
"name": "glm-4v-flash", "name": "glm-4v-flash",
"requester": "zhipuai-chat-completions", "requester": "zhipuai-chat-completions",
"token_mgr": "zhipuai", "token_mgr": "zhipuai",
"vision_supported": true "vision_supported": true,
"tool_call_supported": true
}, },
{ {
"name": "glm-zero-preview", "name": "glm-zero-preview",
"requester": "zhipuai-chat-completions", "requester": "zhipuai-chat-completions",
"token_mgr": "zhipuai", "token_mgr": "zhipuai",
"vision_supported": true "vision_supported": true,
"tool_call_supported": true
} }
] ]
} }