surfai 0.8.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. surfai-0.8.1/.gitignore +29 -0
  2. surfai-0.8.1/DEVELOPMENT_LOG.md +315 -0
  3. surfai-0.8.1/LICENSE +21 -0
  4. surfai-0.8.1/MANIFEST.in +3 -0
  5. surfai-0.8.1/PKG-INFO +124 -0
  6. surfai-0.8.1/PROGRESS.md +32 -0
  7. surfai-0.8.1/PROJECT.md +86 -0
  8. surfai-0.8.1/README.md +91 -0
  9. surfai-0.8.1/TEST_REPORT.md +152 -0
  10. surfai-0.8.1/examples/basic_usage.py +33 -0
  11. surfai-0.8.1/examples/extract_data.py +23 -0
  12. surfai-0.8.1/examples/natural_language.py +30 -0
  13. surfai-0.8.1/extension/background/background.js +105 -0
  14. surfai-0.8.1/extension/icons/icon128.svg +10 -0
  15. surfai-0.8.1/extension/icons/icon16.svg +10 -0
  16. surfai-0.8.1/extension/icons/icon48.svg +10 -0
  17. surfai-0.8.1/extension/manifest.json +39 -0
  18. surfai-0.8.1/extension/popup/sidepanel.html +275 -0
  19. surfai-0.8.1/extension/popup/sidepanel.js +280 -0
  20. surfai-0.8.1/ollama/ollama +1 -0
  21. surfai-0.8.1/pyproject.toml +77 -0
  22. surfai-0.8.1/screenshot.png +0 -0
  23. surfai-0.8.1/surfai/__init__.py +34 -0
  24. surfai-0.8.1/surfai/browser.py +435 -0
  25. surfai-0.8.1/surfai/cli.py +162 -0
  26. surfai-0.8.1/surfai/config.py +72 -0
  27. surfai-0.8.1/surfai/exporter.py +182 -0
  28. surfai-0.8.1/surfai/extension_api.py +113 -0
  29. surfai-0.8.1/surfai/extractor.py +143 -0
  30. surfai-0.8.1/surfai/llm/__init__.py +15 -0
  31. surfai-0.8.1/surfai/llm/base.py +418 -0
  32. surfai-0.8.1/surfai/llm/local_parser.py +184 -0
  33. surfai-0.8.1/surfai/llm/router.py +81 -0
  34. surfai-0.8.1/surfai/monitor.py +226 -0
  35. surfai-0.8.1/surfai/recorder.py +298 -0
  36. surfai-0.8.1/surfai/stealth.py +239 -0
  37. surfai-0.8.1/test_screenshot.png +0 -0
  38. surfai-0.8.1/tests/test_surfai.py +40 -0
  39. surfai-0.8.1//346/226/207/344/273/266/346/225/264/347/220/206/350/256/260/345/275/225.md +73 -0
