feat(Ask): 检索过程可视化 — RAG 命中记录以 chips 展示,生成前先看见
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
22
康康Tests/RetrievalSummaryTests.swift
Normal file
22
康康Tests/RetrievalSummaryTests.swift
Normal file
@@ -0,0 +1,22 @@
|
||||
import Testing
|
||||
@testable import 康康
|
||||
|
||||
struct RetrievalSummaryTests {
|
||||
|
||||
@Test func groupsAndCountsPreservingOrder() {
|
||||
let chips = HealthExportService.RetrievalSummary.groupedChips(
|
||||
["血压", "血糖", "血压", "血压", "体重"], cap: 8)
|
||||
#expect(chips == ["血压 ×3", "血糖", "体重"])
|
||||
}
|
||||
|
||||
@Test func capsAndAppendsOverflow() {
|
||||
let names = (1...12).map { "指标\($0)" }
|
||||
let chips = HealthExportService.RetrievalSummary.groupedChips(names, cap: 8)
|
||||
#expect(chips.count == 9)
|
||||
#expect(chips.last == "+4")
|
||||
}
|
||||
|
||||
@Test func emptyInputGivesEmptyChips() {
|
||||
#expect(HealthExportService.RetrievalSummary.groupedChips([], cap: 8).isEmpty)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user