2026-09-24 02:01:52 +08:00

120 lines
3.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
name: hisense-sept-qa-raw-query
description: >-
Query Hisense September agentic projects for qa_raw and qa_product_raw
(HISENSE-HIST). Before any API call, must confirm BOTH batch date and project
id together. Returns id, project_name, total, qa_raw_list, qa_product_raw_list.
Use when user asks for 9月项目、问答底表、商品卡、qa_raw、qa_product_raw、
HISENSE-HIST、temp0923, or 批次日期 / 项目id.
---
# 海信 9 月 qa_raw / qa_product_raw 查询
`https://resource-api.cemeta.cn` 拉 9 月项目,再按批次查问答底表与商品卡表,组装返回 JSON。
配置:`config/config.dev.yaml``haoxian.base_url` / `haoxian.token`Header `x-token`)。本机可用 `http://localhost:9999` 代替 base路径相同
## 必选前置输入(缺一不可,须同时确认)
**使用本 skill 时,执行任何接口调用之前,必须先同时拿到下面 1 和 2。缺任意一项都停下来两项齐了再继续后续流程。不要猜、不要沿用上次对话默认值、不要只拿到一个就先跑一半。**
| # | 必选项 | 示例 |
|---|--------|------|
| 1 | 查询的批次日期 | `20260919``YYYYMMDD` |
| 2 | 项目 id | `1096` |
**一次性原文提示用户(同一条消息里同时确认两项):**
> 请同时确认后回复:
> 1. 查询的批次日期示例20260919
> 2. 项目id示例1096
用户在同一轮或连续回复中给出 1 和 2 后,再执行下方「执行流程」。若只给了一项,用同样提示补要缺失项,仍不要开查。
## 执行流程
### 1. 拉 9 月项目列表
```
GET {base_url}/api/agentic-project/project?page=1&page_size=999&listed=all
Header: x-token
```
过滤(必须同时满足):
- `listed = 1`
- `status = 'running'`
- `end_month = '2026-09'`
取出全部 `id``project_name`。用用户输入的项目 id 在列表中解析 `project_name`找不到也继续查表name 可为空并注明)。
### 2. 拼接 crawl_batch_id
```
HISENSE-HIST-{project_id}-{批次日期}
```
例:`HISENSE-HIST-1096-20260919`
### 3. 查问答底表 qa_raw
```
GET {base_url}/api/geo_label/l1/qa_raw?project_id={id}&crawl_batch_id={crawl_batch_id}&page=1&page_size=50
Header: x-token
```
翻页直到收齐 `data.total`。接口列表字段为 `data.items`
### 4. 查商品卡表 qa_product_raw
```
GET {base_url}/api/geo_label/l1/qa_product_raw?project_id={id}&crawl_batch_id={crawl_batch_id}&page=1&page_size=50
Header: x-token
```
同样翻页收齐;接口列表字段为 `data.items`
### 5. 组装返回 JSON
**对外不要输出 `items`。** `data.items` 分别映射为:
- qa_raw → `qa_raw_list`
- qa_product_raw → `qa_product_raw_list`
`total`**qa_raw**`data.total`
```json
{
"id": 1096,
"project_name": "500L左右冰箱推荐",
"total": 227,
"code": 0,
"ok": true,
"crawl_batch_id": "HISENSE-HIST-1096-20260919",
"qa_raw_list": [],
"qa_product_raw_list": []
}
```
必须包含:`id``project_name``total``qa_raw_list`(全量明细)、`qa_product_raw_list`(全量明细)。体积大时落盘并告知路径,例如:
`haoxian/skills/temp0923/data/qa_raw_{批次}/{id}_response.json`
## 推荐脚本
```bash
# 可选:刷新 9 月项目缓存
python3 haoxian/skills/temp0923/scripts/query_qa_raw.py list-projects
# 必选参数:--batch、--id
python3 haoxian/skills/temp0923/scripts/query_qa_raw.py project --batch 20260919 --id 1096
```
脚本 stdout 即为上述返回结构。本地缓存目录:`haoxian/skills/temp0923/data/`
## 注意
- Token 只读配置,勿写入 skill、勿提交仓库。
- `total=0` 或空列表均为有效结果。
- 翻页建议 `page_size=50`,失败重试,避免一次过大导致断连。