@@ -0,0 +1,29 @@
1
+ # Build artifacts
2
+ build/
3
+ dist/
4
+ *.egg-info/
5
+
6
+ # Virtual environments
7
+ venv/
8
+ env/
9
+ ENV/
10
+
11
+ # Python cache
12
+ __pycache__/
13
+ *.py[cod]
14
+ *$py.class
15
+ *.so
16
+
17
+ # IDE
18
+ .vscode/
19
+ .idea/
20
+ *.swp
21
+ *.swo
22
+
23
+ # OS
24
+ .DS_Store
25
+ Thumbs.db
26
+
27
+ # Project specific
28
+ /mnt/fnos/
29
+ /tmp/
@@ -0,0 +1,315 @@
1
+ # SurfAI 开发日志
2
+
3
+ **项目**: SurfAI - 自然语言浏览器自动化工具
4
+ **创建时间**: 2026-03-07
5
+ **最后更新**: 2026-03-07
6
+
7
+ ---
8
+
9
+ ## 版本历史
10
+
11
+ - v0.1.0 - MVP 基础功能
12
+ - v0.2.0 - 智能提取 + 数据导出
13
+ - v0.3.0 - 本地解析器(零成本)
14
+ - v0.3.1 - Ollama 优化
15
+ - v0.4.0 - Excel 导出 + 代理支持
16
+ - v0.4.1 - 截图详细日志
17
+ - v0.4.2 - 项目文件夹结构
18
+ - v0.4.3 - 项目文件夹重构
19
+ - v0.4.4 - 文件夹结构最终版
20
+ - v0.5.0 - 网页监控功能
21
+ - v0.6.0 - 反检测增强
22
+ - v0.7.0 - 录制回放功能
23
+ - v0.8.0 - Chrome 扩展
24
+ - v0.8.1 - 扩展前后端联调
25
+
26
+ ---
27
+
28
+ ## Phase 1: MVP 基础功能 (v0.1.0)
29
+
30
+ ### 开发内容
31
+ 1. **项目结构搭建** - Python 包结构、虚拟环境
32
+ 2. **浏览器核心** - Browser 类、导航、提取、截图
33
+ 3. **LLM 集成** - Kimi/DeepSeek/OpenAI 支持
34
+ 4. **CLI 工具** - config/run/status 命令
35
+ 5. **配置管理** - JSON 配置文件
36
+
37
+ ### 遇到的问题
38
+ - extract() 无 LLM 配置时报错 → 添加优雅降级
39
+
40
+ ---
41
+
42
+ ## Phase 2: 功能增强 (v0.2.0)
43
+
44
+ ### 开发内容
45
+ 1. **Ollama 本地 LLM 支持**
46
+ 2. **智能提取模块** - 表格、链接、列表、价格
47
+ 3. **数据导出模块** - JSON/CSV/TXT
48
+
49
+ ### 遇到的问题
50
+ - 正则表达式转义警告 → 使用原始字符串
51
+
52
+ ---
53
+
54
+ ## Phase 3: 零成本模式 (v0.3.0)
55
+
56
+ ### 开发内容
57
+ 1. **本地意图解析器** - 无需 API Key
58
+ 2. **LocalProvider** - 自动降级到本地模式
59
+ 3. **中英文指令支持**
60
+
61
+ ---
62
+
63
+ ## Phase 4: Ollama 集成优化 (v0.3.1)
64
+
65
+ ### 开发内容
66
+ 1. **Ollama 配置** - qwen3.5:0.8b 模型
67
+ 2. **超时优化** - 120秒超时
68
+ 3. **双 API 支持** - /api/chat + /api/generate
69
+
70
+ ### 遇到的问题
71
+ - Ollama API 404 → 实现双 API 支持
72
+ - 模型推理超时 → 增加超时时间 + 降级处理
73
+
74
+ ---
75
+
76
+ ## Phase 5: Excel 导出和代理支持 (v0.4.0)
77
+
78
+ ### 开发内容
79
+ 1. **Excel 导出** - openpyxl 支持
80
+ 2. **自动样式** - 蓝色表头 + 自动列宽
81
+ 3. **代理支持** - HTTP/SOCKS5
82
+
83
+ ---
84
+
85
+ ## Phase 6: 截图详细日志 (v0.4.1)
86
+
87
+ ### 开发内容
88
+ - screenshot() 返回字典而非字符串
89
+ - 包含成功状态、文件大小、页面信息等
90
+
91
+ ---
92
+
93
+ ## Phase 7: 项目文件夹结构 (v0.4.2 - v0.4.4)
94
+
95
+ ### 开发内容
96
+ - 创建 `/mnt/fnos/SurfAI/` 项目根目录
97
+ - 开发日志文件夹
98
+ - 项目文件文件夹(截图 + 导出数据)
99
+ - 整理所有历史文件到新结构
100
+
101
+ ### 最终结构
102
+ ```
103
+ /mnt/fnos/SurfAI/
104
+ ├── 开发日志/
105
+ └── 项目文件/
106
+ ├── 截图/
107
+ └── 导出数据/
108
+ ```
109
+
110
+ ---
111
+
112
+ ## Phase 8: 网页监控功能 (v0.5.0)
113
+
114
+ ### 开发内容
115
+ 1. **PageMonitor 类** - 定时检查网页变化
116
+ 2. **变化检测** - 支持元素或整页监控
117
+ 3. **自动截图** - 变化时自动截图
118
+ 4. **历史记录** - 保存监控历史
119
+
120
+ ### 使用方式
121
+ ```python
122
+ from surfai import PageMonitor
123
+
124
+ monitor = PageMonitor()
125
+ await monitor.watch(
126
+ url='https://example.com',
127
+ interval=60,
128
+ max_checks=10,
129
+ )
130
+ ```
131
+
132
+ ---
133
+
134
+ ## Phase 9: 反检测增强 (v0.6.0)
135
+
136
+ ### 开发内容
137
+ 1. **StealthConfig** - 反检测配置
138
+ 2. **隐藏 webdriver** - navigator.webdriver = undefined
139
+ 3. **模拟插件** - 3个真实浏览器插件
140
+ 4. **随机指纹** - User Agent、视口、语言
141
+ 5. **Cloudflare 支持** - 自动检测验证
142
+
143
+ ### 测试结果
144
+ ```
145
+ 🚀 测试反检测功能
146
+ ============================================================
147
+ 🧪 测试 1: 默认反检测模式
148
+ navigator.webdriver: None
149
+ navigator.plugins.length: 3
150
+ User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)...
151
+ ✅ 反检测模式工作正常
152
+
153
+ 🧪 测试 2: 自定义反检测配置
154
+ navigator.languages: ['zh-CN', 'zh', 'en-US', 'en']
155
+ ✅ 自定义配置工作正常
156
+
157
+ 🧪 测试 3: 关闭反检测模式
158
+ ✅ 正常模式工作正常
159
+
160
+ ============================================================
161
+ 🎉 反检测功能测试通过!
162
+ ============================================================
163
+ ```
164
+
165
+ ### 使用方式
166
+ ```python
167
+ from surfai import Browser, StealthConfig
168
+
169
+ # 默认开启反检测
170
+ browser = Browser()
171
+
172
+ # 自定义配置
173
+ config = StealthConfig(
174
+ hide_webdriver=True,
175
+ fake_plugins=True,
176
+ fake_languages=True,
177
+ random_viewport=True,
178
+ )
179
+ browser = Browser(stealth=True, stealth_config=config)
180
+ ```
181
+
182
+ ---
183
+
184
+ ## 项目统计
185
+
186
+ | 类别 | 数量 |
187
+ |------|------|
188
+ | 截图文件 | 7 个 |
189
+ | 导出文件 | 9 个 |
190
+ | 开发日志 | 4 个 |
191
+ | 版本迭代 | 11 个 |
192
+
193
+ ---
194
+
195
+ ## Phase 10: 录制回放功能 (v0.7.0)
196
+
197
+ ### 开发内容
198
+ 1. **ActionRecorder 类** - 录制浏览器动作
199
+ 2. **ActionPlayer 类** - 回放录制的动作
200
+ 3. **RecordingBrowser 类** - 带录制功能的浏览器
201
+ 4. **录制格式** - JSON 格式保存
202
+
203
+ ### 支持的动作
204
+ - `goto` - 导航到 URL
205
+ - `click` - 点击元素
206
+ - `type` - 输入文本
207
+ - `extract` - 提取数据
208
+ - `screenshot` - 截图
209
+ - `wait` - 等待
210
+ - `scroll` - 滚动
211
+
212
+ ### 测试结果
213
+ ```
214
+ 🚀 测试录制回放功能
215
+ ============================================================
216
+ 🧪 测试 1: 录制动作
217
+ 🔴 开始录制...
218
+ 📝 录制: goto {'url': 'example.com'}
219
+ 📝 录制: click {'selector': 'button'}
220
+ 📝 录制: type {'selector': 'input', 'text': 'hello'}
221
+ 📝 录制: screenshot {}
222
+ ⏹️ 录制结束,共 4 个动作
223
+ 💾 录制已保存: /mnt/fnos/SurfAI/项目文件/导出数据/recording_20260307_093111.json
224
+
225
+ 🧪 测试 2: 回放动作
226
+ ▶️ 开始回放,共 4 个动作
227
+ [1/4] 执行: goto ✅
228
+ [2/4] 执行: click ❌ (页面无此元素)
229
+ [3/4] 执行: type ❌ (页面无此元素)
230
+ [4/4] 执行: screenshot ✅
231
+ ✅ 回放完成
232
+
233
+ 🧪 测试 3: 验证录制文件
234
+ ✅ 录制文件有效,共 4 个动作
235
+ ============================================================
236
+ 🎉 录制回放功能测试通过!
237
+ ============================================================
238
+ ```
239
+
240
+ ### 使用方式
241
+ ```python
242
+ from surfai import ActionRecorder, ActionPlayer, Browser
243
+
244
+ # 录制
245
+ recorder = ActionRecorder()
246
+ recorder.start()
247
+ recorder.record('goto', {'url': 'example.com'})
248
+ recorder.record('click', {'selector': 'button'})
249
+ recorder.stop()
250
+ recorder.save()
251
+
252
+ # 回放
253
+ browser = Browser()
254
+ await browser.launch()
255
+ player = ActionPlayer()
256
+ await player.play('recording.json', browser)
257
+ ```
258
+
259
+ ---
260
+
261
+ ## Phase 11: Chrome 扩展 (v0.8.0)
262
+
263
+ ### 开发内容
264
+ 1. **扩展清单** - manifest.json v3
265
+ 2. **侧边栏界面** - 美观的 UI 设计
266
+ 3. **后端 API** - FastAPI 服务
267
+ 4. **功能集成**:
268
+ - 执行指令
269
+ - 截图
270
+ - 执行历史
271
+ - 连接状态显示
272
+
273
+ ### 扩展结构
274
+ ```
275
+ extension/
276
+ ├── manifest.json
277
+ ├── icons/
278
+ ├── popup/
279
+ │ ├── sidepanel.html
280
+ │ └── sidepanel.js
281
+ └── background/
282
+ └── background.js
283
+ ```
284
+
285
+ ### v0.8.1 更新
286
+ - 添加 `surfai server` CLI 命令
287
+ - 完善后台脚本 (background.js)
288
+ - 优化侧边栏通信逻辑
289
+ - 添加截图预览通知
290
+ - 添加错误提示通知
291
+
292
+ ### 使用方式
293
+ 1. 安装 Chrome 扩展
294
+ 2. 启动后端服务: `surfai server`
295
+ 3. 在侧边栏输入指令
296
+
297
+ ### 后端 API
298
+ - `POST /execute` - 执行指令
299
+ - `POST /screenshot` - 截图
300
+ - `GET /health` - 健康检查
301
+ - `GET /config` - 获取配置
302
+
303
+ ---
304
+
305
+ ## 待办事项
306
+
307
+ - [ ] 用户使用真实 API Key 测试
308
+ - [ ] 测试复杂网站(GitHub、淘宝等)
309
+ - [ ] 发布到 PyPI
310
+ - [ ] 发布 Chrome 扩展
311
+ - [ ] 完善文档和示例
312
+
313
+ ---
314
+
315
+ **维护说明**: 此日志会持续追加更新,不删除历史内容。
surfai-0.8.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 SurfAI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ include README.md
2
+ include LICENSE
3
+ recursive-include surfai *.py
surfai-0.8.1/PKG-INFO ADDED
@@ -0,0 +1,124 @@
1
+ Metadata-Version: 2.4
2
+ Name: surfai
3
+ Version: 0.8.1
4
+ Summary: Natural language browser automation
5
+ Project-URL: Homepage, https://github.com/surfai/surfai
6
+ Project-URL: Repository, https://github.com/surfai/surfai
7
+ Author: SurfAI Team
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Keywords: ai,automation,browser,llm,scraping
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Requires-Python: >=3.9
20
+ Requires-Dist: click>=8.0.0
21
+ Requires-Dist: fastapi>=0.100.0
22
+ Requires-Dist: httpx>=0.25.0
23
+ Requires-Dist: openpyxl>=3.1.0
24
+ Requires-Dist: playwright>=1.40.0
25
+ Requires-Dist: pydantic>=2.0.0
26
+ Requires-Dist: uvicorn>=0.23.0
27
+ Provides-Extra: dev
28
+ Requires-Dist: black>=23.0.0; extra == 'dev'
29
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
30
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
31
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
32
+ Description-Content-Type: text/markdown
33
+
34
+ # SurfAI
35
+
36
+ 🏄 **Natural Language Browser Automation**
37
+
38
+ Say what you want, SurfAI does the browsing.
39
+
40
+ ## Quick Start
41
+
42
+ ```bash
43
+ # Install
44
+ pip install surfai
45
+
46
+ # Configure your LLM (choose one)
47
+ surfai config --model kimi --key sk-your-kimi-key
48
+ surfai config --model deepseek --key sk-your-deepseek-key
49
+
50
+ # Start automating
51
+ surfai "Go to GitHub and find the most starred Python project"
52
+ ```
53
+
54
+ ## Features
55
+
56
+ - 🎯 **Zero Code**: Just say what you want in natural language
57
+ - 🤖 **Multi-LLM**: Supports Kimi, DeepSeek, OpenAI, Gemini
58
+ - 🔒 **Local First**: Runs on your machine, data stays private
59
+ - 📸 **Screenshots**: Capture pages automatically
60
+ - 📊 **Data Export**: Save results to CSV, JSON, Excel
61
+
62
+ ## Supported Models
63
+
64
+ | Model | Provider | Setup |
65
+ |-------|----------|-------|
66
+ | Kimi | Moonshot | `surfai config --model kimi --key sk-xxx` |
67
+ | DeepSeek | DeepSeek | `surfai config --model deepseek --key sk-xxx` |
68
+ | GPT-4o | OpenAI | `surfai config --model openai --key sk-xxx` |
69
+ | Gemini | Google | `surfai config --model gemini --key xxx` |
70
+
71
+ ## Usage Examples
72
+
73
+ ### Command Line
74
+
75
+ ```bash
76
+ # Extract data
77
+ surfai "Go to example.com and get all product prices"
78
+
79
+ # Take screenshot
80
+ surfai "Open github.com/microsoft and take a screenshot"
81
+
82
+ # Complex task
83
+ surfai "Search for 'Python tutorials' on Google, open the first result, summarize the content"
84
+ ```
85
+
86
+ ### Python API
87
+
88
+ ```python
89
+ import asyncio
90
+ from surfai import Browser
91
+
92
+ async def main():
93
+ async with Browser() as browser:
94
+ await browser.goto("https://github.com/openclaw/openclaw")
95
+ stars = await browser.extract("stars count")
96
+ print(f"Stars: {stars}")
97
+ await browser.screenshot("openclaw.png")
98
+
99
+ asyncio.run(main())
100
+ ```
101
+
102
+ ## Configuration
103
+
104
+ Configuration is stored in `~/.surfai/config.json`:
105
+
106
+ ```json
107
+ {
108
+ "default_model": "kimi",
109
+ "models": {
110
+ "kimi": {
111
+ "api_key": "sk-xxx",
112
+ "base_url": "https://api.moonshot.cn/v1"
113
+ },
114
+ "deepseek": {
115
+ "api_key": "sk-xxx",
116
+ "base_url": "https://api.deepseek.com/v1"
117
+ }
118
+ }
119
+ }
120
+ ```
121
+
122
+ ## License
123
+
124
+ MIT License - see LICENSE file for details.
@@ -0,0 +1,32 @@
1
+ # SurfAI
2
+
3
+ ## 开发进度
4
+
5
+ ### Phase 1: MVP (进行中)
6
+
7
+ - [x] 项目结构搭建
8
+ - [x] 配置管理 (Config)
9
+ - [x] LLM 抽象层
10
+ - [x] Kimi (Moonshot) 集成
11
+ - [x] DeepSeek 集成
12
+ - [x] OpenAI 集成
13
+ - [x] LLM Router
14
+ - [x] 浏览器核心 (Browser)
15
+ - [x] CLI 命令行接口
16
+ - [x] 示例代码
17
+ - [ ] 安装测试
18
+ - [ ] 文档完善
19
+
20
+ ### Phase 2: 增强 (待开始)
21
+
22
+ - [ ] Gemini 支持
23
+ - [ ] 智能表格提取
24
+ - [ ] 数据导出 (CSV/Excel)
25
+ - [ ] 反检测增强
26
+ - [ ] 错误重试机制
27
+
28
+ ### Phase 3: 云端 (待开始)
29
+
30
+ - [ ] 云端浏览器托管
31
+ - [ ] 代理 IP 池
32
+ - [ ] Dashboard
@@ -0,0 +1,86 @@
1
+ # SurfAI 项目管理
2
+
3
+ ## 项目信息
4
+
5
+ - **名称**: SurfAI
6
+ - **路径**: `/home/alpha/.openclaw/workspace/projects/surfai`
7
+ - **环境**: Python 3.12 + 虚拟环境
8
+ - **版本**: 0.2.0
9
+ - **状态**: Phase 2 完成
10
+
11
+ ## 快速开始
12
+
13
+ ```bash
14
+ cd /home/alpha/.openclaw/workspace/projects/surfai
15
+ source venv/bin/activate
16
+
17
+ # 配置 API 模型
18
+ surfai config --model kimi --key <your-key>
19
+ # 或配置本地 Ollama(零成本)
20
+ surfai config --model ollama --key dummy --base-url http://localhost:11434
21
+
22
+ # 使用
23
+ surfai run "你的指令"
24
+ ```
25
+
26
+ ## 开发规范
27
+
28
+ 1. **必须在虚拟环境中开发**
29
+ ```bash
30
+ source venv/bin/activate
31
+ ```
32
+
33
+ 2. **安装新依赖**
34
+ ```bash
35
+ pip install <package>
36
+ # 然后更新 pyproject.toml
37
+ ```
38
+
39
+ 3. **测试**
40
+ ```bash
41
+ pytest
42
+ ```
43
+
44
+ ## 目录结构
45
+
46
+ ```
47
+ surfai/
48
+ ├── surfai/ # 主代码
49
+ │ ├── browser.py # 浏览器核心
50
+ │ ├── cli.py # 命令行
51
+ │ ├── config.py # 配置管理
52
+ │ ├── extractor.py # 智能提取
53
+ │ ├── exporter.py # 数据导出
54
+ │ └── llm/ # LLM providers
55
+ ├── examples/ # 示例
56
+ ├── tests/ # 测试
57
+ ├── venv/ # 虚拟环境(不提交)
58
+ ├── pyproject.toml # 包配置
59
+ └── README.md # 文档
60
+ ```
61
+
62
+ ## 功能清单
63
+
64
+ ### Phase 1 (✅ 完成)
65
+ - [x] 浏览器核心(导航、截图、CSS 提取)
66
+ - [x] Kimi/DeepSeek/OpenAI 集成
67
+ - [x] CLI 命令行
68
+ - [x] 配置管理
69
+
70
+ ### Phase 2 (✅ 完成)
71
+ - [x] Ollama 本地 LLM 支持
72
+ - [x] 智能提取(表格、链接、列表、价格)
73
+ - [x] 数据导出(JSON/CSV/TXT)
74
+ - [x] 复杂交互(点击、输入、滚动)
75
+
76
+ ### Phase 3 (待开始)
77
+ - [ ] 云端浏览器托管
78
+ - [ ] 代理 IP 池
79
+ - [ ] Dashboard
80
+ - [ ] 更多导出格式(Excel)
81
+
82
+ ## 待办
83
+
84
+ - [ ] 用户测试(需要 API Key)
85
+ - [ ] 完善文档
86
+ - [ ] 发布到 PyPI
surfai-0.8.1/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # SurfAI
2
+
3
+ 🏄 **Natural Language Browser Automation**
4
+
5
+ Say what you want, SurfAI does the browsing.
6
+
7
+ ## Quick Start
8
+
9
+ ```bash
10
+ # Install
11
+ pip install surfai
12
+
13
+ # Configure your LLM (choose one)
14
+ surfai config --model kimi --key sk-your-kimi-key
15
+ surfai config --model deepseek --key sk-your-deepseek-key
16
+
17
+ # Start automating
18
+ surfai "Go to GitHub and find the most starred Python project"
19
+ ```
20
+
21
+ ## Features
22
+
23
+ - 🎯 **Zero Code**: Just say what you want in natural language
24
+ - 🤖 **Multi-LLM**: Supports Kimi, DeepSeek, OpenAI, Gemini
25
+ - 🔒 **Local First**: Runs on your machine, data stays private
26
+ - 📸 **Screenshots**: Capture pages automatically
27
+ - 📊 **Data Export**: Save results to CSV, JSON, Excel
28
+
29
+ ## Supported Models
30
+
31
+ | Model | Provider | Setup |
32
+ |-------|----------|-------|
33
+ | Kimi | Moonshot | `surfai config --model kimi --key sk-xxx` |
34
+ | DeepSeek | DeepSeek | `surfai config --model deepseek --key sk-xxx` |
35
+ | GPT-4o | OpenAI | `surfai config --model openai --key sk-xxx` |
36
+ | Gemini | Google | `surfai config --model gemini --key xxx` |
37
+
38
+ ## Usage Examples
39
+
40
+ ### Command Line
41
+
42
+ ```bash
43
+ # Extract data
44
+ surfai "Go to example.com and get all product prices"
45
+
46
+ # Take screenshot
47
+ surfai "Open github.com/microsoft and take a screenshot"
48
+
49
+ # Complex task
50
+ surfai "Search for 'Python tutorials' on Google, open the first result, summarize the content"
51
+ ```
52
+
53
+ ### Python API
54
+
55
+ ```python
56
+ import asyncio
57
+ from surfai import Browser
58
+
59
+ async def main():
60
+ async with Browser() as browser:
61
+ await browser.goto("https://github.com/openclaw/openclaw")
62
+ stars = await browser.extract("stars count")
63
+ print(f"Stars: {stars}")
64
+ await browser.screenshot("openclaw.png")
65
+
66
+ asyncio.run(main())
67
+ ```
68
+
69
+ ## Configuration
70
+
71
+ Configuration is stored in `~/.surfai/config.json`:
72
+
73
+ ```json
74
+ {
75
+ "default_model": "kimi",
76
+ "models": {
77
+ "kimi": {
78
+ "api_key": "sk-xxx",
79
+ "base_url": "https://api.moonshot.cn/v1"
80
+ },
81
+ "deepseek": {
82
+ "api_key": "sk-xxx",
83
+ "base_url": "https://api.deepseek.com/v1"
84
+ }
85
+ }
86
+ }
87
+ ```
88
+
89
+ ## License
90
+
91
+ MIT License - see LICENSE file for details.