simoncck commited on
Commit
30980ef
Β·
verified Β·
1 Parent(s): 0f3c9d9

Create static/index.html

Browse files
Files changed (1) hide show
  1. static/index.html +203 -0
static/index.html ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Browser-Use Server Interface</title>
7
+ <style>
8
+ body {
9
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
10
+ max-width: 800px;
11
+ margin: 0 auto;
12
+ padding: 20px;
13
+ background-color: #f5f5f5;
14
+ }
15
+ .container {
16
+ background: white;
17
+ padding: 30px;
18
+ border-radius: 10px;
19
+ box-shadow: 0 2px 10px rgba(0,0,0,0.1);
20
+ }
21
+ h1 {
22
+ color: #333;
23
+ text-align: center;
24
+ margin-bottom: 30px;
25
+ }
26
+ .form-group {
27
+ margin-bottom: 20px;
28
+ }
29
+ label {
30
+ display: block;
31
+ margin-bottom: 5px;
32
+ font-weight: 600;
33
+ color: #555;
34
+ }
35
+ textarea, select, button {
36
+ width: 100%;
37
+ padding: 12px;
38
+ border: 1px solid #ddd;
39
+ border-radius: 5px;
40
+ font-size: 14px;
41
+ box-sizing: border-box;
42
+ }
43
+ textarea {
44
+ height: 100px;
45
+ resize: vertical;
46
+ }
47
+ button {
48
+ background-color: #007bff;
49
+ color: white;
50
+ border: none;
51
+ cursor: pointer;
52
+ font-weight: 600;
53
+ margin-top: 10px;
54
+ }
55
+ button:hover {
56
+ background-color: #0056b3;
57
+ }
58
+ button:disabled {
59
+ background-color: #ccc;
60
+ cursor: not-allowed;
61
+ }
62
+ .result {
63
+ margin-top: 20px;
64
+ padding: 15px;
65
+ border-radius: 5px;
66
+ white-space: pre-wrap;
67
+ font-family: monospace;
68
+ font-size: 12px;
69
+ }
70
+ .success {
71
+ background-color: #d4edda;
72
+ border: 1px solid #c3e6cb;
73
+ color: #155724;
74
+ }
75
+ .error {
76
+ background-color: #f8d7da;
77
+ border: 1px solid #f5c6cb;
78
+ color: #721c24;
79
+ }
80
+ .loading {
81
+ background-color: #fff3cd;
82
+ border: 1px solid #ffeaa7;
83
+ color: #856404;
84
+ }
85
+ .examples {
86
+ margin-top: 30px;
87
+ padding: 20px;
88
+ background-color: #f8f9fa;
89
+ border-radius: 5px;
90
+ }
91
+ .example {
92
+ margin-bottom: 10px;
93
+ padding: 8px;
94
+ background: white;
95
+ border-radius: 3px;
96
+ cursor: pointer;
97
+ border: 1px solid #e9ecef;
98
+ }
99
+ .example:hover {
100
+ background-color: #e9ecef;
101
+ }
102
+ </style>
103
+ </head>
104
+ <body>
105
+ <div class="container">
106
+ <h1>🌐 Browser-Use Server Interface</h1>
107
+
108
+ <form id="taskForm">
109
+ <div class="form-group">
110
+ <label for="task">Task Description:</label>
111
+ <textarea id="task" name="task" placeholder="Describe what you want the browser to do...
112
+ Example: Go to google.com and search for 'Python programming'" required></textarea>
113
+ </div>
114
+
115
+ <div class="form-group">
116
+ <label for="model">AI Model:</label>
117
+ <select id="model" name="model">
118
+ <option value="gpt-4o-mini">GPT-4o Mini (Recommended)</option>
119
+ <option value="gpt-4o">GPT-4o</option>
120
+ <option value="gpt-4-turbo">GPT-4 Turbo</option>
121
+ <option value="claude-3-haiku-20240307">Claude 3 Haiku</option>
122
+ <option value="claude-3-sonnet-20240229">Claude 3 Sonnet</option>
123
+ </select>
124
+ </div>
125
+
126
+ <button type="submit" id="submitBtn">Run Task</button>
127
+ </form>
128
+
129
+ <div id="result" class="result" style="display: none;"></div>
130
+
131
+ <div class="examples">
132
+ <h3>Example Tasks (Click to use):</h3>
133
+ <div class="example" onclick="setTask('Go to google.com and search for Python programming')">
134
+ πŸ” Search Google for "Python programming"
135
+ </div>
136
+ <div class="example" onclick="setTask('Navigate to github.com and find the trending repositories')">
137
+ πŸ“ˆ Check GitHub trending repositories
138
+ </div>
139
+ <div class="example" onclick="setTask('Go to example.com and get the page title and main heading')">
140
+ πŸ“„ Get page title from example.com
141
+ </div>
142
+ <div class="example" onclick="setTask('Visit news.ycombinator.com and get the top 3 story titles')">
143
+ πŸ“° Get top stories from Hacker News
144
+ </div>
145
+ <div class="example" onclick="setTask('Go to wikipedia.org and search for artificial intelligence')">
146
+ πŸ“š Search Wikipedia for "artificial intelligence"
147
+ </div>
148
+ </div>
149
+ </div>
150
+
151
+ <script>
152
+ function setTask(taskText) {
153
+ document.getElementById('task').value = taskText;
154
+ }
155
+
156
+ document.getElementById('taskForm').addEventListener('submit', async function(e) {
157
+ e.preventDefault();
158
+
159
+ const task = document.getElementById('task').value;
160
+ const model = document.getElementById('model').value;
161
+ const submitBtn = document.getElementById('submitBtn');
162
+ const resultDiv = document.getElementById('result');
163
+
164
+ // Show loading state
165
+ submitBtn.disabled = true;
166
+ submitBtn.textContent = 'Running Task...';
167
+ resultDiv.style.display = 'block';
168
+ resultDiv.className = 'result loading';
169
+ resultDiv.textContent = 'Task is running... This may take a while depending on the complexity.';
170
+
171
+ try {
172
+ const response = await fetch('/run-task', {
173
+ method: 'POST',
174
+ headers: {
175
+ 'Content-Type': 'application/json',
176
+ },
177
+ body: JSON.stringify({
178
+ task: task,
179
+ model: model
180
+ })
181
+ });
182
+
183
+ const data = await response.json();
184
+
185
+ if (data.success) {
186
+ resultDiv.className = 'result success';
187
+ resultDiv.textContent = `βœ… Task completed successfully!\n\nResult:\n${data.result}`;
188
+ } else {
189
+ resultDiv.className = 'result error';
190
+ resultDiv.textContent = `❌ Task failed:\n\n${data.error}`;
191
+ }
192
+ } catch (error) {
193
+ resultDiv.className = 'result error';
194
+ resultDiv.textContent = `❌ Network error:\n\n${error.message}`;
195
+ } finally {
196
+ submitBtn.disabled = false;
197
+ submitBtn.textContent = 'Run Task';
198
+ }
199
+ });
200
+ </script>
201
+ </body>
202
+ </html>
203
+