Skip to content

Commit b6373df

Browse files
ZhaoChaoqunclaude
andcommitted
Remove text overlap detection to prevent content loss
The overlap detection logic in mergeTexts() was incorrectly removing content when the end of one segment matched the beginning of another. This caused entire sentences to be dropped. Direct concatenation is now used instead, which may occasionally produce duplicate text but will never lose content. Also added GitHub account switching note to CLAUDE.md. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent e09c4a3 commit b6373df

2 files changed

Lines changed: 13 additions & 20 deletions

File tree

CLAUDE.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Nano Typeless 项目开发备忘
22

3+
## GitHub 账号
4+
5+
本机有两个 GitHub 账号:
6+
- `chaoqunzhao_microsoft` - 公司账号
7+
- `ZhaoChaoqun` - 个人账号
8+
9+
**typeless 是个人项目**,使用 `gh` 命令时如果遇到权限错误,请先切换到个人账号:
10+
11+
```bash
12+
gh auth switch -u ZhaoChaoqun
13+
```
14+
315
## Release 构建流程
416

517
构建 Release 版本后,需要重新签名才能在本地运行:

Sources/RecordingManager.swift

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -172,27 +172,8 @@ class RecordingManager {
172172
}
173173
}
174174

175-
/// 智能拼接文字,去除重叠部分
175+
/// 拼接文字
176176
private func mergeTexts(_ existing: String, _ new: String) -> String {
177-
guard !existing.isEmpty, !new.isEmpty else {
178-
return existing + new
179-
}
180-
181-
// 查找最长重叠(最多检查 10 个字符)
182-
let maxOverlap = min(existing.count, new.count, 10)
183-
184-
for overlapLen in stride(from: maxOverlap, through: 1, by: -1) {
185-
let suffix = String(existing.suffix(overlapLen))
186-
let prefix = String(new.prefix(overlapLen))
187-
188-
if suffix == prefix {
189-
// 找到重叠,去除 new 的重叠前缀
190-
print(">>> 检测到重叠: \"\(suffix)\",已去除")
191-
return existing + String(new.dropFirst(overlapLen))
192-
}
193-
}
194-
195-
// 无重叠,信任模型输出的标点,直接拼接
196177
return existing + new
197178
}
198179

0 commit comments

Comments
 (0)