50 lines
2.5 KiB
Go
50 lines
2.5 KiB
Go
package intent
|
|
|
|
// IntentType 核心意图类别定义
|
|
type IntentType string
|
|
|
|
const (
|
|
IntentQueryProgress IntentType = "QUERY_PROGRESS" // 查询进度、成熟度、风险研判或沟通话术
|
|
IntentSupplementInfo IntentType = "SUPPLEMENT_INFO" // 补充/修改材料、事实信息或参数
|
|
IntentAdvanceStage IntentType = "ADVANCE_STAGE" // 确认推进到下一成熟度阶段 (如 V0.1 -> V0.5)
|
|
IntentTriggerTask IntentType = "TRIGGER_TASK" // 显式生成或重新执行特定交付物任务 (如 intake, quote)
|
|
IntentCasualChat IntentType = "CASUAL_CHAT" // 问候、闲聊或通用帮助引导
|
|
)
|
|
|
|
// CandidateIntent 候选意图提案(L1 对话层输出,由 L2 协调层终审)
|
|
type CandidateIntent struct {
|
|
Intent IntentType `json:"intent"`
|
|
Confidence float64 `json:"confidence"` // 置信度 0.0 - 1.0
|
|
FilledSlots map[string]string `json:"filled_slots"`
|
|
MissingSlots []string `json:"missing_slots,omitempty"`
|
|
Reasoning string `json:"reasoning"` // 判断依据与文本佐证
|
|
ClarificationQuestion string `json:"clarification_question,omitempty"` // 槽位缺失时的澄清追问
|
|
}
|
|
|
|
// IntentRecognitionResult 意图识别完整输出(多输出策略)
|
|
type IntentRecognitionResult struct {
|
|
RawInput string `json:"raw_input"`
|
|
TopIntent *CandidateIntent `json:"top_intent"`
|
|
Candidates []CandidateIntent `json:"candidates"`
|
|
ContextSnapshotID string `json:"context_snapshot_id,omitempty"`
|
|
RequiresClarifying bool `json:"requires_clarifying"`
|
|
}
|
|
|
|
// 常见槽位 Key 常量定义
|
|
const (
|
|
SlotTargetStage = "target_stage" // 目标阶段 (如 V0.1_triage, V0.5_feasibility, V1.0_quoting)
|
|
SlotTargetTask = "target_task" // 目标任务 (如 intake, research, cdo_quote)
|
|
SlotFactKey = "fact_key" // 事实键 (如 target_market, device_type)
|
|
SlotFactValue = "fact_value" // 事实值
|
|
SlotSupplementDoc = "supplement_doc" // 补充内容文本
|
|
SlotQueryTopic = "query_topic" // 查询主题 (如 progress, risk, talk_script, quotation)
|
|
)
|
|
|
|
// ContextSnapshot 传递给 L1 意图识别器的轻量上下文快照
|
|
type ContextSnapshot struct {
|
|
SnapshotID string `json:"snapshot_id,omitempty"`
|
|
ProjectName string `json:"project_name,omitempty"`
|
|
CurrentStage string `json:"current_stage,omitempty"`
|
|
AvailableActions []string `json:"available_actions,omitempty"`
|
|
}
|