ForcomeBot 2.2.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- forcomebot-2.2.4.dist-info/METADATA +342 -0
- forcomebot-2.2.4.dist-info/RECORD +36 -0
- forcomebot-2.2.4.dist-info/WHEEL +4 -0
- forcomebot-2.2.4.dist-info/entry_points.txt +4 -0
- src/__init__.py +68 -0
- src/__main__.py +487 -0
- src/api/__init__.py +21 -0
- src/api/routes.py +775 -0
- src/api/websocket.py +280 -0
- src/auth/__init__.py +33 -0
- src/auth/database.py +87 -0
- src/auth/dingtalk.py +373 -0
- src/auth/jwt_handler.py +129 -0
- src/auth/middleware.py +260 -0
- src/auth/models.py +107 -0
- src/auth/routes.py +385 -0
- src/clients/__init__.py +7 -0
- src/clients/langbot.py +710 -0
- src/clients/qianxun.py +388 -0
- src/core/__init__.py +19 -0
- src/core/config_manager.py +411 -0
- src/core/log_collector.py +167 -0
- src/core/message_queue.py +364 -0
- src/core/state_store.py +242 -0
- src/handlers/__init__.py +8 -0
- src/handlers/message_handler.py +833 -0
- src/handlers/message_parser.py +325 -0
- src/handlers/scheduler.py +822 -0
- src/models.py +77 -0
- src/static/assets/index-B4i68B5_.js +50 -0
- src/static/assets/index-BPXisDkw.css +2 -0
- src/static/index.html +14 -0
- src/static/vite.svg +1 -0
- src/utils/__init__.py +13 -0
- src/utils/text_processor.py +166 -0
- src/utils/xml_parser.py +215 -0
src/models.py
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""数据模型定义"""
|
|
2
|
+
from pydantic import BaseModel
|
|
3
|
+
from typing import Optional, Any, Dict, List
|
|
4
|
+
from enum import IntEnum
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class QianXunEvent(IntEnum):
|
|
8
|
+
"""千寻框架事件类型"""
|
|
9
|
+
INJECT_SUCCESS = 10000 # 注入成功
|
|
10
|
+
PRIVATE_MSG = 10009 # 私聊消息
|
|
11
|
+
GROUP_MSG = 10008 # 群聊消息
|
|
12
|
+
USER_CHANGE = 10014 # 账号变动
|
|
13
|
+
FRIEND_REQUEST = 10011 # 好友请求
|
|
14
|
+
GROUP_INVITE = 10012 # 群邀请
|
|
15
|
+
GROUP_MEMBER_CHANGE = 10016 # 群成员变动
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class QianXunCallback(BaseModel):
|
|
19
|
+
"""千寻框架回调数据"""
|
|
20
|
+
event: int
|
|
21
|
+
wxid: str # 机器人wxid
|
|
22
|
+
data: Dict[str, Any]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class PrivateMsgData(BaseModel):
|
|
26
|
+
"""私聊消息数据"""
|
|
27
|
+
fromWxid: str # 发送者wxid
|
|
28
|
+
msg: str # 消息内容
|
|
29
|
+
msgType: int # 消息类型 1=文本
|
|
30
|
+
toWxid: Optional[str] = None # 接收者wxid(机器人)
|
|
31
|
+
finalFromWxid: Optional[str] = None
|
|
32
|
+
atWxidList: Optional[List[str]] = None
|
|
33
|
+
msgId: Optional[str] = None
|
|
34
|
+
timeStamp: Optional[str] = None
|
|
35
|
+
timestamp: Optional[str] = None
|
|
36
|
+
fromType: Optional[int] = None
|
|
37
|
+
msgSource: Optional[int] = None
|
|
38
|
+
silence: Optional[int] = None
|
|
39
|
+
membercount: Optional[int] = None
|
|
40
|
+
signature: Optional[str] = None
|
|
41
|
+
sendId: Optional[str] = None
|
|
42
|
+
msgXml: Optional[str] = None
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class GroupMsgData(BaseModel):
|
|
46
|
+
"""群聊消息数据"""
|
|
47
|
+
fromWxid: str # 群wxid
|
|
48
|
+
msg: str # 消息内容
|
|
49
|
+
msgType: int # 消息类型
|
|
50
|
+
finalFromWxid: Optional[str] = None # 实际发送者wxid
|
|
51
|
+
toWxid: Optional[str] = None
|
|
52
|
+
atWxidList: Optional[List[str]] = None # @的wxid列表
|
|
53
|
+
msgId: Optional[str] = None
|
|
54
|
+
timeStamp: Optional[str] = None
|
|
55
|
+
timestamp: Optional[str] = None
|
|
56
|
+
fromType: Optional[int] = None
|
|
57
|
+
msgSource: Optional[int] = None
|
|
58
|
+
silence: Optional[int] = None
|
|
59
|
+
membercount: Optional[int] = None
|
|
60
|
+
signature: Optional[str] = None
|
|
61
|
+
sendId: Optional[str] = None
|
|
62
|
+
msgXml: Optional[str] = None
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class LangBotMessage(BaseModel):
|
|
66
|
+
"""LangBot消息格式"""
|
|
67
|
+
type: str = "Plain"
|
|
68
|
+
text: str
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class LangBotRequest(BaseModel):
|
|
72
|
+
"""LangBot请求格式"""
|
|
73
|
+
bot_uuid: str
|
|
74
|
+
user_id: str
|
|
75
|
+
group_id: Optional[str] = None
|
|
76
|
+
message: List[LangBotMessage]
|
|
77
|
+
pipeline_uuid: Optional[str] = None
|