73 lines
3.2 KiB
Go
73 lines
3.2 KiB
Go
package model
|
|
|
|
// AIStatusResponse 定义前端可见的 AI 服务状态。
|
|
// 该对象只暴露公开信息,不包含密钥和上游鉴权细节。
|
|
type AIStatusResponse struct {
|
|
Enabled bool `json:"enabled"`
|
|
ProviderName string `json:"providerName"`
|
|
Model string `json:"model"`
|
|
Mode string `json:"mode"`
|
|
Message string `json:"message"`
|
|
}
|
|
|
|
// InterpretSlot 定义单个课位的占断上下文。
|
|
// 该对象同时包含取值来源和落宫结果,供后端组装用户消息。
|
|
type InterpretSlot struct {
|
|
Label string `json:"label" binding:"required"`
|
|
Token string `json:"token" binding:"required"`
|
|
Value int `json:"value" binding:"required"`
|
|
Source string `json:"source" binding:"required"`
|
|
SourceNote string `json:"sourceNote" binding:"required"`
|
|
GanZhi string `json:"ganZhi"`
|
|
Palace string `json:"palace" binding:"required"`
|
|
Element string `json:"element" binding:"required"`
|
|
Theme string `json:"theme" binding:"required"`
|
|
Detail string `json:"detail" binding:"required"`
|
|
SlotExplanation string `json:"slotExplanation" binding:"required"`
|
|
}
|
|
|
|
// InterpretRelation 定义四宫之间的生克链路。
|
|
type InterpretRelation struct {
|
|
Kind string `json:"kind" binding:"required"`
|
|
Summary string `json:"summary" binding:"required"`
|
|
}
|
|
|
|
// InterpretSummary 定义前端本地规则得出的摘要结果。
|
|
type InterpretSummary struct {
|
|
Verdict string `json:"verdict" binding:"required"`
|
|
Score int `json:"score" binding:"required"`
|
|
Summary string `json:"summary" binding:"required"`
|
|
DomainLabel string `json:"domainLabel" binding:"required"`
|
|
ChainSummary string `json:"chainSummary"`
|
|
ActionAdvice []string `json:"actionAdvice" binding:"required"`
|
|
RiskAdvice []string `json:"riskAdvice" binding:"required"`
|
|
}
|
|
|
|
// InterpretRequest 定义 AI 解卦请求。
|
|
// 前端只传结构化盘面数据,具体提示词由后端统一维护。
|
|
type InterpretRequest struct {
|
|
Mode string `json:"mode" binding:"required"`
|
|
ModeLabel string `json:"modeLabel" binding:"required"`
|
|
Question string `json:"question" binding:"required"`
|
|
SolarLabel string `json:"solarLabel" binding:"required"`
|
|
LunarLabel string `json:"lunarLabel" binding:"required"`
|
|
MethodNote string `json:"methodNote" binding:"required"`
|
|
FinalPalace string `json:"finalPalace" binding:"required"`
|
|
FinalElement string `json:"finalElement" binding:"required"`
|
|
Slots []InterpretSlot `json:"slots" binding:"required,min=4"`
|
|
Relations []InterpretRelation `json:"relations"`
|
|
LocalInterpretation InterpretSummary `json:"localInterpretation" binding:"required"`
|
|
}
|
|
|
|
// InterpretResponse 定义 AI 解卦响应。
|
|
type InterpretResponse struct {
|
|
Content string `json:"content"`
|
|
}
|
|
|
|
// APIResponse 统一包装 HTTP 返回体。
|
|
// Message 用于说明当前结果或错误原因。
|
|
type APIResponse[T any] struct {
|
|
Data *T `json:"data,omitempty"`
|
|
Message string `json:"message"`
|
|
}
|