Initial commit

This commit is contained in:
Zylan
2025-03-24 17:24:17 +08:00
parent b487df924b
commit b6c61ae1c0
5 changed files with 387 additions and 74 deletions

197
README.md
View File

@@ -1,105 +1,154 @@
# Snap Solver II
[English](README_EN.md) | 中文
## 项目概述
# 📚 Snap-Solver - AI笔试测评工具
Snap Solver II 是基于 Snap Solver 进化而来的强大的截图分析工具可以帮助用户捕获屏幕内容提取文本并使用多种先进的AI模型进行智能分析。该应用程序使用Flask作为后端提供网页界面同时在系统托盘中运行方便快速访问。
> 🔍 一键识别,自动解答
## 主要功能
## ✨ 项目简介
- **屏幕捕获**:快速截取屏幕图像
- **文本提取**:从图像中自动识别和提取文本(通过 mathpix 模型)
- **AI分析**使用多种AI模型包括GPT-4o、Claude、DeepSeek等对提取的内容进行智能分析
- **实时响应**通过WebSocket技术实现实时交互和响应
- **系统托盘集成**:应用在后台运行,通过系统托盘图标轻松访问
Snap-Solver 是一个强大的AI笔试测评工具只需**按下快捷键**,即可自动截取您电脑屏幕上的题目,通过 AI 进行识别并给出详细解答。无论是数学题、物理题、化学题、编程问题还是其他学术问题Snap-Solver 都能为您提供专业的解答。
## 技术栈
**本项目已完全开源,所有功能完全免费使用,无需付费!**
> 如需**代部署服务**,可联系:[zylanjian@outlook.com](mailto:zylanjian@outlook.com)
- **后端**Flask, Flask-SocketIO
- **前端**HTML5, CSS3, JavaScript
- **AI模型集成**
- GPT-4o
- Claude
- DeepSeek (尚在优化中)
- **图像处理**Pillow, Mathpix
- **系统集成**pyautogui, pystray
<img src="pic.jpg" alt="Snap-Solver 截图" width="400" />
## 安装指南
## 🌟 核心功能
### 环境要求
- 🖼️ **一键截图**使用快捷键Alt+Ctrl+S可自定义即可远程监控电脑屏幕
- 🌐 **局域网共享**:一处部署,多处使用,同一网络下**所有设备**均可访问
- 🔍 **OCR 文字识别**:支持 Mathpix API 识别数学公式和图片中的文字
- 🧠 **多模型支持**:同时支持 GPT-4o、Claude-3.7 和 DeepSeek 等多种 AI 模型
- 🔐 **VPN 代理支持**:可自定义 VPN 代理,支持国内用户通过代理访问 AI 模型
- 🌓 **主题切换**:支持明暗主题切换,保护您的眼睛
- 💻 **全平台支持**Windows、MacOS、Linux 系统可用,手机端可通过浏览器访问
- Python 3.8+
- pipPython包管理器
## 🛠️ 技术架构
### 安装步骤
- **后端**Flask + SocketIO提供 Web 服务和 WebSocket 实时通信
- **前端**HTML + CSS + JavaScript提供直观的用户界面
- **AI 接口**
- GPT-4oOpenAI 最的图文理解模型(无推理)
- Claude-3.7Anthropic 的高级思考型模型(默认包含推理)
- DeepSeek国产大模型支持
- Mathpix专业的数学公式和文字识别服务
1. **克隆仓库**
## 📋 使用前准备
```bash
git clone https://github.com/yourusername/Snap-Solver-II.git
cd Snap-Solver-II
```
1. **API Keys**:
- [OpenAI API Key](https://openai.com)(用于 GPT-4o
- [Anthropic API Key](https://anthropic.com)(用于 Claude-3.7,可选)
- [Mathpix API Key](https://mathpix.com)(用于 OCR 文字识别,可选)
2. **创建并激活虚拟环境**(推荐)
2. **运行环境**:
- [Python](https://www.python.org/downloads/) 3.x 版本
- 必要的 Python 依赖包
```bash
python -m venv .venv
# Windows
.venv\Scripts\activate
# Linux/Mac
source .venv/bin/activate
```
## 🚀 快速开始
3. **安装依赖**
1. **克隆项目**:
```bash
git clone https://github.com/your-username/Snap-Solver.git
cd Snap-Solver
```
```bash
pip install -r requirements.txt
```
2. **进入虚拟环境**:
```bash
py -m venv .venv
.venv/Scripts/activate
```
4. **启动应用**
3. **安装依赖**:
```bash
pip install -r requirements.txt
```
```bash
python app.py
```
4. **启动应用**:
```bash
python app.py
```
应用启动后,会在系统托盘中显示一个图标,同时在同一局域网下的浏览器中访问 `http://XXX.XXX.XXX.XXX:5000` 即可打开Web界面。
5. **访问服务**:
- 本机访问:打开浏览器,访问 http://localhost:5000
- 移动设备访问:使用同一局域网内的手机、平板等设备访问 http://[服务器IP]:5000
## 使用说明
## 💡 使用指南
1. **截图分析**
- 点击"截图"按钮捕获屏幕内容
- 系统自动提取图像中的文本
- 选择AI模型进行智能分析
### 1. 首次配置
2. **文本分析**
- 直接输入或粘贴文本内容
- 选择合适的AI模型进行分析
- 获取实时智能响应
首次使用时,点击右上角的⚙️设置图标,配置
- AI 模型 API 密钥(至少需要一个)
- OCR 识别设置(可选)
- 代理设置(如需)
- 系统提示词(可自定义)
## API密钥配置
### 2. 截图解题
本应用集成了多种AI模型需要相应的API密钥才能正常工作
1. 按下手机或平板上的 `截屏` 按钮键
2. 在手机或平板上,会自动显示您的电脑屏幕截图
3. 在移动设备上裁剪您想解答的题目区域
4. 选择"发送图片至 AI"(直接分析图片)或"提取图中文本"(先识别文字再分析)
5. 等待系统处理并查看详细解答
- OpenAI (GPT-4o)
- Anthropic (Claude)
- DeepSeek
- Mathpix
### 3. 文本解题
请确保在使用相应功能前配置正确的API密钥。
如果已有题目文本,或者想要修改识别出的文字:
1. 使用"提取图中文本"功能
2. 编辑文本框中的内容
3. 点击"发送文本至 AI"获取解答
## 注意事项
## ⚙️ 高级配置
- 应用默认在端口5000上运行
- 首次使用时可能需要授予屏幕截图权限
- 所有分析都在本地处理但AI请求会发送到相应的服务提供商
您可以在设置面板中自定义多项参数:
## 贡献指南
- **AI 模型**:选择不同的 AI 模型GPT-4o、Claude-3.7、DeepSeek 等)
- **语言**:设置 AI 回答的首选语言
- **温度**:调整 AI 回答的随机性(较低值更精确,较高值更创意)
- **系统提示词**:自定义 AI 的基础行为指令
- **代理设置**:配置 HTTP 代理,便于国内用户访问
欢迎贡献代码、报告问题或提出功能建议!请通过以下方式参与项目:
1. Fork仓库
2. 创建功能分支 (git checkout -b feature/amazing-feature)
3. 提交更改 (git commit -m 'Add some amazing feature')
4. 推送到分支 (git push origin feature/amazing-feature)
5. 创建Pull Request
## 📞 获取帮助
## 许可证
[Apache License](LICENCE.md)
- 如有 bug 问题:请在本仓库提交 Issue
- 如需**部署帮助**,可联系:[zylanjian@outlook.com](mailto:zylanjian@outlook.com)
## 🔧 常见问题
### 1. 截图功能无响应?
- 确保以管理员权限运行应用
- 检查是否授予了屏幕录制权限
- 确认 Python 进程正在运行
### 2. 无法连接服务?
- 检查防火墙设置
- 确认移动设备与电脑在同一局域网
- 验证服务器 IP 地址是否正确
### 3. API 调用失败?
- 检查 API Key 是否正确设置
- 确认网络连接是否正常
- 如使用代理,检查代理设置是否正确
## 🔐 安全提示
- 您的 API 密钥存储在本地,不会上传到任何服务器
- 建议只在可信任的局域网中使用本服务
- 定期更新系统和依赖包以保障安全
## 🤝 参与贡献
欢迎提交 Issue 和 Pull Request
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](LICENSE) 协议。
---
⭐ 如果这个项目对您有帮助,请给个 Star感谢支持

154
README_EN.md Normal file
View File

@@ -0,0 +1,154 @@
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.
**This project is now fully open-source, all features are completely free to use, no payment required!**
> 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/your-username/Snap-Solver.git
cd Snap-Solver
```
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
pic.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@@ -1383,3 +1383,86 @@ button:disabled {
[data-theme="dark"] .think-budget-group {
background-color: var(--highlight-bg-color-dark);
}
/* Footer Styles */
.app-footer {
background-color: var(--surface);
padding: 1rem;
border-top: 1px solid var(--border-color);
margin-top: auto;
}
.footer-content {
max-width: 1200px;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 1rem;
}
.footer-text {
color: var(--text-secondary);
font-size: 0.9rem;
}
.footer-links {
display: flex;
align-items: center;
gap: 1.5rem;
}
.footer-link {
display: flex;
align-items: center;
gap: 0.5rem;
color: var(--text-secondary);
text-decoration: none;
font-size: 0.9rem;
transition: color 0.2s ease;
}
.footer-link:hover {
color: var(--primary);
}
.footer-link i {
font-size: 1rem;
}
.star-icon {
font-size: 1rem;
}
.user-counter {
display: flex;
align-items: center;
}
.user-counter img {
height: 20px;
width: auto;
}
@media (max-width: 768px) {
.footer-content {
flex-direction: column;
text-align: center;
}
.footer-links {
flex-wrap: wrap;
justify-content: center;
}
}
@media (max-width: 480px) {
.footer-links {
gap: 1rem;
}
.footer-link {
font-size: 0.8rem;
}
}

View File

@@ -257,6 +257,33 @@
<div id="toastContainer" class="toast-container"></div>
<footer class="app-footer">
<div class="footer-content">
<div class="footer-text">
<span>© 2024 Snap-Solver</span>
</div>
<div class="footer-links">
<a href="https://github.com/Zippland/Snap-Solver/" target="_blank" class="footer-link">
<span class="star-icon"></span>
<span>GitHub</span>
</a>
<a href="mailto:zylanjian@outlook.com" class="footer-link">
<i class="fas fa-envelope"></i>
<span>邮箱</span>
</a>
<a href="https://www.xiaohongshu.com/user/profile/623e8b080000000010007721?xsec_token=YBdeHZTp_aVwi1Ijmras5CgQC6pxlpd4RmozT8Hr_-NCA%3D&xsec_source=app_share&xhsshare=CopyLink&appuid=623e8b080000000010007721&apptime=1742201089&share_id=a2704ab48e2c4e1aa321ce63168811b5&share_channel=copy_link" target="_blank" class="footer-link xiaohongshu-link">
<i class="fas fa-heart"></i>
<span>小红书</span>
</a>
<div class="user-counter">
<a href="https://hits.seeyoufarm.com" target="_blank">
<img src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FZippland%2FSnap-Solver&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=用户量&edge_flat=false"/>
</a>
</div>
</div>
</div>
</footer>
<script src="{{ url_for('static', filename='js/ui.js') }}"></script>
<script src="{{ url_for('static', filename='js/settings.js') }}"></script>
<script src="{{ url_for('static', filename='js/main.js') }}"></script>