simoncck's picture
Update static/index.html
dadf71d verified
raw
history blame
7.27 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Browser-Use Server Interface</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
background-color: #f5f5f5;
}
.container {
background: white;
padding: 30px;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
h1 {
color: #333;
text-align: center;
margin-bottom: 30px;
}
.form-group {
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: 600;
color: #555;
}
textarea, select, button {
width: 100%;
padding: 12px;
border: 1px solid #ddd;
border-radius: 5px;
font-size: 14px;
box-sizing: border-box;
}
textarea {
height: 100px;
resize: vertical;
}
button {
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
font-weight: 600;
margin-top: 10px;
}
button:hover {
background-color: #0056b3;
}
button:disabled {
background-color: #ccc;
cursor: not-allowed;
}
.result {
margin-top: 20px;
padding: 15px;
border-radius: 5px;
white-space: pre-wrap;
font-family: monospace;
font-size: 12px;
}
.success {
background-color: #d4edda;
border: 1px solid #c3e6cb;
color: #155724;
}
.error {
background-color: #f8d7da;
border: 1px solid #f5c6cb;
color: #721c24;
}
.loading {
background-color: #fff3cd;
border: 1px solid #ffeaa7;
color: #856404;
}
.examples {
margin-top: 30px;
padding: 20px;
background-color: #f8f9fa;
border-radius: 5px;
}
.example {
margin-bottom: 10px;
padding: 8px;
background: white;
border-radius: 3px;
cursor: pointer;
border: 1px solid #e9ecef;
}
.example:hover {
background-color: #e9ecef;
}
</style>
</head>
<body>
<div class="container">
<h1>🌐 Browser-Use Server Interface</h1>
<form id="taskForm">
<div class="form-group">
<label for="task">Task Description:</label>
<textarea id="task" name="task" placeholder="Describe what you want the browser to do...\nExample: Go to google.com and search for \'Python programming\'" required></textarea>
</div>
<div class="form-group">
<label for="model">AI Model:</label>
<select id="model" name="model">
<option value="gpt-4o-mini">GPT-4o Mini (Recommended)</option>
<option value="gpt-4o">GPT-4o</option>
<option value="gpt-4-turbo">GPT-4 Turbo</option>
<option value="claude-3-haiku-20240307">Claude 3 Haiku</option>
<option value="claude-3-sonnet-20240229">Claude 3 Sonnet</option>
<option value="gemini-pro">Gemini Pro</option>
<option value="gemini-1.5-pro-latest">Gemini 1.5 Pro Latest</option>
</select>
</div>
<button type="submit" id="submitBtn">Run Task</button>
</form>
<div id="result" class="result" style="display: none;"></div>
<div class="examples">
<h3>Example Tasks (Click to use):</h3>
<div class="example" onclick="setTask(\'Go to google.com and search for Python programming\')">
πŸ” Search Google for "Python programming"
</div>
<div class="example" onclick="setTask(\'Navigate to github.com and find the trending repositories\')">
πŸ“ˆ Check GitHub trending repositories
</div>
<div class="example" onclick="setTask(\'Go to example.com and get the page title and main heading\')">
πŸ“„ Get page title from example.com
</div>
<div class="example" onclick="setTask(\'Visit news.ycombinator.com and get the top 3 story titles\')">
πŸ“° Get top stories from Hacker News
</div>
<div class="example" onclick="setTask(\'Go to wikipedia.org and search for artificial intelligence\')">
πŸ“š Search Wikipedia for "artificial intelligence"
</div>
</div>
</div>
<script>
function setTask(taskText) {
document.getElementById(\'task\').value = taskText;
}
document.getElementById(\'taskForm\').addEventListener(\'submit\', async function(e) {
e.preventDefault();
const task = document.getElementById(\'task\').value;
const model = document.getElementById(\'model\').value;
const submitBtn = document.getElementById(\'submitBtn\');
const resultDiv = document.getElementById(\'result\');
// Show loading state
submitBtn.disabled = true;
submitBtn.textContent = \'Running Task...\';
resultDiv.style.display = \'block\';
resultDiv.className = \'result loading\';
resultDiv.textContent = \'Task is running... This may take a while depending on the complexity.\';
try {
const response = await fetch(\'/run-task\', {
method: \'POST\',
headers: {
\'Content-Type\': \'application/json\',
},
body: JSON.stringify({
task: task,
model: model
})
});
const data = await response.json();
if (data.success) {
resultDiv.className = \'result success\';
resultDiv.textContent = `βœ… Task completed successfully!\n\nResult:\n${data.result}`;
} else {
resultDiv.className = \'result error\';
resultDiv.textContent = `❌ Task failed:\n\n${data.error}`;
}
} catch (error) {
resultDiv.className = \'result error\';
resultDiv.textContent = `❌ Network error:\n\n${error.message}`;
} finally {
submitBtn.disabled = false;
submitBtn.textContent = \'Run Task\';
}
});
</script>
</body>
</html>