在原有只读抓取 (browser_fetch_page) 基础上,新增 observe→act 循环, 让 Agent 能在用户的 Chrome 中实际操作网页:点击/输入/滚动/等待/页内跳转。 后端: - 新工具 browser_act,按 session 复用标签页,返回带编号的可交互元素清单+正文 - browser_context 任务队列扩展 kind/session_id/action 与 observation 结果 - /api/browser-context 路由下发 act 任务、接收 observation - BrowserContextConfig 增加 actions_enabled 等开关,tools.py 两级门控 - 接线 app.py 路由挂载、app_config.py 配置字段、config.yaml 工具注册 前端: - ChatPage 处理「发送当前页」回跳的 browser_context query 参数并自动提交 扩展 (browser-extension/deer-web-clipper): - shared.js 自包含注入函数 deerObservePage / deerPerformAction - background.js 按 kind 分发任务,session→tab 映射存 chrome.storage.session 测试:tests/test_browser_act.py(队列往返 + 工具校验 + 模拟扩展成功路径,8 passed) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
97 lines
1.2 KiB
CSS
97 lines
1.2 KiB
CSS
* {
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
margin: 0;
|
|
color: #171717;
|
|
background: #fafafa;
|
|
font: 14px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
}
|
|
|
|
h1 {
|
|
margin: 0 0 14px;
|
|
font-size: 16px;
|
|
}
|
|
|
|
.popup,
|
|
.options {
|
|
display: grid;
|
|
gap: 12px;
|
|
padding: 14px;
|
|
}
|
|
|
|
.popup {
|
|
width: 340px;
|
|
}
|
|
|
|
.options {
|
|
max-width: 720px;
|
|
}
|
|
|
|
label {
|
|
display: grid;
|
|
gap: 6px;
|
|
font-weight: 600;
|
|
}
|
|
|
|
label.checkbox {
|
|
grid-template-columns: auto 1fr;
|
|
align-items: center;
|
|
font-weight: 500;
|
|
}
|
|
|
|
label.checkbox input {
|
|
width: auto;
|
|
}
|
|
|
|
.actions {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 8px;
|
|
}
|
|
|
|
input,
|
|
textarea {
|
|
width: 100%;
|
|
border: 1px solid #d4d4d4;
|
|
border-radius: 6px;
|
|
padding: 8px;
|
|
background: #fff;
|
|
color: inherit;
|
|
font: inherit;
|
|
font-weight: 400;
|
|
}
|
|
|
|
textarea {
|
|
resize: vertical;
|
|
}
|
|
|
|
button {
|
|
border: 0;
|
|
border-radius: 6px;
|
|
padding: 9px 12px;
|
|
background: #111827;
|
|
color: #fff;
|
|
cursor: pointer;
|
|
font: inherit;
|
|
font-weight: 600;
|
|
}
|
|
|
|
button.secondary {
|
|
background: #e5e7eb;
|
|
color: #111827;
|
|
}
|
|
|
|
button:disabled {
|
|
cursor: not-allowed;
|
|
opacity: 0.6;
|
|
}
|
|
|
|
.status {
|
|
min-height: 20px;
|
|
margin: 0;
|
|
color: #525252;
|
|
white-space: pre-wrap;
|
|
}
|