mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-24 21:08:38 +00:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user