diff --git a/.idea/iOSAI.iml b/.idea/iOSAI.iml index df5cbff..f571432 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 c27b771..db8786c 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 5e7915d..00341f0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -6,10 +6,7 @@ - - - - + - { + "keyToString": { + "ASKED_ADD_EXTERNAL_FILES": "true", + "Python.12.executor": "Run", + "Python.123.executor": "Run", + "Python.Main.executor": "Run", + "Python.tidevice_entry.executor": "Run", + "RunOnceActivity.ShowReadmeOnStart": "true", + "RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true", + "RunOnceActivity.git.unshallow": "true", + "SHARE_PROJECT_CONFIGURATION_FILES": "true", + "git-widget-placeholder": "main", + "javascript.nodejs.core.library.configured.version": "20.17.0", + "javascript.nodejs.core.library.typings.version": "20.17.58", + "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": "preferences.editor.code.editing", + "vue.rearranger.settings.migration": "true" } -}]]> +} @@ -122,29 +118,6 @@ - @@ -267,7 +238,7 @@ - + - - - @@ -345,16 +308,15 @@ + - - - - + - - + + + \ No newline at end of file diff --git a/Module/FlaskService.py b/Module/FlaskService.py index c1a21d7..725d3ac 100644 --- a/Module/FlaskService.py +++ b/Module/FlaskService.py @@ -358,7 +358,6 @@ def queryAnchorList(): data = [] return ResultData(data=data).toJson() - # 删除主播 @app.route("/deleteAnchorWithIds", methods=['POST']) def deleteAnchorWithIds(): @@ -367,6 +366,23 @@ def deleteAnchorWithIds(): deleted = AiUtils.delete_anchors_by_ids(ids) return ResultData(data={"deleted": deleted}).toJson() +@app.route("/aiConfig", methods=['POST']) +def aiConfig(): + data = request.get_json() + agentName = data.get("agentName") + guildName = data.get("guildName") + contactTool = data.get("contactTool") + contact = data.get("contact") + + dict = { + "agentName": agentName, + "guildName": guildName, + "contactTool": contactTool, + "contact": contact + } + + JsonUtils.write_json("aiConfig", dict) + return ResultData(data="").toJson() # 查询主播聊天发送的最后一条信息 @app.route("/select_last_message", methods=['GET']) diff --git a/Utils/LogManager.py b/Utils/LogManager.py index a39050c..67e8a24 100644 --- a/Utils/LogManager.py +++ b/Utils/LogManager.py @@ -240,7 +240,7 @@ def _force_utf8_everywhere(): except Exception: pass -_force_utf8_everywhere() +# _force_utf8_everywhere() # ========= 全局:强制 UTF-8 + 关闭缓冲(运行期立刻生效) ========= diff --git a/Utils/Requester.py b/Utils/Requester.py index 6545167..a45dac4 100644 --- a/Utils/Requester.py +++ b/Utils/Requester.py @@ -1,5 +1,6 @@ import requests from Entity.Variables import prologueList +from Utils.JsonUtils import JsonUtils from Utils.LogManager import LogManager BaseUrl = "https://crawlclient.api.yolozs.com/api/common/" @@ -44,6 +45,17 @@ class Requester(): # ai聊天 @classmethod def chatToAi(cls, param): + aiConfig = JsonUtils.read_json("aiConfig") + agentName = aiConfig.get("agentName") + guildName = aiConfig.get("guildName") + contactTool = aiConfig.get("contactTool", "") + contact = aiConfig.get("contact", "") + + param["agentName"] = agentName + param["guildName"] = guildName + param["contactTool"] = contactTool + param["contact"] = contact + try: url = "https://ai.yolozs.com/chat" result = requests.request(url=url, json=param, method="POST") diff --git a/data/aiConfig.json b/data/aiConfig.json new file mode 100644 index 0000000..07dd0e9 --- /dev/null +++ b/data/aiConfig.json @@ -0,0 +1,6 @@ +{ + "agentName": "小花", + "guildName": "牛逼工会", + "contactTool": "line", + "contact": "7788990" +} \ No newline at end of file