ai 开始测试
This commit is contained in:
@@ -93,6 +93,7 @@ def passToken():
|
||||
print(e)
|
||||
return ResultData(data="").toJson()
|
||||
|
||||
|
||||
# 获取设备列表
|
||||
@app.route('/deviceList', methods=['GET'])
|
||||
def deviceList():
|
||||
@@ -112,6 +113,7 @@ def deviceList():
|
||||
LogManager.error("获取设备列表失败:", e)
|
||||
return ResultData(data=[]).toJson()
|
||||
|
||||
|
||||
# 获取设备应用列表
|
||||
@app.route('/deviceAppList', methods=['POST'])
|
||||
def deviceAppList():
|
||||
@@ -230,11 +232,14 @@ def stopScript():
|
||||
return ResultData(code=code, data="", msg=msg).toJson()
|
||||
|
||||
|
||||
# 传递主播数据
|
||||
# 传递主播数据(关注主播打招呼)
|
||||
@app.route('/passAnchorData', methods=['POST'])
|
||||
def passAnchorData():
|
||||
data: Dict[str, Any] = request.get_json()
|
||||
# 设备列表
|
||||
|
||||
print("接收的数据", data)
|
||||
|
||||
idList = data.get("deviceList", [])
|
||||
# 主播列表
|
||||
acList = data.get("anchorList", [])
|
||||
@@ -247,7 +252,8 @@ def passAnchorData():
|
||||
manager = ScriptManager()
|
||||
event = threading.Event()
|
||||
# 启动脚本
|
||||
thread = threading.Thread(target=manager.greetNewFollowers, args=(udid, needReply, event))
|
||||
# thread = threading.Thread(target=manager.greetNewFollowers, args=(udid, needReply, event))
|
||||
thread = threading.Thread(target=manager.safe_greetNewFollowers, args=(udid, needReply, event))
|
||||
thread.start()
|
||||
# 添加到线程管理
|
||||
ThreadManager.add(udid, thread, event)
|
||||
@@ -270,8 +276,24 @@ def getChatTextInfo():
|
||||
client = wda.USBClient(udid)
|
||||
session = client.session()
|
||||
xml = session.source()
|
||||
result = AiUtils.extract_messages_from_xml(xml)
|
||||
return ResultData(data=result).toJson()
|
||||
try:
|
||||
result = AiUtils.extract_messages_from_xml(xml)
|
||||
print(result)
|
||||
return ResultData(data=result).toJson()
|
||||
except Exception as e:
|
||||
data = [
|
||||
{
|
||||
'type': 'msg',
|
||||
'dir': 'in',
|
||||
'text': '当前页面无法获取聊天记录,请在tiktok聊天页面进行获取!!!'
|
||||
},
|
||||
{
|
||||
'type': 'msg',
|
||||
'dir': 'in',
|
||||
'text': 'Unable to retrieve chat messages on the current screen. Please navigate to the TikTok chat page and try again!!!'
|
||||
}
|
||||
]
|
||||
return ResultData(data=data, msg="解析失败").toJson()
|
||||
|
||||
|
||||
# 监控消息
|
||||
|
||||
@@ -27,7 +27,7 @@ if "--role=flask" in sys.argv:
|
||||
# 项目入口
|
||||
if __name__ == "__main__":
|
||||
# 清空日志等
|
||||
LogManager.clearLogs()
|
||||
# LogManager.clearLogs()
|
||||
|
||||
# 启动 Flask 子进程
|
||||
manager = FlaskSubprocessManager.get_instance()
|
||||
|
||||
Reference in New Issue
Block a user