From 31f0e19b13649f51a5e98ea7baa85375ea2dd891 Mon Sep 17 00:00:00 2001
From: zhangkai <2403741920@qq.com>
Date: Fri, 5 Sep 2025 19:16:14 +0800
Subject: [PATCH] =?UTF-8?q?20250904-=E5=88=9D=E6=AD=A5=E5=8A=9F=E8=83=BD?=
=?UTF-8?q?=E5=B7=B2=E5=AE=8C=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/iOSAI.iml | 2 +-
.idea/misc.xml | 2 +-
.idea/workspace.xml | 75 ++++++++++++++++++++++++-----------------
script/ScriptManager.py | 27 +++++++++++----
tidevice_entry.py | 45 -------------------------
5 files changed, 66 insertions(+), 85 deletions(-)
delete mode 100644 tidevice_entry.py
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 33c043d..a4c3660 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,10 +5,8 @@
-
-
-
-
+
+
@@ -48,33 +46,48 @@
- {
+ "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"
}
-}]]>
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -217,15 +230,15 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
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()
diff --git a/tidevice_entry.py b/tidevice_entry.py
deleted file mode 100644
index 9d5855b..0000000
--- a/tidevice_entry.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# from Utils.Requester import Requester
-#
-#
-# # 获取主播的名称
-# anchor_name = "123"
-#
-# anchorWithSession = {}
-#
-#
-# while True:
-# # 向ai发送信息
-# last_msg_text = input("请输入:")
-#
-#
-# if anchor_name not in anchorWithSession:
-# # 如果是第一次发消息(没有sessionId的情况)
-# response = Requester.chatToAi({"msg": last_msg_text})
-# aiResult = response['result']
-# sessionId = response['session_id']
-#
-# anchorWithSession[anchor_name] = sessionId
-# # 找到输入框,输入ai返回出来的消息
-# print(aiResult)
-#
-# else:
-# # 如果不是第一次发消息(证明存储的有sessionId)
-# sessionId = anchorWithSession[anchor_name]
-# response = Requester.chatToAi({"msg": last_msg_text, "sid": sessionId})
-# aiResult = response['result']
-# print(aiResult)
-import datetime
-
-import wda
-
-udid = "e5ab9d3c548302dca3b1383589ac43eedd41f24e"
-
-client = wda.USBClient(udid)
-session = client.session()
-session.appium_settings({"snapshotMaxDepth": 15})
-
-print(session.source())
-
-
-
-