thread-master/docs/product/brand-product-radar/tasks/T741-product-demand-term-su...

54 lines
1.7 KiB
Markdown
Raw Normal View History

2026-08-13 02:22:24 +00:00
# T741 — product demand term suggestions
> Status: `done`
> Milestone: `M4` · Phase C
> Kind: `feat` · Est. change: `~180 lines`
## Goal
依選定 BrandProduct 產出可追溯 basis 的需求詞與排除詞,而不是只搜尋品牌/產品名。
## Depends on
- T740
## Inputs
- `apps/backend/internal/module/radar/usecase/suggest.go`
- `../spec.md` §4.1、§5.2
- Threads searchable short-term rules
## Outputs
| 路徑 | 動作 | 說明 |
|------|------|------|
| `apps/backend/internal/module/radar/usecase/suggest.go` | edit | product context promptfallbackbasis output |
| `apps/backend/internal/logic/radar/suggest_watch_terms_logic.go` | edit | 成對 IDs 與 mapping |
| suggestion tests | edit/add | pain/scenario/include/excludeshort-term cases |
## Behavior
- basis_kind 只來自 audiencepaincontexttagcapabilityexclude。
- 品牌名與產品名只能輔助,不得是唯一建議理由。
- AI 失敗時明確錯誤或合法 fallback不回空成功計費沿用 radar.suggest。
## Out of scope
- 建立 watchT750
- 自動採用建議
## Acceptance
- [x] 每個 include suggestion 有 basis全部通過短詞規則。
```bash
cd apps/backend && go test ./internal/module/radar/usecase/... ./internal/logic/radar/... -count=1
```
Implementation result (2026-08-10): paired BrandProduct requests now load an
immutable owned context, charge through `radar.suggest`, and return traceable
`basis_kind``basis_text`. Provider responses are structurally filtered; when
AI is unavailable or unusable, deterministic catalog terms are returned with
the same short-term and provenance rules. Unpaired IDs and empty fallback
contexts fail explicitly.