You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ailice/modules/ABrowser.py
+6-2Lines changed: 6 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,8 @@ def ModuleInfo(self):
33
33
"SEARCH-UP-BROWSER": {"func": "SearchUp", "prompt": "Search content upward from the current location.", "type": "supportive"},
34
34
"GET-LINK": {"func": "GetLink", "prompt": "Get the url on the specified text fragment. The text needs to be one of those text fragments enclosed by square brackets on the page (excluding the square brackets themselves).", "type": "supportive"},
35
35
"EXECUTE-JS": {"func": "ExecuteJS", "prompt": "Execute js code on the current web page, especially suitable for form operations such as entering text, clicking buttons, etc. Use triple quotes on your code.", "type": "supportive"},
36
-
"REPLACE": {"func": "Replace", "prompt": "Replace and edit content within the current page. When regexMode==True, you can use regular expressions to represent the pattern and replacement. This function is a simple wrapper for re.sub() in this mode. When regexMode==False, pattern and replacement represent literal strings. Use triple quotes to represent pattern and replacement.", "type": "supportive"},
36
+
"REPLACE": {"func": "Replace", "prompt": "Replace the matching content within the current page. When regexMode==True, you can use regular expressions to represent the pattern and replacement. This function is a simple wrapper for re.sub() in this mode. When regexMode==False, pattern and replacement represent literal strings. Use triple quotes to represent pattern and replacement.", "type": "supportive"},
37
+
"REPLACE-ALL": {"func": "ReplaceAll", "prompt": "Replace all matching content in the entire document. When regexMode==True, you can use regular expressions to represent the pattern and replacement. This function is a simple wrapper for re.sub() in this mode. When regexMode==False, pattern and replacement represent literal strings. Use triple quotes to represent pattern and replacement.", "type": "supportive"},
37
38
"SAVETO": {"func": "SaveTo", "prompt": "Save the modified content to a file. If the dstPath parameter is an empty string, save it to the original file.", "type": "supportive"},
returnself.sessions[session].Replace(pattern, replacement, regexMode) ifhasattr(self.sessions[session], "Replace") else"Replace not supported in current browser."
returnself.sessions[session].ReplaceAll(pattern, replacement, regexMode) ifhasattr(self.sessions[session], "ReplaceAll") else"ReplaceAll not supported in current browser."
The document is in editable mode. You can edit the content using the following functions:
14
-
#Replace and edit content within the current page. When regexMode==True, you can use regular expressions to represent the pattern and replacement. This function is a simple wrapper for re.sub() in this mode. When regexMode==False, pattern and replacement represent literal strings. Use triple quotes to represent pattern and replacement.
14
+
#Replace the matching content within the current page. When regexMode==True, you can use regular expressions to represent the pattern and replacement. This function is a simple wrapper for re.sub() in this mode. When regexMode==False, pattern and replacement represent literal strings. Use triple quotes to represent pattern and replacement.
msg="Pattern NOT FOUND in current visible page. Please check: 1. If the pattern you entered is correct, such as whether you forgot to properly escape characters within the quotes. 2. Ensure that the content to be replaced is within the currently visible page (you can use the SEARCHDOWN/SEARCHUP to locate it, or directly use the REPLACE-ALL to replace all matching content).\n\n---\n\n"
64
+
if (self(prompt=False) !=textNew) or (""==pattern):
65
+
msg="The matching contents has been replaced. \n\n---\n\n"
msg="Pattern NOT FOUND in the entire document. Please check if the pattern you entered is correct, such as whether you forgot to properly escape characters within the quotes.\n\n---\n\n"
75
+
if (self.txt!=textNew) or (""==pattern):
76
+
msg="The matching contents has been replaced. \n\n---\n\n"
0 commit comments