Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,11 @@ private struct StepDetailRow: View {
/// Render-time memoization that stays off SwiftUI-owned state.
private var cachedColoredResult: AttributedString? {
guard let result = toolCall.result, !result.isEmpty else { return nil }
let key = Self.coloredOutputCacheKey(for: result, isError: toolCall.isError)
let key = Self.coloredOutputCacheKey(
toolCallID: toolCall.id,
resultCount: result.utf8.count,
isError: toolCall.isError
)
if let cached = Self.coloredOutputCache.object(forKey: key) {
return cached.value
}
Expand Down Expand Up @@ -947,12 +951,12 @@ private struct StepDetailRow: View {

// MARK: - Helpers

private static func coloredOutputCacheKey(for result: String, isError: Bool) -> NSString {
var hasher = Hasher()
hasher.combine(result)
hasher.combine(result.utf8.count)
hasher.combine(isError)
return "output:\(result.utf8.count):\(hasher.finalize())" as NSString
private static func coloredOutputCacheKey(
toolCallID: String,
resultCount: Int,
isError: Bool
) -> NSString {
return "\(toolCallID)|\(resultCount)|\(isError ? "err" : "ok")" as NSString
Comment thread
siddseethepalli marked this conversation as resolved.
}

private func coloredOutput(_ result: String, isError: Bool) -> AttributedString {
Expand Down