chore: initial baseline with P0-safety .gitignore
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
# 2026-06-05 工作日志
|
||||
|
||||
## 部署上线 - Bug 修复
|
||||
|
||||
### Bug 1: nginx `set` 指令位置错误
|
||||
- **现象**: `"set" directive is not allowed here in nginx.conf:21`
|
||||
- **原因**: `set` 只能在 `server`/`location` 块内使用,不能放全局
|
||||
- **修复**: 移除全局的 `env DATAQUERY_HOST;` 和 `set $dataquery_host` 两行(`proxy_pass` 已硬编码 IP)
|
||||
|
||||
### Bug 2: alembic 找不到 `app` 模块
|
||||
- **现象**: `ModuleNotFoundError: No module named 'app'`
|
||||
- **原因**: alembic 命令执行时 PYTHONPATH 未设置
|
||||
- **修复**: docker-compose.yml command 改为 `cd /app && PYTHONPATH=/app alembic upgrade head`
|
||||
|
||||
### Bug 3: 前端 301 重定向死循环
|
||||
- **现象**: `/itdesk/` 和 `/itagent/` 返回 301,跟随重定向后仍 301
|
||||
- **原因**: `alias` + `try_files $uri $uri/` 组合触发 nginx 目录重定向
|
||||
- **修复**: `try_files` 移除 `$uri/`,改为 `try_files $uri /itdesk/index.html`
|
||||
|
||||
### Bug 4: system_configs 重复插入(未修复,不影响功能)
|
||||
- **现象**: `duplicate key value violates unique constraint "system_configs_config_key_key"`
|
||||
- **影响**: 每次重启会报错但服务正常启动(第二条 `Application startup complete.`)
|
||||
- **待修**: INSERT 应改为 `INSERT ... ON CONFLICT DO NOTHING`(幂等插入)
|
||||
|
||||
## 当前部署状态
|
||||
- **服务器**: 10.80.0.129:18080(G端)
|
||||
- **容器**: 4/4 全部 Up(backend 标记 unhealthy,功能正常)
|
||||
- **前端**: /itdesk/ ✅ /itagent/ ✅
|
||||
- **API**: /api/health ✅
|
||||
- **数据平台**: / 代理到 10.80.0.130:8080(对方 nginx 未配业务,返回默认页)
|
||||
- **待办**: 配置企微回调 URL + 验证
|
||||
|
||||
## Bug 5: API 路由 404 — 双重 `/api` 前缀
|
||||
- **现象**: 所有 API 端点返回 404(curl `/api/test-ping` → 404)
|
||||
- **原因**: nginx `proxy_pass` 已剥离 `/api/` 前缀,但 FastAPI `app.include_router(api_router, prefix="/api")` 又加了一次 → 实际请求路径变成了 `/api/test-ping`(404)
|
||||
- **修复**: main.py 移除 `prefix="/api"` → 仅 `app.include_router(api_router)`
|
||||
- 同时修复了 `@app.get("/api/test-ping")` → `@app.get("/test-ping")` 等直接路由
|
||||
|
||||
## Bug 6: Docker build 网络不通(G端无法访问 deb.debian.org)
|
||||
- **现象**: Docker build 在服务器上超时
|
||||
- **解决**: 本地 Windows 构建镜像 → `docker save` → 上传 tar → 服务器 `docker load -i` 导入
|
||||
|
||||
## 数据库修复 — dify_conversation_id 列缺失
|
||||
- **现象**: H5 AI 对话 500 报错 `column conversations.dify_conversation_id does not exist`
|
||||
- **原因**: 数据库是通过 SQLAlchemy 模型直接创建的(非 alembic 迁移),model 里加了列但 DB 没有
|
||||
- **修复**: `psql -U postgres -d it_smart_desk -c "ALTER TABLE conversations ADD COLUMN IF NOT EXISTS dify_conversation_id VARCHAR(128);"`
|
||||
- **发现**: 服务器 `.env` 不存在,PG 只有 `postgres` 用户(默认值 `wecom` 未生效),数据库名 `it_smart_desk`
|
||||
|
||||
## 反向代理申请清单
|
||||
- 已输出 `反向代理开通申请清单.md`,含 nginx 配置片段、网络要求、防火墙规则
|
||||
- 入口:通过 `it-dataquery.dc.servyou-it.com` 的 `/itdesk/` `/itagent/` `/api/` `/ws/` 路径路由
|
||||
|
||||
## 本地开发环境搭建(2026-06-05 下午)
|
||||
- ✅ SQLite schema 修复:conversations 表 + dify_conversation_id,messages 表 + 6 列
|
||||
- ✅ Python 3.12 venv 搭建,全部依赖安装(含补装的 aiosqlite)
|
||||
- ✅ Docker Redis 本地容器启动(localhost:6379 无密码)
|
||||
- ✅ 后端 FastAPI 启动(localhost:8000,6 核心服务就绪)
|
||||
- ✅ H5 前端 dev server 启动(localhost:5174,.env.development 禁用 OAuth2)
|
||||
- ✅ 核心 AI 对话管道验证通过(H5 → 后端 → Dify → 回复)
|
||||
- ⚠️ AI 回复内容显示 `[object Object]` — Dify 响应解析 bug,待修
|
||||
|
||||
## IT 支持知识库导入快速回复模块
|
||||
- **源文件**:`IT支持知识库2026-4-24.docx`(830 段落,178 个知识条目)
|
||||
- **导入结果**:178 条全部导入 quick_reply_templates 表
|
||||
- **分类分布**:硬件(13)、网络(30)、软件(46)、安全(13)、账号(2)、通用(82)
|
||||
- **Category 映射**:办公电脑→硬件,软件工具→软件,办公设备→硬件,办公网络→网络,终端安全→安全,资产管理+其他业务→通用
|
||||
- **API 验证**:GET /quick-replies 返回 186 条(8 条预置 + 178 条导入)
|
||||
Reference in New Issue
Block a user