Skip to content

Commit

Permalink
configure
Browse files Browse the repository at this point in the history
  • Loading branch information
vyokky committed Dec 18, 2024
1 parent 8ad9979 commit 9ffd5c0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions documents/docs/configurations/developer_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The following parameters are included in the system configuration of the UFO age
|-------------------------|---------------------------------------------------------------------------------------------------------|----------|---------------|
| `CONTROL_BACKEND` | The backend for control action, currently supporting `uia` and `win32`. | String | "uia" |
| `MAX_STEP` | The maximum step limit for completing the user request in a session. | Integer | 100 |
| `MAX_ROUND` | The maximum round limit for completing the user request in a session. | Integer | 10 |
| `SLEEP_TIME` | The sleep time in seconds between each step to wait for the window to be ready. | Integer | 5 |
| `RECTANGLE_TIME` | The time in seconds for the rectangle display around the selected control. | Integer | 1 |
| `SAFE_GUARD` | Whether to use the safe guard to ask for user confirmation before performing sensitive operations. | Boolean | True |
Expand Down
3 changes: 2 additions & 1 deletion ufo/config/config_dev.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CONTROL_BACKEND: "uia" # The backend for control action, currently we support uia and win32
MAX_STEP: 100 # The max step limit for completing the user request
MAX_ROUND: 10 # The max round limit for completing the user request
SLEEP_TIME: 1 # The sleep time between each step to wait for the window to be ready
RECTANGLE_TIME: 1

Expand Down Expand Up @@ -107,5 +108,5 @@ SAVE_UI_TREE: False # Whether to save the UI tree
TASK_STATUS: True # Whether to record the status of the tasks in batch execution mode.

# Experience saving
SAVE_EXPERIENCE: "always_not" # Whether to save the experience, can be "always" for always save, "always_not" for always not save, "ask" for asking the user to save or not. By default, it is "always_not"
SAVE_EXPERIENCE: "ask" # Whether to save the experience, can be "always" for always save, "always_not" for always not save, "ask" for asking the user to save or not. By default, it is "always_not"

6 changes: 5 additions & 1 deletion ufo/module/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,11 @@ def is_finished(self) -> bool:
Check if the session is ended.
return: True if the session is ended, otherwise False.
"""
if self._finish or self.step >= configs["MAX_STEP"]:
if (
self._finish
or self.step >= configs["MAX_STEP"]
or self.total_rounds >= configs["MAX_ROUND"]
):
return True

if self.is_error():
Expand Down

0 comments on commit 9ffd5c0

Please # to comment.