277 lines
11 KiB
Markdown
277 lines
11 KiB
Markdown
# Feishu Signal — Web Implementation Plan
|
||
|
||
**Scope:** Web only. No mobile. No Feishu card integration. Core flow only.
|
||
|
||
---
|
||
|
||
## What gets built
|
||
|
||
1. AI pipeline — classify message as project-level or signal-level, route accordingly
|
||
2. Bell panel — decision queue for items needing review
|
||
3. Signal drawer — verify AI output, fix errors, pick next action
|
||
4. Project creation drawer — AI pre-fills new project form from Feishu message
|
||
5. SSTC signal source — display + link to charter
|
||
|
||
## Routing logic (core addition)
|
||
|
||
Every Feishu message goes through a two-step classification:
|
||
|
||
**Step 1 — Level classification (multi-factor, AI综合判断)**
|
||
|
||
AI scores 4 dimensions, each 0–1, then computes weighted average:
|
||
|
||
| Dimension | Weight | Signal of project-level |
|
||
|-----------|--------|------------------------|
|
||
| Build intent | 40% | "我们要做", "需要开发", "立项" etc. |
|
||
| Scope | 25% | Describes a system / product / feature set, not a single task |
|
||
| Timeline | 20% | Explicit deadline or duration mentioned |
|
||
| Owner | 15% | Named responsible person or team |
|
||
|
||
`project_score = weighted average of 4 dimensions`
|
||
`signal_score = 1 - project_score` (not exact inverse, but starting point)
|
||
|
||
If message contains distinct project intent AND distinct signal content (e.g. "let's build X" + "competitor Y just launched Z"), AI splits into 2 separate items and processes each independently. If ambiguous whether to split, default to signal-level — user can promote later.
|
||
|
||
**Step 2 — Routing**
|
||
|
||
```
|
||
project_score ≥ 0.85, cold start over → auto-create project, silent notification to owner
|
||
project_score ≥ 0.85, cold start → pending queue, card type = "New Project"
|
||
project_score 0.60–0.84 → pending queue, card type = "New Project?"
|
||
project_score < 0.60 → treat as signal, route by signal confidence
|
||
|
||
signal confidence ≥ 0.80, cold start over → auto-enter signal source, no badge
|
||
signal confidence < 0.80 or cold start → pending queue, card type = "Signal"
|
||
```
|
||
|
||
Cold start period = first 2 weeks after go-live. No auto-creation or auto-entry during this period regardless of confidence.
|
||
|
||
---
|
||
|
||
## Phase 1 — AI Pipeline (Week 1)
|
||
|
||
### Backend
|
||
|
||
- [ ] On Feishu message received, trigger async AI job
|
||
- [ ] AI job — Step 1: level classification
|
||
- `level` — `project` or `signal`
|
||
- `level_confidence` — float 0–1
|
||
- `level_reasoning` — 1–2 sentences why
|
||
- If message contains both project intent and signal content: split into 2 items, process each separately
|
||
- [ ] AI job — Step 2 (if `level = signal`): signal fields
|
||
- `title` — 1 sentence
|
||
- `type` — one of: 竞品动态 / 用户反馈 / 项目风险 / 新需求
|
||
- `priority` — P0–P3
|
||
- `matched_project_id` — existing project this signal belongs to (null if new project)
|
||
- `summary` — 2–3 sentences
|
||
- `reasoning` — 3 bullets
|
||
- `confidence` — float 0–1
|
||
- `recommended_action` — one of: enter_only / create_charter / trigger_alert
|
||
- [ ] AI job — Step 2 (if `level = project`): project pre-fill fields
|
||
- `suggested_name` — project name extracted from message
|
||
- `suggested_description` — 1–2 sentences
|
||
- `suggested_owner` — extracted from message or inferred
|
||
- `suggested_timeline` — extracted deadline or duration
|
||
- `confidence` — float 0–1
|
||
- `reasoning` — 3 bullets
|
||
- [ ] Routing logic:
|
||
- Cold start (first 2 weeks): all items → pending queue, no auto-creation or auto-entry
|
||
- `project_score ≥ 0.85`, cold start over → auto-create project, silent in-app notification to owner, no badge
|
||
- `project_score 0.60–0.84` → pending queue, bell badge +1, card type = "New Project?"
|
||
- `project_score < 0.60` → treat as signal
|
||
- Signal: `confidence ≥ 0.80`, cold start over → auto-enter signal source, no badge
|
||
- Signal: `confidence < 0.80` or cold start → pending queue, bell badge +1
|
||
- [ ] Auto-create project flow: create project with AI pre-filled fields → initialize SSTC board → assign owner → silent in-app notification: "已自动创建项目 [name],点击查看"
|
||
- [ ] Auto-enter signal flow: create signal node → insert into matched project signal source → generate charter draft (not submitted) → silent in-app notification to project owner
|
||
- [ ] Store: raw Feishu message + AI output + confidence + all edits + reasoning, bound to unique item node ID
|
||
|
||
### DB
|
||
|
||
- [ ] `feishu_items` table: id / feishu_message_id / project_score / signal_confidence / raw_message / split_from_item_id (nullable, for split items) / created_at
|
||
- [ ] `signals` table: id / feishu_item_id / matched_project_id / title / type / priority / summary / reasoning / confidence / recommended_action / status / created_at
|
||
- [ ] `signal_edits` table: signal_id / field / old_value / new_value / edited_by / edited_at
|
||
- [ ] `project_suggestions` table: id / feishu_item_id / suggested_name / suggested_description / suggested_owner / suggested_timeline / confidence / reasoning / status / created_at
|
||
- [ ] Add `signal_id` foreign key to `charters` table
|
||
|
||
---
|
||
|
||
## Phase 2 — Bell Panel (Week 1)
|
||
|
||
### Frontend
|
||
|
||
Bell panel opens as 360px dropdown from top-right bell icon.
|
||
|
||
**Two sections:**
|
||
|
||
**Pending** (default, expanded)
|
||
- Mixed list of project-level and signal-level items, sorted by priority desc then time
|
||
- **Project card — medium confidence (0.60–0.84)** (blue left border, user must confirm):
|
||
- Row 1: 🏗 "New Project?" badge + relative time
|
||
- Row 2: suggested project name (1 line)
|
||
- Row 3: AI reasoning in 1 line + confidence score
|
||
- Actions: `Create Project` (primary) · `Open` (ghost) · `Dismiss` (ghost)
|
||
- `Create Project` → opens Project Creation Drawer (pre-filled by AI)
|
||
- `Open` → opens Project Creation Drawer
|
||
- **Project card — auto-created (≥0.85, shown in auto-processed section)**:
|
||
- Read-only. Shows "Auto-created [project name]" + `Undo` option
|
||
- **Signal card** (existing design):
|
||
- Row 1: priority badge + type + matched project name + relative time
|
||
- Row 2: signal title (1 line, truncated)
|
||
- Row 3: AI uncertainty reason
|
||
- Actions: `Confirm` (primary) · `Open` (ghost) · `Dismiss` (ghost)
|
||
- `Confirm` → enters signal into matched project's signal source, badge -1
|
||
- `Open` → opens Signal Drawer
|
||
- `Dismiss` on either type → inline reason picker, then archives
|
||
- Clicking project name pill on signal card → popover to switch matched project
|
||
|
||
**Auto-processed** (collapsed by default)
|
||
- Summary line: "X signals auto-entered, Y projects auto-created today"
|
||
- Expand shows read-only cards with `Undo` option per card
|
||
- Undo auto-created project: project moves to pending queue as "New Project?" card
|
||
|
||
**Badge rules:**
|
||
- Red number = pending count only
|
||
- Clears per item on confirm/dismiss
|
||
- No badge for auto-processed signals
|
||
|
||
---
|
||
|
||
## Phase 3 — Project Creation Drawer (Week 2)
|
||
|
||
Slides in from right, 480px wide, full page height. Only opened for project-level items.
|
||
|
||
### Content
|
||
|
||
Top sticky header:
|
||
```
|
||
🏗 New Project Detected
|
||
From: [Feishu group] · [sender] · [time]
|
||
```
|
||
|
||
**AI pre-filled fields** (all editable inline):
|
||
- Project name (from `suggested_name`)
|
||
- Description (from `suggested_description`)
|
||
- Owner (from `suggested_owner`, dropdown to change)
|
||
- Timeline (from `suggested_timeline`, date picker)
|
||
|
||
**AI reasoning** (collapsed by default)
|
||
- Toggle: "Why AI thinks this is a new project ▾"
|
||
- 3 bullets, plain language
|
||
|
||
**Original Feishu message** (collapsed by default)
|
||
|
||
**Fix section** — if AI pre-fill is wrong:
|
||
| Button | Opens |
|
||
|--------|-------|
|
||
| Not a new project | Converts to signal → opens Signal Drawer |
|
||
| Wrong project name | Inline text edit |
|
||
| Wrong owner | User dropdown |
|
||
| Wrong timeline | Date picker |
|
||
|
||
Bottom bar (full width, fixed):
|
||
- `Create Project` (primary) — creates project with pre-filled fields, redirects to new project's SSTC board
|
||
- `Save as Draft` — saves without redirecting
|
||
- `Cancel` — closes drawer, item stays in pending queue
|
||
|
||
Slides in from right, 480px wide, full page height. Same component opened from bell, SSTC board, charter page.
|
||
|
||
### Tab 1 — AI Result (default)
|
||
|
||
Top sticky header:
|
||
```
|
||
[type pill] [project pill] [priority pill]
|
||
Signal title (editable inline)
|
||
From: [Feishu group] · [sender] · [time]
|
||
```
|
||
All 3 pills tappable → popover to change value, saves immediately.
|
||
|
||
Body:
|
||
|
||
**AI Summary** — 2–3 sentences, editable inline. Click to edit, click away to save.
|
||
|
||
**Reasoning** (collapsed by default)
|
||
- Toggle: "Why AI classified it this way ▾"
|
||
- 3 bullet points, plain language
|
||
- Exists to catch errors, not to show off
|
||
|
||
**Original Feishu message** (collapsed by default)
|
||
- Toggle: "View original message ▾"
|
||
- Raw message + 3 messages of context
|
||
- "Open in Feishu ↗" link
|
||
|
||
Bottom bar:
|
||
- `Looks good →` — goes to Tab 3
|
||
- `Something's wrong` — goes to Tab 2
|
||
|
||
### Tab 2 — Fix
|
||
|
||
6 preset buttons (covers ~95% of correction cases):
|
||
|
||
| Button | Opens |
|
||
|--------|-------|
|
||
| Wrong project | Project dropdown |
|
||
| Wrong signal type | Type selector |
|
||
| Wrong priority | Priority selector |
|
||
| Summary is wrong | Text input with current summary pre-filled |
|
||
| Wrong recommended action | Action selector |
|
||
| Other | Free text input (fallback only) |
|
||
|
||
After any selection → AI updates immediately → shows "Updated. Check Tab 1 to verify →"
|
||
No apology message from AI. Just the result.
|
||
|
||
### Tab 3 — Next Action
|
||
|
||
Three radio options:
|
||
|
||
**A. Enter signal source only** (default)
|
||
Signal enters SSTC board signal source list. No charter created.
|
||
|
||
**B. Enter + create charter draft**
|
||
AI pre-fills: goal (from summary) / background (from core facts) / scope (inferred).
|
||
Charter preview slides in as a second layer on top of drawer. Confirm to save.
|
||
|
||
**C. Enter + trigger risk alert**
|
||
Creates risk alert, sends Feishu notification to project owner.
|
||
|
||
Confirm button (full width, fixed bottom): "Enter into [project name]"
|
||
Closes drawer on confirm, shows toast.
|
||
|
||
---
|
||
|
||
## Phase 4 — SSTC Integration (Week 2)
|
||
|
||
### Signal source list (existing page)
|
||
- [ ] Each signal card shows: title · type badge · source (Feishu) · status
|
||
- [ ] Status values: 待处理 / 已关联宪章 / 已关闭
|
||
- [ ] Click any card → opens Signal Drawer (Tab 1)
|
||
|
||
### Charter linkage
|
||
- [ ] Charter detail page: top banner "来源信号: [title] ↗" → opens Signal Drawer read-only
|
||
- [ ] Signal card status → "已关联宪章 [charter name]" after charter created
|
||
- [ ] When charter goes active → signal status auto-updates to 已关闭
|
||
|
||
---
|
||
|
||
## Phase 5 — Polish & Test (Week 3)
|
||
|
||
- [ ] Cold start → mature period threshold transition logic (admin toggle in project settings)
|
||
- [ ] Signal edit history view (in drawer, accessible via small "History" link)
|
||
- [ ] Undo auto-enter from auto-processed section
|
||
- [ ] Empty states for bell panel (no pending, no auto-processed)
|
||
- [ ] Error states (AI job failed, Feishu connection lost)
|
||
- [ ] End-to-end test A (signal flow): Feishu message → AI classifies as signal → bell badge → confirm → signal source → charter
|
||
- [ ] End-to-end test B (project flow): Feishu message → AI classifies as project → bell badge → open drawer → create project → SSTC board
|
||
- [ ] End-to-end test C (split): Feishu message with both intent → AI splits into 2 items → both appear in bell → handled independently
|
||
|
||
---
|
||
|
||
## Out of scope (v1)
|
||
|
||
- Mobile
|
||
- Feishu interactive card integration
|
||
- Feishu bot conversation
|
||
- AI model retraining UI
|
||
- Signal deduplication UI
|
||
- Analytics / reports
|
||
- Auto-close rule engine
|