123 lines
2.8 KiB
Python
123 lines
2.8 KiB
Python
# AI_CHANGELOG
|
||
# - 2026-03-20 | Prompt: M4 emoji 注释修复 | heart_emoji 注释从旧 3 级(❤️/💛/🤍)
|
||
# 改为 P6 权威定义的 4 级(💖/🧡/💛/💙),与 compute_heart_icon() 实际逻辑对齐。
|
||
|
||
from __future__ import annotations
|
||
|
||
from app.schemas.base import CamelModel
|
||
|
||
|
||
class PerformanceMetrics(CamelModel):
|
||
monthly_hours: float
|
||
monthly_salary: float
|
||
customer_balance: float
|
||
tasks_completed: int
|
||
perf_current: float
|
||
perf_target: float
|
||
|
||
|
||
class IncomeItem(CamelModel):
|
||
label: str
|
||
amount: str
|
||
color: str
|
||
|
||
|
||
class IncomeSection(CamelModel):
|
||
this_month: list[IncomeItem] = []
|
||
last_month: list[IncomeItem] = []
|
||
|
||
|
||
class CoachTaskItem(CamelModel):
|
||
type_label: str
|
||
type_class: str
|
||
customer_name: str
|
||
customer_id: int | None = None
|
||
note_count: int = 0
|
||
pinned: bool = False
|
||
notes: list[dict] | None = None
|
||
|
||
|
||
class AbandonedTask(CamelModel):
|
||
customer_name: str
|
||
reason: str
|
||
|
||
|
||
class TopCustomer(CamelModel):
|
||
id: int
|
||
name: str
|
||
initial: str
|
||
avatar_gradient: str
|
||
# CHANGE 2026-03-20 | M4 修复: emoji 注释与 P6 权威定义对齐(4 级映射)
|
||
# intent: 注释应反映 compute_heart_icon() 的实际 4 级映射(💖🧡💛💙)
|
||
heart_emoji: str # 💖 / 🧡 / 💛 / 💙
|
||
score: str
|
||
score_color: str
|
||
service_count: int
|
||
balance: str
|
||
consume: str
|
||
|
||
|
||
class CoachServiceRecord(CamelModel):
|
||
customer_id: int | None = None
|
||
customer_name: str
|
||
initial: str
|
||
avatar_gradient: str
|
||
type: str
|
||
type_class: str
|
||
table: str | None = None
|
||
duration: str
|
||
income: str
|
||
date: str
|
||
perf_hours: str | None = None
|
||
|
||
|
||
class HistoryMonth(CamelModel):
|
||
month: str
|
||
estimated: bool
|
||
customers: str
|
||
hours: str
|
||
salary: str
|
||
callback_done: int
|
||
recall_done: int
|
||
|
||
|
||
class CoachNoteItem(CamelModel):
|
||
id: int
|
||
content: str
|
||
timestamp: str
|
||
score: int | None = None
|
||
customer_name: str
|
||
tag_label: str
|
||
created_at: str
|
||
|
||
|
||
class CoachDetailResponse(CamelModel):
|
||
"""COACH-1 响应。"""
|
||
# 基础信息
|
||
id: int
|
||
name: str
|
||
avatar: str
|
||
level: str
|
||
skills: list[str] = []
|
||
work_years: float = 0
|
||
customer_count: int = 0
|
||
hire_date: str | None = None
|
||
# 绩效
|
||
performance: PerformanceMetrics
|
||
# 收入
|
||
income: IncomeSection
|
||
# 档位
|
||
tier_nodes: list[float] = []
|
||
# 任务分组
|
||
visible_tasks: list[CoachTaskItem] = []
|
||
hidden_tasks: list[CoachTaskItem] = []
|
||
abandoned_tasks: list[AbandonedTask] = []
|
||
# TOP 客户
|
||
top_customers: list[TopCustomer] = []
|
||
# 近期服务记录
|
||
service_records: list[CoachServiceRecord] = []
|
||
# 历史月份
|
||
history_months: list[HistoryMonth] = []
|
||
# 备注
|
||
notes: list[CoachNoteItem] = []
|