computer-use-ootb-internal 0.0.98.post1__py3-none-any.whl → 0.0.100.post1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,8 @@ import threading
6
6
  import requests
7
7
  import platform # Add platform import
8
8
  import subprocess # Add subprocess import
9
+ import pyautogui # Add pyautogui import
10
+ import webbrowser # Add webbrowser import
9
11
  from fastapi import FastAPI, Request
10
12
  from fastapi.responses import JSONResponse
11
13
  from fastapi.middleware.cors import CORSMiddleware
@@ -103,13 +105,41 @@ def prepare_environment(state):
103
105
  print("Star Rail mode detected on Windows. Opening Edge browser...")
104
106
  url = "https://sr.mihoyo.com/cloud/#/"
105
107
  try:
106
- # Use cmd /c start to open the URL in Edge without blocking
107
- subprocess.run(["cmd", "/c", "start", "msedge", url], check=True, shell=False)
108
- print(f"Successfully requested Edge to open {url}")
108
+ # Use webbrowser.open to open the URL in the default browser
109
+ print(f"Attempting to open {url} in browser...")
110
+ webbrowser.open(url)
111
+ print(f"Successfully requested browser to open {url}")
112
+
113
+ # Add pyautogui click after opening the browser
114
+ time.sleep(5) # Increased wait time for the browser to load
115
+
116
+ # Print detected screen size
117
+ screen_width, screen_height = pyautogui.size()
118
+ print(f"Detected screen size: {screen_width}x{screen_height}")
119
+
120
+ click_x = int(screen_width * (1036 / 1280))
121
+ click_y = int(screen_height * (500 / 720))
122
+ print(f"Calculated click coordinates: ({click_x}, {click_y})")
123
+
124
+ # Disable failsafe before clicking
125
+ pyautogui.FAILSAFE = False
126
+ print("PyAutoGUI failsafe temporarily disabled.")
127
+
128
+ print(f"Clicking at coordinates: ({click_x}, {click_y})")
129
+ pyautogui.click(click_x, click_y)
130
+
131
+ # Re-enable failsafe (optional, as script might end anyway)
132
+ # pyautogui.FAILSAFE = True
133
+ # print("PyAutoGUI failsafe re-enabled.")
134
+
109
135
  except FileNotFoundError:
110
- print("Error: Microsoft Edge not found. Please ensure it's installed and in PATH.")
136
+ # This error is less likely with webbrowser.open
137
+ print("Error: Could not find a web browser to open the URL.")
111
138
  except Exception as e:
112
- print(f"Error opening Edge: {e}")
139
+ print(f"Error during environment preparation (browser/click): {e}")
140
+ finally:
141
+ # Ensure failsafe is re-enabled if an error occurs after disabling it
142
+ pyautogui.FAILSAFE = True
113
143
  else:
114
144
  # Placeholder for potential preparations on other OS or non-Star Rail modes
115
145
  print("Environment preparation: No specific actions required for this OS/mode.")
@@ -139,6 +169,9 @@ async def update_parameters(request: Request):
139
169
 
140
170
  log_ootb_request(shared_state.server_url, "update_params", data)
141
171
 
172
+ # Call the preparation function here, after parameters are updated
173
+ prepare_environment(shared_state)
174
+
142
175
  return JSONResponse(
143
176
  content={"status": "success", "message": "Parameters updated", "new_args": vars(shared_state.args)},
144
177
  status_code=200
@@ -313,9 +346,6 @@ def process_input():
313
346
  shared_state.is_paused = False
314
347
  shared_state.stop_event.clear() # Ensure stop event is cleared at the start
315
348
 
316
- # Call the preparation function before starting the loop
317
- prepare_environment(shared_state)
318
-
319
349
  print(f"start sampling loop: {shared_state.chatbot_messages}")
320
350
  print(f"shared_state.args before sampling loop: {shared_state.args}")
321
351
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: computer-use-ootb-internal
3
- Version: 0.0.98.post1
3
+ Version: 0.0.100.post1
4
4
  Summary: Computer Use OOTB
5
5
  Author-email: Siyuan Hu <siyuan.hu.sg@gmail.com>
6
6
  Requires-Python: >=3.11
@@ -1,5 +1,5 @@
1
1
  computer_use_ootb_internal/README.md,sha256=FxpW95lyub2iX73ZDfK6ML7SdEKg060H5I6Grub7li4,31
2
- computer_use_ootb_internal/app_teachmode.py,sha256=wRFPZa3B-ARqFbAoIf3EdGGbV1u1SSQ9emjQE1qIV0k,17258
2
+ computer_use_ootb_internal/app_teachmode.py,sha256=Ya8EnJAA6YfkcbaSEtoiGQ39_63IzJj1yawaSBuoZuk,18613
3
3
  computer_use_ootb_internal/app_teachmode_gradio.py,sha256=zAw-n3s20j1Jr0S4TzXHwllKV6APJ8HEHB1KqBuzriY,7907
4
4
  computer_use_ootb_internal/dependency_check.py,sha256=y8RMEP6RXQzTgU1MS_1piBLtz4J-Hfn9RjUZg59dyvo,1333
5
5
  computer_use_ootb_internal/example_websocket_js.html,sha256=BLYwDExVlgiAX4vXVXW3RuP5KD8FXE4EFXIl54bwF7w,1322
@@ -38,7 +38,7 @@ computer_use_ootb_internal/computer_use_demo/tools/computer_marbot.py,sha256=zZu
38
38
  computer_use_ootb_internal/computer_use_demo/tools/edit.py,sha256=b0PwUitxckHCQqFP3ZwlthWdqNkn7WETeTHeB6-o98c,11486
39
39
  computer_use_ootb_internal/computer_use_demo/tools/run.py,sha256=xhXdnBK1di9muaO44CEirL9hpGy3NmKbjfMpyeVmn8Y,1595
40
40
  computer_use_ootb_internal/computer_use_demo/tools/screen_capture.py,sha256=L8qfvtUkPPQGt92N-2Zfw5ZTDBzLsDps39uMnX3_uSA,6857
41
- computer_use_ootb_internal-0.0.98.post1.dist-info/METADATA,sha256=7-A0vq1lPrYlEnlaJLaimXN6KHhDaupNxFi4qETe4p4,942
42
- computer_use_ootb_internal-0.0.98.post1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
43
- computer_use_ootb_internal-0.0.98.post1.dist-info/entry_points.txt,sha256=-AbmawU7IRQuDZihgVMVDrFoY4E6rnXYOUB-5vSeBKs,93
44
- computer_use_ootb_internal-0.0.98.post1.dist-info/RECORD,,
41
+ computer_use_ootb_internal-0.0.100.post1.dist-info/METADATA,sha256=ascLHbLvpwRApjH4FAoNsNuES-GNyoIm5pmc96lqNWQ,943
42
+ computer_use_ootb_internal-0.0.100.post1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
43
+ computer_use_ootb_internal-0.0.100.post1.dist-info/entry_points.txt,sha256=-AbmawU7IRQuDZihgVMVDrFoY4E6rnXYOUB-5vSeBKs,93
44
+ computer_use_ootb_internal-0.0.100.post1.dist-info/RECORD,,