Skip to content

Commit 13f565d

Browse files
[Fix] ai_record_single_action api adjusted and non-ascii-ignore
1 parent ad4f37a commit 13f565d

4 files changed

Lines changed: 20 additions & 2 deletions

File tree

Apps/Web/AI_Recorder_2/dist/background/back_reocrder.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ async function fetchAIData(id, command, value, url, document){
9595
validate_full_text_by_ai = true;
9696
}
9797

98+
document = document.replace(/[^\x00-\x7F]/g, '');
99+
document = document.replace(/[\x00-\x1F\x7F]/g, ''); // Optionally remove control characters (0-31 and 127 in ASCII)
98100
var dataj = {
99101
"page_src": document,
100102
"action_name": command,
@@ -115,6 +117,10 @@ async function fetchAIData(id, command, value, url, document){
115117
}
116118
var r = await fetch(url_, input)
117119
var resp = await r.json();
120+
if (resp.info !== 'success'){
121+
console.error('resp', resp.info)
122+
return
123+
}
118124
let response = resp.ai_choices;
119125

120126
if (validate_full_text_by_ai){

Apps/Web/AI_Recorder_2/public/background/back_reocrder.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ async function fetchAIData(id, command, value, url, document){
9595
validate_full_text_by_ai = true;
9696
}
9797

98+
document = document.replace(/[^\x00-\x7F]/g, '');
99+
document = document.replace(/[\x00-\x1F\x7F]/g, ''); // Optionally remove control characters (0-31 and 127 in ASCII)
98100
var dataj = {
99101
"page_src": document,
100102
"action_name": command,
@@ -115,6 +117,10 @@ async function fetchAIData(id, command, value, url, document){
115117
}
116118
var r = await fetch(url_, input)
117119
var resp = await r.json();
120+
if (resp.info !== 'success'){
121+
console.error('resp', resp.info)
122+
return
123+
}
118124
let response = resp.ai_choices;
119125

120126
if (validate_full_text_by_ai){

Apps/Web/aiplugin/inspect.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ class Inspector {
143143

144144
// send data to zeuz server directly
145145

146+
refinedHtml = refinedHtml.replace(/[^\x00-\x7F]/g, '');
147+
refinedHtml = refinedHtml.replace(/[\x00-\x1F\x7F]/g, '');
146148
var data = JSON.stringify({
147149
"page_src": refinedHtml,
148150
"action_type": "selenium"
@@ -212,6 +214,8 @@ class Inspector {
212214

213215
// send data to zeuz server directly
214216

217+
refinedHtml = refinedHtml.replace(/[^\x00-\x7F]/g, '');
218+
refinedHtml = refinedHtml.replace(/[\x00-\x1F\x7F]/g, '');
215219
var data = JSON.stringify({
216220
"page_src": refinedHtml,
217221
"action_type": "selenium"

Apps/Windows/ZeuZ_Windows_Inspector.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,10 @@ def Upload(auth_thread, window_name):
131131

132132
r = requests.request("POST", url, headers=headers, data=content, verify=False)
133133
response = r.json()
134-
del response["content"]
135-
r.ok and print("Content successfully sent to AI Engine\n")
134+
if response["info"] == "success":
135+
r.ok and print("Content successfully sent to AI Engine\n")
136+
else:
137+
ExecLog("", response["info"], 3)
136138
except:
137139
Exception_Handler(sys.exc_info())
138140
ExecLog("", "Could not upload Element identifiers xml", 3)

0 commit comments

Comments
 (0)