项目简介
Tiny QA 是一个完全本地化的智能文档问答系统,基于 Ollama 本地大语言模型构建。它能够处理 PDF、Word、Excel、TXT、Markdown 等多种格式的文档,通过向量化技术实现语义搜索,并基于相关文档内容生成准确的回答。
核心特性
- 🔒完全本地化:基于 Ollama 本地模型,数据不出本地
- 📚多格式支持:PDF、Word、Excel、TXT、Markdown 等5种格式
安装前提
在开始使用 Tiny QA 之前,您需要先安装以下三个核心工具:
1. Git 版本控制工具
Git 是一个分布式版本控制系统,用于下载和管理项目代码。
安装方法:
Windows:
ounter(lineounter(lineounter(lineounter(line#下载并安装GitforWindows#访问:https://git-scm.com/download/win#或使用wingetwingetinstallGit.Git
macOS:
ounter(lineounter(lineounter(lineounter(lineounter(line# 使用 Homebrew 安装brew install git
# 或使用官方安装包# 访问: https://git-scm.com/download/mac
Linux (Ubuntu/Debian):
ounter(lineounter(linesudoaptupdatesudoaptinstallgit
Linux (CentOS/RHEL):
ounter(lineounter(lineounter(linesudoyuminstallgit#或sudodnfinstallgit
验证安装:
2. Python 编程语言
Python 是 Tiny QA 的主要开发语言,用于运行 Web 服务和 AI 处理逻辑。
版本要求:
- Python 3.8+(推荐 Python 3.9 或 3.11)
安装方法:
Windows:
ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line# 下载并安装 Python# 访问: https://www.python.org/downloads/# 或使用 wingetwinget install Python.Python.3.11
# 验证安装python --versionpip --version
macOS:
ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line# 使用 Homebrew 安装brew install python@3.11
# 或使用官方安装包# 访问: https://www.python.org/downloads/macos/
# 验证安装python3 --versionpip3 --version
Linux (Ubuntu/Debian):
ounter(lineounter(lineounter(lineounter(lineounter(lineounter(linesudo apt updatesudo apt install python3 python3-pip python3-venv
# 验证安装python3 --versionpip3 --version
Linux (CentOS/RHEL):
ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(linesudo yum install python3 python3-pip# 或sudo dnf install python3 python3-pip
# 验证安装python3 --versionpip3 --version
配置 pip 镜像源(可选,国内用户推荐):
ounter(lineounter(lineounter(lineounter(lineounter(line# 使用清华大学镜像源pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/
# 或使用阿里云镜像源pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
3. Ollama 本地大语言模型
Ollama 是一个强大的本地大语言模型运行框架,支持多种开源模型。
简介:
- 🎯多模型支持:支持 Llama、Qwen、DeepSeek 等主流模型
- 💾资源友好:支持从 1GB 到 70GB 的各种模型
安装方法:
Windows:
ounter(lineounter(lineounter(lineounter(line#下载并安装Ollama#访问:https://ollama.ai/download#或使用wingetwingetinstallOllama.Ollama
macOS:
ounter(lineounter(lineounter(lineounter(lineounter(line# 使用 Homebrew 安装brew install ollama
# 或使用官方安装脚本curl -fsSL https://ollama.ai/install.sh | sh
Linux:
ounter(lineounter(line#使用官方安装脚本curl-fsSLhttps://ollama.ai/install.sh|sh
验证安装:
ounter(lineollama--version
启动 Ollama 服务:
下载模型(可选):
ounter(lineounter(lineounter(lineounter(lineounter(lineounter(line# 下载推荐的对话模型ollama pull deepseek-r1:1.5b
# 或下载其他模型ollama pull qwen3:4bollama pull llama3:latest
快速安装
本地安装
ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line# 1. 克隆项目git clone https://gitee.com/hu9001/tiny-qa.gitcd tiny-qa
# 2. 创建 Python 虚拟环境python -m venv envsource env/bin/activate # Linux/macOS# env\Scripts\activate # Windows
# 3. 安装 Python 依赖pip install -r requirements.txt
# 4. 启动服务ollama serve &python app.py
使用方法
1. 首次配置
2. 智能问答
3. 文档管理
4. 支持的文档格式
技术架构
ounter(lineounter(lineounter(lineounter(line文档处理→向量搜索→AI问答↓↓↓PDF/Word/Excel→语义向量→Ollama模型TXT/Markdown→相似度搜索→智能回答
支持的模型
系统要求
推荐配置
- 操作系统:Windows 11、macOS 12+、Ubuntu 20.04+
- GPU:可选,支持 CUDA 的 NVIDIA 显卡可加速推理
网络要求
常见问题
Q: 首次启动很慢?A: 系统需要下载 AI 模型,首次启动会较慢。建议提前下载模型:ollama pull deepseek-r1:1.5b
Q: 数据安全吗?A: 完全本地化部署,数据不会上传到任何服务器。
Q: 支持哪些语言?A: 支持中文、英文等多种语言,取决于选择的模型。
Q: Git 安装失败怎么办?A: 确保网络连接正常,或访问 https://git-scm.com/downloads 手动下载安装包。
Q: Python 版本不兼容?A: 确保安装 Python 3.8+ 版本,推荐使用 Python 3.9 或 3.11。
Q: pip 安装包很慢?A: 配置国内镜像源:pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/
Q: Ollama 服务启动失败?A: 检查端口 11434 是否被占用,或重启 Ollama 服务:ollama serve
Q: 模型下载很慢?A: 可以使用国内镜像源,或选择较小的模型如deepseek-r1:1.5b(约1GB)。
Q: 内存不足怎么办?A: 选择较小的模型,或增加系统内存。推荐至少 8GB RAM。
项目地址
- Gitee: https://gitee.com/hu9001/tiny-qa
总结
Tiny QA 为个人和企业提供了一个安全、高效的本地知识管理解决方案。通过结合现代 AI 技术和向量搜索,它能够快速处理大量文档并提供智能问答服务,是构建个人知识库的理想工具。
如果您对本地化 AI 应用感兴趣,Tiny QA 是一个很好的起点。