Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
LLM-Filter
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2026_NGIT
LLM-Filter
Commits
aea76f67
Commit
aea76f67
authored
Nov 19, 2025
by
uuo00_n
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs: 添加Windows PowerShell快速启动指南
parent
b5ca2246
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
0 deletions
+85
-0
README.md
README.md
+85
-0
No files found.
README.md
View file @
aea76f67
...
...
@@ -133,6 +133,91 @@ uvicorn app.main:app --reload
---
## 快速开始(Windows PowerShell 示例)
1) 允许脚本执行并创建虚拟环境
```
powershell
Set-ExecutionPolicy
-Scope CurrentUser -ExecutionPolicy RemoteSigned -Force
py -m venv .venv
./.venv/Scripts/Activate.ps1
python -m pip
install
--upgrade pip
pip
install
-r requirements.txt
```
2) 创建
`.env`
(会在根目录生成配置文件)
```
powershell
@
"
MONGODB_URL=mongodb://localhost:27017
DB_NAME=llm_filter_db
SECRET_KEY=REPLACE_WITH_RANDOM_HEX
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=llama2
APP_MODE=edu
CORS_ALLOWED_ORIGINS=*
ADMIN_EDU_PASSWORD=admin123
USER_EDU_PASSWORD=user123
MANAGER_EDU_PASSWORD=manager123
LEADER_EDU_PASSWORD=leader123
MASTER_EDU_PASSWORD=master123
"
@ |
Out-File
-Encoding UTF8 .env
# 生成强随机密钥并替换上面的 SECRET_KEY
python -c
"import secrets; print(secrets.token_hex(32))"
```
3) 启动 MongoDB(任选其一)
-
选项A:Docker(已安装 Docker Desktop)
```
powershell
docker run -d --name mongo -p 27017:27017 mongo:6.0
```
-
选项B:本机服务(已安装 MongoDB Community)
```
powershell
# 启动服务(如安装为 Windows 服务)
Start-Service
-Name MongoDB
# 或使用 mongod 手动启动(根据你的安装路径与数据目录调整)
# & "C:\\Program Files\\MongoDB\\Server\\6.0\\bin\\mongod.exe" --dbpath C:\\data\\db
# 端口连通性检查
Test-NetConnection
-ComputerName localhost -Port 27017
```
4) 安装并验证 Ollama(可选但推荐)
```
powershell
# 安装(如已配置 Winget)
winget
install
-e --id Ollama.Ollama
# 拉取示例模型
ollama pull llama2
# 验证服务
curl.exe http://localhost:11434/api/tags
```
5) 初始化数据库(生成演示数据与默认账户、实体化示例)
```
powershell
python init_db.py
```
6) 启动后端服务
```
powershell
uvicorn app.main:app --host 0.0.0.0 --port 8000
```
7) 访问接口文档
```
powershell
Start-Process
http://localhost:8000/docs
```
默认测试账号:
-
管理员:
`admin / admin123`
-
普通用户:
`user / user123`
注意:如需限制 CORS 来源,在
`.env`
中将
`CORS_ALLOWED_ORIGINS`
设置为以逗号分隔的域名列表(例如
`https://example.com,https://admin.example.com`
);当使用通配
`*`
时,服务将自动关闭跨域凭据以满足浏览器安全策略。
## 配置详解
与代码一致,配置由
`app/core/config.py`
读取:
-
`MONGODB_URL`
:MongoDB 连接串,默认
`mongodb://localhost:27017`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment