diff --git a/.idea/iOSAI.iml b/.idea/iOSAI.iml
index f571432..df5cbff 100644
--- a/.idea/iOSAI.iml
+++ b/.idea/iOSAI.iml
@@ -2,7 +2,7 @@
-
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index db8786c..c27b771 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,5 +3,5 @@
-
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 72ca1d6..90c99b1 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,7 +5,12 @@
-
+
+
+
+
+
+
@@ -45,27 +50,27 @@
- {
- "keyToString": {
- "ASKED_ADD_EXTERNAL_FILES": "true",
- "Python.123.executor": "Run",
- "Python.Main.executor": "Run",
- "Python.tidevice_entry.executor": "Run",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "SHARE_PROJECT_CONFIGURATION_FILES": "true",
- "git-widget-placeholder": "main",
- "javascript.nodejs.core.library.configured.version": "22.18.0",
- "javascript.nodejs.core.library.typings.version": "22.18.1",
- "last_opened_file_path": "F:/company code/AI item/20250820/iOSAI",
- "node.js.detected.package.eslint": "true",
- "node.js.detected.package.tslint": "true",
- "node.js.selected.package.eslint": "(autodetect)",
- "node.js.selected.package.tslint": "(autodetect)",
- "nodejs_package_manager_path": "npm",
- "settings.editor.selected.configurable": "com.gitee.ui.GiteeSettingsConfigurable",
- "vue.rearranger.settings.migration": "true"
+
+}]]>
diff --git a/Utils/AiUtils.py b/Utils/AiUtils.py
index 5b055d3..9574bda 100644
--- a/Utils/AiUtils.py
+++ b/Utils/AiUtils.py
@@ -294,6 +294,7 @@ class AiUtils(object):
print(f"btn:{btn}")
return cls.findNumber(btn.label)
+
@classmethod
def extract_messages_from_xml(cls, xml: str):
"""
@@ -303,15 +304,6 @@ class AiUtils(object):
root = etree.fromstring(xml.encode("utf-8"))
items = []
- # 判断是否是聊天页面
- is_chat_page = False
- if root.xpath('//XCUIElementTypeStaticText[contains(@traits, "Header")]'):
- is_chat_page = True
- elif root.xpath('//XCUIElementTypeCell//XCUIElementTypeOther[@name or @label]'):
- is_chat_page = True
-
- if not is_chat_page:
- raise Exception("请先进入聊天页面")
# 屏幕宽度
app = root.xpath('/XCUIElementTypeApplication')
diff --git a/Utils/LogManager.py b/Utils/LogManager.py
index 8746ec4..cbb1b00 100644
--- a/Utils/LogManager.py
+++ b/Utils/LogManager.py
@@ -180,9 +180,9 @@ class LogManager:
if not log_path.exists():
return False
- timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
+ timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
filename = f"{timestamp}_logs.zip"
-
+ print(filename)
zip_buf = io.BytesIO()
with zipfile.ZipFile(zip_buf, "w", compression=zipfile.ZIP_DEFLATED) as zf:
for p in log_path.rglob("*"):
diff --git a/script/ScriptManager.py b/script/ScriptManager.py
index 16e8adb..59acb52 100644
--- a/script/ScriptManager.py
+++ b/script/ScriptManager.py
@@ -8,8 +8,9 @@ import os
from Utils.AiUtils import AiUtils
from Utils.ControlUtils import ControlUtils
from Utils.LogManager import LogManager
-from Entity.Variables import anchorList, removeModelFromAnchorList, prologueList, anchorWithSession
+from Entity.Variables import anchorList, removeModelFromAnchorList, anchorWithSession
from Utils.Requester import Requester
+import Entity.Variables as ev
# 脚本管理类
@@ -313,6 +314,10 @@ class ScriptManager():
ControlUtils.clickBack(session)
time.sleep(2)
+ print("循环条件1", not event.is_set())
+ print("循环条件2", len(anchorList) > 0)
+ print("总循环条件", not event.is_set() and len(anchorList) > 0)
+
# 循环条件。1、 循环关闭 2、 数据处理完毕
while not event.is_set() and len(anchorList) > 0:
@@ -452,12 +457,23 @@ class ScriptManager():
# 查找聊天界面中的输入框节点
chatInput = session.xpath("//TextView")
if chatInput.exists:
+
print("找到输入框了, 准备发送一条打招呼消息")
LogManager.method_info("找到输入框了, 准备发送一条打招呼消息", "关注打招呼", udid)
+
+ print("打招呼的数据", ev.prologueList)
+
# 准备打招呼的文案
- text = random.choice(prologueList)
- # 翻译成主播国家的语言
- msg = Requester.translation(text, anchorCountry)
+ text = random.choice(ev.prologueList)
+
+ isContainChniese = AiUtils.contains_chinese(text)
+
+ if isContainChniese:
+ # 翻译成主播国家的语言
+ msg = Requester.translation(text, anchorCountry)
+ else:
+ msg = text
+
# 准备发送一条信息
chatInput.click()
time.sleep(2)
@@ -487,8 +503,6 @@ class ScriptManager():
print("即将要回复消息")
LogManager.method_info("即将要回复消息", "关注打招呼", udid)
-
-
if needReply:
print("如果需要回复主播消息。走此逻辑")
@@ -497,7 +511,6 @@ class ScriptManager():
# 执行回复消息逻辑
self.monitorMessages(session, udid)
-
homeButton = AiUtils.findHomeButton(udid)
if homeButton.exists:
homeButton.click()