diff --git a/go/internal/api/routes/core.go b/go/internal/api/routes/core.go index 6a092f2..3d0a894 100644 --- a/go/internal/api/routes/core.go +++ b/go/internal/api/routes/core.go @@ -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)。