feat: 新增错误重试记忆表/entity/consts

This commit is contained in:
2026-09-01 10:19:58 +08:00
parent 1ca25abca0
commit e78b914b0b
3 changed files with 63 additions and 1 deletions
+37
View File
@@ -0,0 +1,37 @@
package entity
import "gitea.redpowerfuture.com/red-future/common/beans"
type errorMemoryCol struct {
beans.SQLBaseCol
MemoryKey string
Upstream string
ErrorCode string
MsgFingerprint string
Retryable string
Reason string
AnalyzedBy string
}
var ErrorMemoryCol = errorMemoryCol{
SQLBaseCol: beans.DefSQLBaseCol,
MemoryKey: "memory_key",
Upstream: "upstream",
ErrorCode: "error_code",
MsgFingerprint: "msg_fingerprint",
Retryable: "retryable",
Reason: "reason",
AnalyzedBy: "analyzed_by",
}
// ErrorMemory 错误重试记忆(LLM 分析结论持久化,永久有效)
type ErrorMemory struct {
beans.SQLBaseDO `orm:",inline"`
MemoryKey string `orm:"memory_key" json:"memoryKey" dc:"记忆键=SHA-256(upstream|code|归一化消息)"`
Upstream string `orm:"upstream" json:"upstream" dc:"失败上游BaseURL"`
ErrorCode string `orm:"error_code" json:"errorCode" dc:"错误码"`
MsgFingerprint string `orm:"msg_fingerprint" json:"msgFingerprint" dc:"归一化消息md5"`
Retryable bool `orm:"retryable" json:"retryable" dc:"是否可重试"`
Reason string `orm:"reason" json:"reason" dc:"分析原因"`
AnalyzedBy string `orm:"analyzed_by" json:"analyzedBy" dc:"分析模型名"`
}