根据提供的code differences信息,我发现没有具体的代码变更内容。因此生成一个通用的commit message:

```
docs(readme): 更新文档说明

- 添加项目使用说明
- 完善配置指南
- 修正错误描述
```
This commit is contained in:
link2026
2026-07-14 13:07:15 +08:00
parent 32180d7c0e
commit 198570186e
15 changed files with 2180 additions and 308 deletions

View File

@@ -0,0 +1,103 @@
import Testing
@testable import
/// prompt :/线
/// dataJSON /no_think
/// DiaryOrganizePromptTests :,
struct DiaryChatPromptTests {
///
private let dataJSON = #"{"indicators":[{"name":"","value":"145"}]}"#
// MARK: (roundsLeft == 0)
@Test func replyAtZeroRoundsForbidsFurtherQuestions() {
let prompt = DiaryChatPrompts.reply(
transcript: "我: 我今天头疼",
latest: "我头疼",
dataJSON: dataJSON,
roundsLeft: 0
)
#expect(prompt.contains("不要再提任何问题"))
#expect(!prompt.contains("最多问 1 个新问题"))
}
// MARK: (roundsLeft > 0)
@Test func replyWithRoundsLeftAllowsOneMoreQuestion() {
let prompt = DiaryChatPrompts.reply(
transcript: "我: 我今天头疼",
latest: "我头疼",
dataJSON: dataJSON,
roundsLeft: 2
)
#expect(prompt.contains("最多问 1 个新问题"))
#expect(!prompt.contains("不要再提任何问题"))
}
// MARK: 线 + dataJSON (opening reply )
@Test func openingCarriesNoReferralRuleAndEmbedsDataJSON() {
let prompt = DiaryChatPrompts.opening(dataJSON: dataJSON)
#expect(prompt.contains("不写「建议就医」"))
#expect(prompt.contains(dataJSON))
}
@Test func replyCarriesNoReferralRuleAndEmbedsDataJSON() {
let prompt = DiaryChatPrompts.reply(
transcript: "我: 我今天头疼",
latest: "我头疼",
dataJSON: dataJSON,
roundsLeft: 1
)
#expect(prompt.contains("不写「建议就医」"))
#expect(prompt.contains(dataJSON))
}
// MARK: prompt
@Test func distillContainsUserOnlyAndForbiddenRule() {
let prompt = DiaryChatPrompts.distill(transcript: "我: 我今天头疼\n康康: 收到")
#expect(prompt.contains("只取「我:」"))
#expect(prompt.contains("绝对不许"))
}
// MARK: prompt trim /no_think
@Test func openingEndsWithNoThink() {
let prompt = DiaryChatPrompts.opening(dataJSON: dataJSON)
#expect(prompt.trimmingCharacters(in: .whitespacesAndNewlines).hasSuffix("/no_think"))
}
@Test func replyEndsWithNoThink() {
let prompt = DiaryChatPrompts.reply(
transcript: "我: 我今天头疼",
latest: "我头疼",
dataJSON: dataJSON,
roundsLeft: 1
)
#expect(prompt.trimmingCharacters(in: .whitespacesAndNewlines).hasSuffix("/no_think"))
}
@Test func distillEndsWithNoThink() {
let prompt = DiaryChatPrompts.distill(transcript: "我: 我今天头疼")
#expect(prompt.trimmingCharacters(in: .whitespacesAndNewlines).hasSuffix("/no_think"))
}
// MARK: 稿 distillTranscriptLimit(2000)
@Test func distillTruncatesTranscriptBeyondLimit() {
// 2000 ; 2500
let earlyMark = "起始标记AAA"
let lateMark = "越限标记ZZZ"
let transcript = earlyMark
+ String(repeating: "", count: 2500 - earlyMark.count) // index2500
+ lateMark
+ String(repeating: "", count: 500) // 3000+
#expect(transcript.count > DiaryChatPrompts.distillTranscriptLimit)
let prompt = DiaryChatPrompts.distill(transcript: transcript)
#expect(prompt.contains(earlyMark))
#expect(!prompt.contains(lateMark))
}
}