fix(standing): paginate 也豁免 standing_answer 配额;纯卡片页不吞
capRecallResults 已让 standing_answer 不占 limit 配额,但 paginateRecallWithCarry 仍按 Category 把卡片算进 main,main[:limit] 又会切掉第 5 条记忆 (日报怎么写才不算空壳:DA 在 rank5 被挤掉,主尺 -1 题)。 另修 mainLen==0 时纯卡片页返回空页 ⇒ 精确命中只回卡时卡被整条吞。 配对实测:on=0.5575 off=0.5575 差=+0.0000 变动 0 题(此前 -0.0119)。
This commit is contained in:
@@ -1781,11 +1781,15 @@ func capRecallResults(results []models.RecallResult, limit int) (prim, expanded
|
||||
// ⇒ offset > 0 时只回主路段,不追加 carry。
|
||||
func paginateRecallWithCarry(results []models.RecallResult, offset int, prevIDs []string, limit int) ([]models.RecallResult, int) {
|
||||
var carry []models.RecallResult
|
||||
var front []models.RecallResult // standing_answer:答案置顶、不占主结果配额
|
||||
main := make([]models.RecallResult, 0, len(results))
|
||||
for _, r := range results {
|
||||
if r.Category == "pattern" || r.Category == "peer" {
|
||||
switch r.Category {
|
||||
case "pattern", "peer":
|
||||
carry = append(carry, r)
|
||||
} else {
|
||||
case "standing_answer":
|
||||
front = append(front, r)
|
||||
default:
|
||||
main = append(main, r)
|
||||
}
|
||||
}
|
||||
@@ -1814,14 +1818,19 @@ func paginateRecallWithCarry(results []models.RecallResult, offset int, prevIDs
|
||||
}
|
||||
mainLen := len(main)
|
||||
if mainLen == 0 {
|
||||
// 与旧语义一致:主路段空 ⇒ 整页空(页面上只有注入条目没有意义)
|
||||
// 主路段空:若只有常设卡(精确通道命中即只回卡),卡本身就是有效答案,不能吞掉;
|
||||
// 含 pattern/peer 的纯注入页仍按旧语义返回空页。
|
||||
if len(front) > 0 {
|
||||
return front, 0
|
||||
}
|
||||
return []models.RecallResult{}, 0
|
||||
}
|
||||
if offset > 0 {
|
||||
// t_2891d689:carry 只在第一页出现,续页不回尾(见函数头注释 ②)
|
||||
return main, mainLen
|
||||
}
|
||||
return append(main, carry...), mainLen
|
||||
out := append(front, main...)
|
||||
return append(out, carry...), mainLen
|
||||
}
|
||||
|
||||
// shouldEmitContinuation —— P0-3 是否发放下一页 continuation 令牌(2026-11-02 t_2891d689)。
|
||||
|
||||
Reference in New Issue
Block a user