vault backup: 2025-12-09 10:53:17

This commit is contained in:
imac-maxwell 2025-12-09 10:53:17 +08:00
parent e262aaaf4c
commit f1e6994975
3 changed files with 13 additions and 7 deletions

View File

@ -58,9 +58,10 @@
### 3.1 自动打标流程
1. **任务获取**: 查询 `questions` 表,条件:`enrich_status='pending'`。
2. **构建 Payload**: 拼接 `ocr_text` (含公式/图片链接) 和 `answer_md`
3. **调用 API**: 发送 HTTP POST 请求给 `summary_api`
4. **结果处理**:
2. Write-Protect (写保护)。IF question.is_reviewed == True: UPDATE ONLY raw_fields; ELSE: UPDATE raw_fields AND updated_fields;
3. **构建 Payload**: 拼接 `ocr_text` (含公式/图片链接) 和 `answer_md`
4. **调用 API**: 发送 HTTP POST 请求给 `summary_api`
5. **结果处理**:
* **成功**:
* 将返回的 JSON 填入 `knowledges`, `methods`, `problem_summary` 字段。
* 同时将这些值 **Copy** 一份给 `updated_knowledges`, `updated_methods` (作为人工审核的默认值)。

View File

@ -50,8 +50,8 @@ CREATE TABLE documents (
uploader_id BIGINT, -- 上传用户ID
-- 转换状态缓存 (指向最新的 Markdown 结果)
latest_parse_status VARCHAR(32) DEFAULT 'none', -- none, processing, success, failed
latest_result_url VARCHAR(512), -- 解析后的 Markdown MinIO 地址
markdown_status VARCHAR(32) DEFAULT 'none', -- none, processing, success, failed
markdown_url VARCHAR(512), -- 解析后的 Markdown MinIO 地址
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
@ -75,6 +75,7 @@ CREATE TABLE conversion_tasks (
status VARCHAR(32) NOT NULL, -- queued, processing, success, failed
result_url VARCHAR(512), -- 结果文件下载地址
error_msg TEXT, -- 错误日志
config_snapshot(JSONB), -- 记录当时转换时的参数 template_id, force_ocr, chunk_size 方便排错。
-- 性能指标
worker_node VARCHAR(64), -- 处理该任务的 Worker 节点名
@ -144,6 +145,7 @@ CREATE INDEX idx_q_doc ON questions(document_id);
CREATE INDEX idx_q_enrich_status ON questions(enrich_status) WHERE enrich_status = 'pending'; -- 任务队列轮询优化
CREATE INDEX idx_q_knowledges ON questions USING GIN (knowledges); -- 支持 JSON 数组搜索
CREATE INDEX idx_q_hash ON questions(content_hash);
CREATE INDEX idx_q_is_reviewed ON questions(is_reviewed); -- (方便 KES 过滤保护)。
```
#### Table: `extraction_tasks` (提取任务记录)

View File

@ -107,9 +107,12 @@
}
```
* **Logic**:
1. 检查 `documents` 表中该文档是否存在且 `parse_result_url` (Markdown) 是否就绪。
2. 创建 `extraction_task`
3. 推送到 Redis 队列 `llm-extraction-queue`
2. 检查 documents.markdown_status == 'success'.
3. **Clean-up Strategy**: "If force_refresh=True or existing questions found, DELETE old questions for this doc_id before processing."
4. 创建 `extraction_task`
5. 推送到 Redis 队列 `llm-extraction-queue`
* **Response**: `{"task_id": "...", "status": "queued"}`
### 5.2 查询提取状态