在原有只读抓取 (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>
32 lines
964 B
HTML
32 lines
964 B
HTML
<!doctype html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<title>zncm Web Clipper</title>
|
|
<link rel="stylesheet" href="styles.css" />
|
|
</head>
|
|
<body>
|
|
<main class="popup">
|
|
<h1>zncm Web Clipper</h1>
|
|
<label>
|
|
首问
|
|
<textarea id="prompt" rows="4"></textarea>
|
|
</label>
|
|
<label class="checkbox">
|
|
<input id="pageAssistantEnabled" type="checkbox" />
|
|
启用页面问答框
|
|
</label>
|
|
<div class="actions">
|
|
<button id="send" type="button">发送当前页</button>
|
|
<button id="syncToken" type="button">同步 token</button>
|
|
<button id="pollNow" type="button">检查任务</button>
|
|
<button id="options" type="button" class="secondary">设置</button>
|
|
</div>
|
|
<p id="status" class="status"></p>
|
|
</main>
|
|
<script src="config.js"></script>
|
|
<script src="shared.js"></script>
|
|
<script src="popup.js"></script>
|
|
</body>
|
|
</html>
|