|
| 1 | +# Settings Configuration Guide |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +**UI-TARS Desktop** offers granular control over application behavior through its settings system. This document provides comprehensive guidance on configuration options, preset management, and operational best practices. |
| 6 | + |
| 7 | +<p align="center"> |
| 8 | + <img src="../images/setting.png" alt="Settings Interface Overview" width="650"> |
| 9 | + <br> |
| 10 | + <em>Main Settings Interface</em> |
| 11 | +</p> |
| 12 | + |
| 13 | + |
| 14 | +<br> |
| 15 | + |
| 16 | + |
| 17 | +## Configuration Options |
| 18 | + |
| 19 | +### Language |
| 20 | + |
| 21 | +Controls localization settings for VLM. |
| 22 | + |
| 23 | +| Property | Details | |
| 24 | +| ----------- | ------------------------------ | |
| 25 | +| **Type** | `string` | |
| 26 | +| **Options** | `en` (English), `zh` (Chinese) | |
| 27 | +| **Default** | `en` | |
| 28 | + |
| 29 | +> [!NOTE] |
| 30 | +> Changing the settings will **only** affect the output of VLM, not the language of the desktop app itself. Regarding the i18n of the App itself, welcome to contribute PR. |
| 31 | +
|
| 32 | + |
| 33 | +<br> |
| 34 | + |
| 35 | + |
| 36 | +### VLM Provider |
| 37 | + |
| 38 | +Selects the backend VLM provider for make GUI action decisions. |
| 39 | + |
| 40 | +| Property | Details | |
| 41 | +| ----------- | ---------------------- | |
| 42 | +| **Type** | `string` | |
| 43 | +| **Options** | `Hugging Face`, `vLLM` | |
| 44 | +| **Default** | `Hugging Face` | |
| 45 | + |
| 46 | +> [!NOTE] |
| 47 | +> This is an interface reserved for different VLM providers. |
| 48 | +
|
| 49 | + |
| 50 | +<br> |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | +### VLM Base URL |
| 55 | + |
| 56 | +Specify the base url of the VLM that needs to be requested. |
| 57 | + |
| 58 | +| Property | Details | |
| 59 | +| ------------ | -------- | |
| 60 | +| **Type** | `string` | |
| 61 | +| **Required** | `true` | |
| 62 | + |
| 63 | +> [!NOTE] |
| 64 | +> VLM Base URL should be OpenAI compatible API endpoints (see [OpenAI API protocol document](https://platform.openai.com/docs/guides/vision/uploading-base-64-encoded-images) for more details). |
| 65 | +
|
| 66 | + |
| 67 | +<br> |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | +### VLM Model Name |
| 72 | + |
| 73 | +Specify the requested module name. |
| 74 | + |
| 75 | +| Property | Details | |
| 76 | +| ------------ | -------- | |
| 77 | +| **Type** | `string` | |
| 78 | +| **Required** | `true` | |
| 79 | + |
| 80 | + |
| 81 | +<br> |
| 82 | + |
| 83 | + |
| 84 | +### Report Storage Base URL |
| 85 | + |
| 86 | +Defines the base URL for uploading report file. By default, when this option is not set, when the user clicks **Export as HTML** (a.k.a. <b>Share</b>), it will automatically trigger the download of the report file: |
| 87 | + |
| 88 | +<p align="center"> |
| 89 | + <img src="../images/download-report.png" alt="Download report" width="320"> |
| 90 | + <br> |
| 91 | +</p> |
| 92 | + |
| 93 | +Once it's set, when user click **Export as HTML**, report file will firstly be uploaded to the Report Storage Server, which returns a publicly accessible URL for the persistent file. |
| 94 | + |
| 95 | +<p align="center"> |
| 96 | + <img src="../images/upload-report-success.png" alt="Download report" width="320"> |
| 97 | + <br> |
| 98 | +</p> |
| 99 | + |
| 100 | +#### Report Storage Server Interface |
| 101 | + |
| 102 | +The Report Storage Server should implement the following HTTP API endpoint: |
| 103 | + |
| 104 | +| Property | Details | |
| 105 | +| ------------ | ------------------------------------------------------------------------------------------------------------ | |
| 106 | +| **Endpoint** | `POST /your-storage-enpoint` | |
| 107 | +| **Headers** | Content-Type: `multipart/form-data` <br> <!-- - Authorization: Bearer \<access_token\> (Not Supported) --> | |
| 108 | + |
| 109 | +#### Request Body |
| 110 | + |
| 111 | +The request should be sent as `multipart/form-data` with the following field: |
| 112 | + |
| 113 | +| Field | Type | Required | Description | Constraints | |
| 114 | +| ----- | ---- | -------- | ---------------- | ---------------------------------- | |
| 115 | +| file | File | Yes | HTML report file | - Format: HTML<br>- Max size: 30MB | |
| 116 | + |
| 117 | +#### Response |
| 118 | + |
| 119 | +**Success Response (200 OK)** |
| 120 | +```json |
| 121 | +{ |
| 122 | + "url": "https://example.com/reports/xxx.html" |
| 123 | +} |
| 124 | +``` |
| 125 | + |
| 126 | +The response should return a JSON object containing a publicly accessible URL where the report can be accessed. |
| 127 | + |
| 128 | +> [!NOTE] |
| 129 | +> Currently, there is no authentication designed for Report Storage Server. If you have any requirements, please submit an [issue](https://github.com/bytedance/UI-TARS-desktop/issues). |
| 130 | +
|
| 131 | + |
| 132 | +<br> |
| 133 | + |
| 134 | + |
| 135 | +### UTIO Base URL |
| 136 | + |
| 137 | +**UTIO** (_UI-TARS Insights and Observation_) is a data collection mechanism for insights into **UI-TARS Desktop** (_Introduced at [#60](https://github.com/bytedance/UI-TARS-desktop/pull/60)_). The design of UTIO is also related to sharing. The overall process is as follows: |
| 138 | + |
| 139 | +<p align="center"> |
| 140 | + <img src="../images/utio-flow.png" alt="UTIO Flow" width="800"> |
| 141 | + <br> |
| 142 | + <em>UTIO Flow</em> |
| 143 | +</p> |
| 144 | + |
| 145 | +This option defines the base URL for the **UTIO** server that handles application events and instructions. |
| 146 | + |
| 147 | + |
| 148 | +#### Server Interface Specification |
| 149 | + |
| 150 | +The UTIO server accepts events through HTTP POST requests and supports three types of events: |
| 151 | + |
| 152 | +| Property | Details | |
| 153 | +| ------------ | -------------------------------- | |
| 154 | +| **Endpoint** | `POST /your-utio-endpoint` | |
| 155 | +| **Headers** | Content-Type: `application/json` | |
| 156 | + |
| 157 | +##### Event Types |
| 158 | + |
| 159 | +The server handles three types of events: |
| 160 | + |
| 161 | +###### **Application Launch** |
| 162 | +```typescript |
| 163 | +interface AppLaunchedEvent { |
| 164 | + type: 'appLaunched'; |
| 165 | + platform: 'iOS' | 'Android' | 'Web'; |
| 166 | + osVersion: string; |
| 167 | + screenWidth: number; |
| 168 | + screenHeight: number; |
| 169 | +} |
| 170 | +``` |
| 171 | + |
| 172 | +###### **Send Instruction** |
| 173 | +```typescript |
| 174 | +interface SendInstructionEvent { |
| 175 | + type: 'sendInstruction'; |
| 176 | + instruction: string; |
| 177 | +} |
| 178 | +``` |
| 179 | + |
| 180 | +###### **Share Report** |
| 181 | +```typescript |
| 182 | +interface ShareReportEvent { |
| 183 | + type: 'shareReport'; |
| 184 | + lastScreenshot?: string; |
| 185 | + report?: string; |
| 186 | + instruction: string; |
| 187 | +} |
| 188 | +``` |
| 189 | + |
| 190 | +##### Request Example |
| 191 | + |
| 192 | +```json |
| 193 | +{ |
| 194 | + "type": "appLaunched", |
| 195 | + "platform": "iOS", |
| 196 | + "osVersion": "16.0.0", |
| 197 | + "screenWidth": 390, |
| 198 | + "screenHeight": 844 |
| 199 | +} |
| 200 | +``` |
| 201 | + |
| 202 | +##### Response |
| 203 | + |
| 204 | +**Success Response (200 OK)** |
| 205 | +```json |
| 206 | +{ |
| 207 | + "success": true |
| 208 | +} |
| 209 | +``` |
| 210 | + |
| 211 | +> [!NOTE] |
| 212 | +> All events are processed asynchronously. The server should respond promptly to acknowledge receipt of the event. |
| 213 | +
|
| 214 | + |
| 215 | +##### Server Example |
| 216 | + |
| 217 | +###### Node.js |
| 218 | + |
| 219 | +```js |
| 220 | +const express = require('express'); |
| 221 | +const cors = require('cors'); |
| 222 | +const app = express(); |
| 223 | +const port = 3000; |
| 224 | + |
| 225 | +app.use(cors()); |
| 226 | +app.use(express.json()); |
| 227 | + |
| 228 | +app.post('/your-utio-endpoint', (req, res) => { |
| 229 | + const event = req.body; |
| 230 | + |
| 231 | + if (!event || !event.type) { |
| 232 | + return res.status(400).json({ error: 'Missing event type' }); |
| 233 | + } |
| 234 | + |
| 235 | + switch (event.type) { |
| 236 | + case 'appLaunched': |
| 237 | + return handleAppLaunch(event, res); |
| 238 | + case 'sendInstruction': |
| 239 | + return handleSendInstruction(event, res); |
| 240 | + case 'shareReport': |
| 241 | + return handleShareReport(event, res); |
| 242 | + default: |
| 243 | + return res.status(400).json({ error: 'Unsupported event type' }); |
| 244 | + } |
| 245 | +}); |
| 246 | + |
| 247 | +app.listen(port, () => { |
| 248 | + console.log(`Server listening on port ${port}`); |
| 249 | +}); |
| 250 | +``` |
| 251 | + |
| 252 | +###### Python |
| 253 | + |
| 254 | +```python |
| 255 | +from flask import Flask, request, jsonify |
| 256 | +from flask_cors import CORS |
| 257 | +import re |
| 258 | + |
| 259 | +app = Flask(__name__) |
| 260 | +CORS(app) |
| 261 | + |
| 262 | +@app.route('/events', methods=['POST']) |
| 263 | +def handle_event(): |
| 264 | + data = request.get_json() |
| 265 | + |
| 266 | + if not data or 'type' not in data: |
| 267 | + return jsonify({'error': 'Missing event type'}), 400 |
| 268 | + |
| 269 | + event_type = data['type'] |
| 270 | + |
| 271 | + if event_type == 'appLaunched': |
| 272 | + return handle_app_launch(data) |
| 273 | + elif event_type == 'sendInstruction': |
| 274 | + return handle_send_instruction(data) |
| 275 | + elif event_type == 'shareReport': |
| 276 | + return handle_share_report(data) |
| 277 | + else: |
| 278 | + return jsonify({'error': 'Unsupported event type'}), 400 |
| 279 | + |
| 280 | +if __name__ == '__main__': |
| 281 | + app.run(port=3000) |
| 282 | +``` |
| 283 | + |
0 commit comments