fix: land contributor PR #39516 from @Imhermes1

macOS app/chat/browser/cron/permissions fixes.

Co-authored-by: ImHermes1 <lukeforn@gmail.com>
This commit is contained in:
Peter Steinberger
2026-03-08 06:11:20 +00:00
parent 05217845a7
commit d15b6af77b
22 changed files with 1202 additions and 64 deletions

View File

@@ -12,7 +12,7 @@ struct AssistantTextSegment: Identifiable {
}
enum AssistantTextParser {
static func segments(from raw: String) -> [AssistantTextSegment] {
static func segments(from raw: String, includeThinking: Bool = true) -> [AssistantTextSegment] {
let trimmed = raw.trimmingCharacters(in: .whitespacesAndNewlines)
guard !trimmed.isEmpty else { return [] }
guard raw.contains("<") else {
@@ -54,11 +54,23 @@ enum AssistantTextParser {
return [AssistantTextSegment(kind: .response, text: trimmed)]
}
return segments
if includeThinking {
return segments
}
return segments.filter { $0.kind == .response }
}
static func visibleSegments(from raw: String) -> [AssistantTextSegment] {
self.segments(from: raw, includeThinking: false)
}
static func hasVisibleContent(in raw: String, includeThinking: Bool) -> Bool {
!self.segments(from: raw, includeThinking: includeThinking).isEmpty
}
static func hasVisibleContent(in raw: String) -> Bool {
!self.segments(from: raw).isEmpty
self.hasVisibleContent(in: raw, includeThinking: false)
}
private enum TagKind {