Skip to content

Commit

Permalink
refine doc
Browse files Browse the repository at this point in the history
  • Loading branch information
vyokky committed Jul 5, 2024
1 parent 1e423d4 commit 63eaccb
Show file tree
Hide file tree
Showing 4 changed files with 190 additions and 191 deletions.
57 changes: 56 additions & 1 deletion documents/docs/automator/web_automator.md
Original file line number Diff line number Diff line change
@@ -1 +1,56 @@
# Web Automator
# Web Automator

We also support the use of the `Web Automator` to get the content of a web page. The `Web Automator` is implemented in `ufo/autoamtor/app_apis/web` module.

## Configuration

There are several configurations that need to be set up before using the API Automator in the `config_dev.yaml` file. Below is the list of configurations related to the API Automator:

| Configuration Option | Description | Type | Default Value |
|-------------------------|---------------------------------------------------------------------------------------------------------|----------|---------------|
| `USE_APIS` | Whether to allow the use of application APIs. | Boolean | True |
| `APP_API_PROMPT_ADDRESS` | The prompt address for the application API. | Dict | {"WINWORD.EXE": "ufo/prompts/apps/word/api.yaml", "EXCEL.EXE": "ufo/prompts/apps/excel/api.yaml", "msedge.exe": "ufo/prompts/apps/web/api.yaml", "chrome.exe": "ufo/prompts/apps/web/api.yaml"} |


## Receiver
The Web Automator receiver is the `WebReceiver` class defined in the `ufo/automator/app_apis/web/webclient.py` module:

::: automator.app_apis.web.webclient.WebReceiver

<br>

## Command

We now only support one command in the Web Automator to get the content of a web page into a markdown format. More commands will be added in the future for the Web Automator.

```python
@WebReceiver.register
class WebCrawlerCommand(WebCommand):
"""
The command to run the crawler with various options.
"""

def execute(self):
"""
Execute the command to run the crawler.
:return: The result content.
"""
return self.receiver.web_crawler(
url=self.params.get("url"),
ignore_link=self.params.get("ignore_link", False),
)

@classmethod
def name(cls) -> str:
"""
The name of the command.
"""
return "web_crawler"
```


Below is the list of available commands in the Web Automator that are currently supported by UFO:

| Command Name | Function Name | Description |
|--------------|---------------|-------------|
| `WebCrawlerCommand` | `web_crawler` | Get the content of a web page into a markdown format. |
5 changes: 2 additions & 3 deletions documents/docs/automator/wincom_automator.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ There are several configurations that need to be set up before using the API Aut
| Configuration Option | Description | Type | Default Value |
|-------------------------|---------------------------------------------------------------------------------------------------------|----------|---------------|
| `USE_APIS` | Whether to allow the use of application APIs. | Boolean | True |
| `API_PROMPT` | The prompt for the UI automation API. | String | "ufo/prompts/share/base/api.yaml" |
| `WORD_API_PROMPT` | The prompt for the Word APIs. | String | "ufo/prompts/apps/word/api.yaml" |
| `EXCEL_API_PROMPT` | The prompt for the Excel APIs. | String | "ufo/prompts/apps/excel/api.yaml" |
| `APP_API_PROMPT_ADDRESS` | The prompt address for the application API. | Dict | {"WINWORD.EXE": "ufo/prompts/apps/word/api.yaml", "EXCEL.EXE": "ufo/prompts/apps/excel/api.yaml", "msedge.exe": "ufo/prompts/apps/web/api.yaml", "chrome.exe": "ufo/prompts/apps/web/api.yaml"} |


## Receiver
The base class for the receiver of the API Automator is the `WinCOMReceiverBasic` class defined in the `ufo/automator/app_apis/basic` module. It is initialized with the application's win32 com object and provides functionalities to interact with the application's native API. Below is the reference for the `WinCOMReceiverBasic` class:
Expand Down
3 changes: 1 addition & 2 deletions documents/docs/configurations/developer_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ These prompt configuration parameters are used for the application and control A
| Configuration Option | Description | Type | Default Value |
|------------------------|-------------------------------------|--------|--------------------------------------------|
| `API_PROMPT` | The prompt for the UI automation API. | String | "ufo/prompts/share/base/api.yaml" |
| `WORD_API_PROMPT` | The prompt for the Word APIs. | String | "ufo/prompts/apps/word/api.yaml" |
| `EXCEL_API_PROMPT` | The prompt for the Excel APIs. | String | "ufo/prompts/apps/excel/api.yaml" |
| `APP_API_PROMPT_ADDRESS` | The prompt address for the application API. | Dict | {"WINWORD.EXE": "ufo/prompts/apps/word/api.yaml", "EXCEL.EXE": "ufo/prompts/apps/excel/api.yaml", "msedge.exe": "ufo/prompts/apps/web/api.yaml", "chrome.exe": "ufo/prompts/apps/web/api.yaml"} |

## pywinauto Configuration

Expand Down
Loading

0 comments on commit 63eaccb

Please sign in to comment.