This commit is contained in:
Zylan
2025-04-01 08:26:43 +08:00
parent 163fad337e
commit aec0a25098
3 changed files with 201 additions and 262 deletions

312
README.md
View File

@@ -1,151 +1,241 @@
[English](README_EN.md) | 中文 <h1 align="center">Snap-Solver <img src="https://img.shields.io/badge/版本-1.0.0-blue" alt="版本"></h1>
# 📚 Snap-Solver - AI笔试测评工具
> 🔍 一键识别,自动解答 <p align="center">
<b>🔍 一键截屏,自动解题 - 线上考试,从未如此简单</b>
</p>
## ✨ 项目简介 <p align="center">
<img src="https://img.shields.io/badge/Python-3.x-blue?logo=python" alt="Python">
<img src="https://img.shields.io/badge/Framework-Flask-green?logo=flask" alt="Flask">
<img src="https://img.shields.io/badge/AI-Multi--Model-orange" alt="AI">
<img src="https://img.shields.io/badge/License-Apache%202.0-lightgrey" alt="License">
</p>
Snap-Solver 是一个强大的AI笔试测评工具只需**按下快捷键**,即可自动截取您电脑屏幕上的题目,通过 AI 进行识别并给出详细解答。无论是数学题、物理题、化学题、编程问题还是其他学术问题Snap-Solver 都能为您提供专业的解答。
<img src="pic.jpg" alt="Snap-Solver 截图" width="400" /> <p align="center">
<a href="#-核心特性">核心特性</a> •
<a href="#-快速开始">快速开始</a> •
<a href="#-使用指南">使用指南</a> •
<a href="#-技术架构">技术架构</a> •
<a href="#-高级配置">高级配置</a> •
<a href="#-常见问题">常见问题</a> •
<a href="#-获取帮助">获取帮助</a>
</p>
### 📞 代部署支持 <p align="center">
<img src="pic.jpg" alt="Snap-Solver 截图" width="300" />
</p>
如果您不擅长编程,需要该软件的**代部署服务**,可发送邮件至:[zylanjian@outlook.com](mailto:zylanjian@outlook.com) ## 💫 项目简介
## 🌟 核心功能 **Snap-Solver** 是一个革命性的AI笔试测评工具专为学生、考生和自学者设计。只需**按下快捷键**即可自动截取屏幕上的任何题目通过AI进行分析并提供详细解答。
- 🖼️ **一键截图**:在手机上使用**截屏**按钮,即可远程监控电脑屏幕 无论是复杂的数学公式、物理难题、编程问题还是其他学科的挑战Snap-Solver都能提供清晰、准确、有条理的解决方案帮助您更好地理解和掌握知识点。
- 🌐 **局域网共享**:一处部署,多处使用,同一网络下**所有设备**均可监控电脑
- 🔍 **OCR 文字识别**:支持 Mathpix API 识别数学公式和图片中的文字
- 🧠 **多模型支持**:同时支持 GPT、o3、Claude 和 DeepSeek 等多种 AI 模型
- 🔐 **VPN 代理支持**:可自定义 VPN 代理,支持国内用户通过代理访问
- 💻 **全平台支持**Windows、MacOS暂未调试、Linux 系统可用,手机端可通过浏览器访问
## 🛠️ 技术架构 <div align="center">
<table>
<tr>
<td align="center" style="background-color: #f8f9fa; padding: 10px; border-radius: 5px;">
<b>📞 代部署支持</b><br>
如果您不擅长编程,需要专业的代部署服务<br>
请联系:<a href="mailto:zylanjian@outlook.com">zylanjian@outlook.com</a>
</td>
</tr>
</table>
</div>
- **后端**Flask + SocketIO提供 Web 服务和 WebSocket 实时通信 ## ✨ 核心特性
- **前端**HTML + CSS + JavaScript提供直观的用户界面
- **AI 接口**
OpenAI: <table>
- GPT-4o <tr>
- o3-mini <td width="50%">
<h3>📱 跨设备协同</h3>
Anthropic: <ul>
- Claude-3.7-Sonnet <li><b>一键截图</b>:按下快捷键,即可在移动设备上查看和分析电脑屏幕</li>
<li><b>局域网共享</b>:一处部署,多设备访问,提升学习效率</li>
DeepSeek: </ul>
- DeepSeek-r1 </td>
- DeepSeek-v3 <td width="50%">
<h3>🧠 多模型AI支持</h3>
Mathpix: <ul>
- Mathpix OCR <li><b>GPT-4o/o3-mini</b>OpenAI强大的推理能力</li>
<li><b>Claude-3.7</b>Anthropic的高级理解与解释</li>
## 📋 使用前准备 <li><b>DeepSeek-v3/r1</b>:专为中文场景优化的模型</li>
</ul>
1. **API Keys**: </td>
- [OpenAI API Key](https://openai.com)(可选) </tr>
- [Anthropic API Key](https://anthropic.com)(可选,推荐✅) <tr>
- [DeepSeek API Key](https://deepseek.com)(可选,不推荐❌) <td>
- [Mathpix API Key](https://mathpix.com)(推荐✅) <h3>🔍 精准识别</h3>
<ul>
2. **运行环境**: <li><b>OCR文字识别</b>:准确捕捉图片中的文本</li>
- [Python](https://www.python.org/downloads/) 3.x 版本 <li><b>数学公式支持</b>通过Mathpix精确识别复杂数学符号</li>
- 必要的 Python 依赖包 </ul>
</td>
<td>
<h3>🌐 全球无障碍</h3>
<ul>
<li><b>VPN代理支持</b>:自定义代理设置,解决网络访问限制</li>
<li><b>多语言响应</b>支持定制AI回复语言</li>
</ul>
</td>
</tr>
<tr>
<td>
<h3>💻 全平台兼容</h3>
<ul>
<li><b>桌面支持</b>Windows、MacOS、Linux</li>
<li><b>移动访问</b>:手机、平板通过浏览器直接使用</li>
</ul>
</td>
<td>
<h3>⚙️ 高度可定制</h3>
<ul>
<li><b>思考深度控制</b>调整AI的分析深度</li>
<li><b>自定义提示词</b>:针对特定学科优化提示</li>
</ul>
</td>
</tr>
</table>
## 🚀 快速开始 ## 🚀 快速开始
1. **启动应用**: ### 📋 前置要求
```bash
python app.py
```
2. **访问服务**: - Python 3.x
- 💻 本机访问: - 至少以下一个API Key详见[获取API密钥指南](#-获取api密钥):
打开浏览器,访问 http://localhost:5000 - OpenAI API Key
- 📱 移动设备访问: - Anthropic API Key (推荐✅)
使用同一局域网内的手机、平板等设备访问 `http://[服务器IP]:5000` - DeepSeek API Key
- Mathpix API Key (推荐OCR识别✅)
## 💡 使用指南 ### 📥 开始使用
### 1. 首次配置 ```bash
# 启动应用
python app.py
```
首次使用时,点击右上角的⚙️设置图标,配置: ### 📱 访问方式
- AI 模型 API 密钥(至少需要一个)
- OCR 识别设置可选为节约token成本强烈推荐
- 代理设置(如需)
- 系统提示词(可自定义)
### 2. 截图解题 - **本机访问**:打开浏览器,访问 http://localhost:5000
- **局域网设备访问**:在同一网络的任何设备上访问 `http://[电脑IP]:5000`
1. 按下手机或平板上的 `截屏` 按钮键 ## 📖 使用指南
2. 在手机或平板上,会自动显示您的电脑屏幕截图
3. 在移动设备上裁剪您想解答的题目区域
4. 选择"发送图片至 AI"(直接分析图片)或"提取图中文本"(先识别文字再分析)
5. 等待系统处理并查看详细解答
### 3. 文本解题 <table>
<tr>
<td width="33%">
<h4>1⃣ 首次配置</h4>
<p>点击右上角⚙设置图标配置API密钥和首选项</p>
</td>
<td width="33%">
<h4>2⃣ 截图解题</h4>
<p>点击"截图"按钮 → 裁剪题目区域 → 选择分析方式</p>
</td>
<td width="33%">
<h4>3⃣ 查看解答</h4>
<p>实时查看AI分析过程和详细解答包含思考路径</p>
</td>
</tr>
</table>
如果已有题目文本,或者想要修改识别出的文字: ### 🎯 使用场景示例
1. 使用"提取图中文本"功能
2. 编辑文本框中的内容 - **课后习题**:截取教材或作业中的难题,获取步骤详解
3. 点击"发送文本至 AI"获取解答 - **编程调试**:截取代码错误信息,获取修复建议
- **考试复习**:分析错题并理解解题思路
- **文献研究**:截取复杂论文段落,获取简化解释
## 🔧 技术架构
```mermaid
graph TD
A[用户界面] --> B[Flask Web服务]
B --> C{API路由}
C --> D[截图服务]
C --> E[OCR识别]
C --> F[AI分析]
E --> |Mathpix API| G[文本提取]
F --> |模型选择| H1[OpenAI]
F --> |模型选择| H2[Anthropic]
F --> |模型选择| H3[DeepSeek]
D --> I[Socket.IO实时通信]
I --> A
```
### 🧩 组件详情
- **前端**响应式HTML/CSS/JS界面支持移动设备
- **后端**Flask + SocketIO提供RESTful API和WebSocket
- **AI接口**:多模型支持,统一接口标准
- **图像处理**:高效的截图和裁剪功能
## ⚙️ 高级配置 ## ⚙️ 高级配置
您可以在设置面板中自定义多项参数: ### 模型选择与优化
- **AI 模型**:选择不同的 AI 模型GPT-4o、o3-mini、Claude-3.7、DeepSeek-r1 等) | 模型 | 优势 | 适用场景 |
- **语言**:设置 AI 回答的首选语言 |------|------|----------|
- **温度**:调整 AI 回答的随机性(较低值更精确,较高值更创意) | **GPT-4o** | 综合能力强,多模态支持 | 复杂学科问题,图像理解 |
- **思考深度** Claude专属参数可调整思维模式 | **o3-mini** | 速度快,成本低 | 简单问题,快速反馈 |
- **系统提示词**:自定义 AI 的基础行为指令 | **Claude-3.7** | 详细思考过程,推理透明 | 数学证明,深度分析 |
- **代理设置**:配置 HTTP 代理,便于国内用户访问 | **DeepSeek** | 中文优化,低延迟 | 中文习题,语文分析 |
## 📞 获取帮助 ### 🛠️ 可调参数
- 如有 bug 问题:请在本仓库提交 Issue - **温度**调整回答的创造性与确定性0.1-1.0
- 如需**部署帮助**,可联系:[zylanjian@outlook.com](mailto:zylanjian@outlook.com) - **最大输出Token**:控制回答长度
- **推理深度**:标准模式(快速)或深度思考(详细)
- **思考预算占比**:平衡思考过程与最终答案的详细程度
- **系统提示词**自定义AI的基础行为与专业领域
## 🔧 常见问题 ## 常见问题
### 1. 截图功能无响应? <details>
- 确保以管理员权限运行应用 <summary><b>如何获得最佳识别效果?</b></summary>
- 检查是否授予了屏幕录制权限 <p>
- 确认 Python 进程正在运行 确保截图清晰包含完整题目和必要上下文。对于数学公式建议使用Mathpix OCR以获得更准确的识别结果。
</p>
</details>
### 2. 无法连接服务? <details>
- 检查防火墙设置 <summary><b>无法连接到服务怎么办?</b></summary>
- 确认移动设备与电脑在同一局域网 <p>
- 验证服务器 IP 地址是否正确 1. 检查防火墙设置是否允许5000端口<br>
2. 确认设备在同一局域网内<br>
3. 尝试重启应用程序<br>
4. 查看控制台日志获取错误信息
</p>
</details>
### 3. API 调用失败? <details>
- 检查 API Key 是否正确设置 <summary><b>API调用失败的原因</b></summary>
- 确认网络连接是否正常 <p>
- 如使用代理,检查代理设置是否正确 1. API密钥可能无效或余额不足<br>
2. 网络连接问题特别是国际API<br>
3. 代理设置不正确<br>
4. API服务可能临时不可用
</p>
</details>
## 🔐 安全提示 <details>
<summary><b>如何优化AI回答质量</b></summary>
<p>
1. 调整系统提示词,添加特定学科的指导<br>
2. 根据问题复杂度选择合适的模型<br>
3. 对于复杂题目,使用"深度思考"模式<br>
4. 确保截取的题目包含完整信息
</p>
</details>
- 您的 API 密钥存储在本地,不会上传到任何服务器 ## 🤝 获取帮助
- 建议只在可信任的局域网中使用本服务
- 定期更新系统和依赖包以保障安全
## 🤝 参与贡献 - **代部署服务**:如果您不擅长编程,需要代部署服务,请联系 [zylanjian@outlook.com](mailto:zylanjian@outlook.com)
- **问题报告**在GitHub仓库提交Issue
欢迎提交 Issue 和 Pull Request - **功能建议**欢迎通过Issue或邮件提供改进建议
1. Fork 本仓库
2. 创建功能分支 (`git checkout -b feature/AmazingFeature`)
3. 提交更改 (`git commit -m 'Add some AmazingFeature'`)
4. 推送到分支 (`git push origin feature/AmazingFeature`)
5. 提交 Pull Request
## 📜 开源协议 ## 📜 开源协议
本项目采用 [Apache 2.0](LICENSE) 协议。 本项目采用 [Apache 2.0](LICENSE) 协议。
---
⭐ 如果这个项目对您有帮助,请给个 Star感谢支持

View File

@@ -1,151 +0,0 @@
English | [中文](README.md)
# 📚 Snap-Solver - AI Exam Assistance Tool
> 🔍 One-click recognition, automatic solving
## ✨ Project Introduction
Snap-Solver is a powerful AI exam assistance tool that can automatically capture questions on your computer screen with just a **press of a hotkey**, recognize them through AI, and provide detailed solutions. Whether it's mathematics, physics, chemistry, programming problems, or other academic questions, Snap-Solver can provide professional answers.
> For **deployment services**, please contact: [zylanjian@outlook.com](mailto:zylanjian@outlook.com)
<img src="pic.jpg" alt="Snap-Solver screenshot" width="400" />
## 🌟 Core Features
- 🖼️ **One-click Screenshot**: Use a hotkey (Alt+Ctrl+S, customizable) to remotely monitor your computer screen
- 🌐 **LAN Sharing**: Deploy once, use everywhere — all devices on the same network can access
- 🔍 **OCR Text Recognition**: Support for Mathpix API to recognize mathematical formulas and text in images
- 🧠 **Multiple Model Support**: Simultaneous support for GPT-4o, Claude-3.7, DeepSeek, and other AI models
- 🔐 **VPN Proxy Support**: Customizable VPN proxy, supports users in regions with limited access to AI models
- 🌓 **Theme Switching**: Light and dark theme support to protect your eyes
- 💻 **Cross-Platform Support**: Works on Windows, MacOS, Linux, with mobile access through browsers
## 🛠️ Technical Architecture
- **Backend**: Flask + SocketIO, providing Web services and WebSocket real-time communication
- **Frontend**: HTML + CSS + JavaScript, providing an intuitive user interface
- **AI Interfaces**:
- GPT-4o: OpenAI's image and text understanding model (without reasoning)
- Claude-3.7: Anthropic's advanced thinking model (includes reasoning by default)
- DeepSeek: Alternative model support
- Mathpix: Professional mathematical formula and text recognition service
## 📋 Prerequisites
1. **API Keys**:
- [OpenAI API Key](https://openai.com) (for GPT-4o)
- [Anthropic API Key](https://anthropic.com) (for Claude-3.7, optional)
- [Mathpix API Key](https://mathpix.com) (for OCR text recognition, optional)
2. **Running Environment**:
- [Python](https://www.python.org/downloads/) 3.x version
- Required Python dependencies
## 🚀 Quick Start
1. **Clone the project**:
```bash
git clone https://github.com/zippland/Snap-Solver.git
```
2. **Activate virtual environment**:
```bash
.venv/Scripts/activate
```
3. **Install dependencies**:
```bash
pip install -r requirements.txt
```
4. **Start the application**:
```bash
python app.py
```
5. **Access the service**:
- Local access: Open browser, visit http://localhost:5000
- Mobile device access: Use phones/tablets on the same LAN to visit http://[server-IP]:5000
## 💡 Usage Guide
### 1. First-time Setup
When using for the first time, click the ⚙️ settings icon in the top right corner to configure:
- AI model API keys (at least one required)
- OCR recognition settings (optional)
- Proxy settings (if needed)
- System prompt (customizable)
### 2. Screenshot-based Problem Solving
1. Press the `Screenshot` button on your phone or tablet
2. Your computer screen will automatically display on your mobile device
3. Crop the problem area you want to solve on your mobile device
4. Choose "Send image to AI" (direct image analysis) or "Extract text from image" (OCR then analysis)
5. Wait for the system to process and view the detailed solution
### 3. Text-based Problem Solving
If you already have the problem text, or want to modify the recognized text:
1. Use the "Extract text from image" feature
2. Edit the content in the text box
3. Click "Send text to AI" to get the solution
## ⚙️ Advanced Configuration
You can customize multiple parameters in the settings panel:
- **AI Model**: Choose different AI models (GPT-4o, Claude-3.7, DeepSeek, etc.)
- **Language**: Set the preferred language for AI responses
- **Temperature**: Adjust the randomness of AI responses (lower values are more precise, higher values more creative)
- **System Prompt**: Customize basic instructional prompts for the AI
- **Proxy Settings**: Configure HTTP proxy for users in regions with limited access
## 📞 Get Help
- For bug issues: Please submit an Issue in this repository
- For **deployment help**, contact: [zylanjian@outlook.com](mailto:zylanjian@outlook.com)
## 🔧 Common Issues
### 1. Screenshot function not responding?
- Ensure the application is run with administrator privileges
- Check if screen recording permissions have been granted
- Confirm that the Python process is running
### 2. Cannot connect to the service?
- Check firewall settings
- Confirm mobile devices are on the same network as the computer
- Verify the server IP address is correct
### 3. API call failed?
- Check if API Keys are correctly set
- Confirm network connection is normal
- If using a proxy, check if proxy settings are correct
## 🔐 Security Tips
- Your API keys are stored locally and not uploaded to any server
- Only use this service on trusted local networks
- Regularly update the system and dependencies to ensure security
## 🤝 Contribution
Welcome to submit Issues and Pull Requests!
1. Fork this repository
2. Create a feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Submit a Pull Request
## 📜 License
This project is licensed under the [Apache](LICENSE) license.
---
⭐ If this project helps you, please give it a Star! Thanks for your support!

BIN
server/instance/app.db Normal file

Binary file not shown.