This commit is contained in:
+74
-22
@@ -194,29 +194,76 @@ type Decision struct {
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
// RuleCheck is a machine-readable explanation of one deterministic decision gate.
|
||||
// Status is one of: pass, fail, warn, info, na.
|
||||
type RuleCheck struct {
|
||||
Code string `json:"code"`
|
||||
Group string `json:"group,omitempty"`
|
||||
Label string `json:"label"`
|
||||
Status string `json:"status"`
|
||||
Blocking bool `json:"blocking,omitempty"`
|
||||
Actual string `json:"actual,omitempty"`
|
||||
Expected string `json:"expected,omitempty"`
|
||||
Detail string `json:"detail,omitempty"`
|
||||
}
|
||||
|
||||
// KnowledgeDiagnostic explains why one knowledge article was or was not
|
||||
// considered for a specific ticket run. The score is recalculated against the
|
||||
// current knowledge index; CurrentTicketChanged tells the UI when the ticket has
|
||||
// changed since the historical run.
|
||||
type KnowledgeDiagnostic struct {
|
||||
RunID string `json:"run_id"`
|
||||
TicketID int64 `json:"ticket_id"`
|
||||
KnowledgeID string `json:"knowledge_id"`
|
||||
Title string `json:"title"`
|
||||
Source string `json:"source"`
|
||||
CurrentTicketChanged bool `json:"current_ticket_changed"`
|
||||
RetrievalRank int `json:"retrieval_rank"`
|
||||
RetrievalScore float64 `json:"retrieval_score"`
|
||||
SemanticScore float64 `json:"semantic_score,omitempty"`
|
||||
TitleScore float64 `json:"title_score,omitempty"`
|
||||
LexicalScore float64 `json:"lexical_score,omitempty"`
|
||||
KeywordScore float64 `json:"keyword_score,omitempty"`
|
||||
CategoryScore float64 `json:"category_score,omitempty"`
|
||||
CandidateCutoff float64 `json:"candidate_cutoff,omitempty"`
|
||||
SentToAI bool `json:"sent_to_ai"`
|
||||
SelectionReason string `json:"selection_reason"`
|
||||
AISelected bool `json:"ai_selected"`
|
||||
EvidenceScore float64 `json:"evidence_score,omitempty"`
|
||||
RequiredScore float64 `json:"required_score,omitempty"`
|
||||
BestChunkExcerpt string `json:"best_chunk_excerpt,omitempty"`
|
||||
BestQueryExcerpt string `json:"best_query_excerpt,omitempty"`
|
||||
ExternalCategories []string `json:"external_categories,omitempty"`
|
||||
UnmappedCategories []string `json:"unmapped_categories,omitempty"`
|
||||
Checks []RuleCheck `json:"checks"`
|
||||
Document KnowledgeDoc `json:"document"`
|
||||
}
|
||||
|
||||
type PolicyResult struct {
|
||||
ChangeCategory bool `json:"change_category"`
|
||||
CategoryID int64 `json:"category_id"`
|
||||
CategoryRecommendationID int64 `json:"category_recommendation_id"`
|
||||
CategoryRecommendationName string `json:"category_recommendation_name,omitempty"`
|
||||
CategoryConfidence float64 `json:"category_confidence"`
|
||||
CategoryThreshold float64 `json:"category_threshold"`
|
||||
CategoryDecision string `json:"category_decision"`
|
||||
Reply bool `json:"reply"`
|
||||
ReplyText string `json:"reply_text,omitempty"`
|
||||
ReplyIsHTML bool `json:"reply_is_html,omitempty"`
|
||||
KnowledgeID string `json:"knowledge_id,omitempty"`
|
||||
ReplyRecommendation bool `json:"reply_recommendation"`
|
||||
ReplyConfidence float64 `json:"reply_confidence"`
|
||||
ReplyThreshold float64 `json:"reply_threshold"`
|
||||
ReplyKnowledgeID string `json:"reply_knowledge_id,omitempty"`
|
||||
ReplyDecision string `json:"reply_decision"`
|
||||
KnowledgeThreshold float64 `json:"knowledge_threshold,omitempty"`
|
||||
KnowledgeRetrievalScore float64 `json:"knowledge_retrieval_score,omitempty"`
|
||||
KnowledgeEvidenceScore float64 `json:"knowledge_evidence_score,omitempty"`
|
||||
KnowledgeRetrievalFloor float64 `json:"knowledge_retrieval_floor,omitempty"`
|
||||
KnowledgeCategoryAligned bool `json:"knowledge_category_aligned,omitempty"`
|
||||
AIReason string `json:"ai_reason,omitempty"`
|
||||
ChangeCategory bool `json:"change_category"`
|
||||
CategoryID int64 `json:"category_id"`
|
||||
CategoryRecommendationID int64 `json:"category_recommendation_id"`
|
||||
CategoryRecommendationName string `json:"category_recommendation_name,omitempty"`
|
||||
CategoryConfidence float64 `json:"category_confidence"`
|
||||
CategoryThreshold float64 `json:"category_threshold"`
|
||||
CategoryDecision string `json:"category_decision"`
|
||||
Reply bool `json:"reply"`
|
||||
ReplyText string `json:"reply_text,omitempty"`
|
||||
ReplyIsHTML bool `json:"reply_is_html,omitempty"`
|
||||
KnowledgeID string `json:"knowledge_id,omitempty"`
|
||||
ReplyRecommendation bool `json:"reply_recommendation"`
|
||||
ReplyConfidence float64 `json:"reply_confidence"`
|
||||
ReplyThreshold float64 `json:"reply_threshold"`
|
||||
ReplyKnowledgeID string `json:"reply_knowledge_id,omitempty"`
|
||||
ReplyDecision string `json:"reply_decision"`
|
||||
KnowledgeThreshold float64 `json:"knowledge_threshold,omitempty"`
|
||||
KnowledgeRetrievalScore float64 `json:"knowledge_retrieval_score,omitempty"`
|
||||
KnowledgeEvidenceScore float64 `json:"knowledge_evidence_score,omitempty"`
|
||||
KnowledgeRetrievalFloor float64 `json:"knowledge_retrieval_floor,omitempty"`
|
||||
KnowledgeCategoryAligned bool `json:"knowledge_category_aligned,omitempty"`
|
||||
AIReason string `json:"ai_reason,omitempty"`
|
||||
CategoryChecks []RuleCheck `json:"category_checks,omitempty"`
|
||||
ReplyChecks []RuleCheck `json:"reply_checks,omitempty"`
|
||||
}
|
||||
|
||||
// KnowledgeCandidateAudit captures the top retrieval candidates used for a run.
|
||||
@@ -238,6 +285,8 @@ type KnowledgeCandidateAudit struct {
|
||||
QueryChunkCount int `json:"query_chunk_count,omitempty"`
|
||||
DocumentChunkCount int `json:"document_chunk_count,omitempty"`
|
||||
SentToAI bool `json:"sent_to_ai,omitempty"`
|
||||
RetrievalRank int `json:"retrieval_rank,omitempty"`
|
||||
SelectionReason string `json:"selection_reason,omitempty"`
|
||||
}
|
||||
|
||||
// ContextAuditItem is a compact snapshot of context that influenced a run.
|
||||
@@ -261,6 +310,9 @@ type RunRecord struct {
|
||||
Reason string `json:"reason"`
|
||||
AIReason string `json:"ai_reason,omitempty"`
|
||||
PolicyReason string `json:"policy_reason,omitempty"`
|
||||
CategoryChecks []RuleCheck `json:"category_checks,omitempty"`
|
||||
ReplyChecks []RuleCheck `json:"reply_checks,omitempty"`
|
||||
ExecutionChecks []RuleCheck `json:"execution_checks,omitempty"`
|
||||
CategoryBefore int64 `json:"category_before"`
|
||||
CategoryBeforeName string `json:"category_before_name,omitempty"`
|
||||
AIRecommendedCategoryID int64 `json:"ai_recommended_category_id,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user