File size: 283 Bytes
4fc4790
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
import OpenClawKit
import Foundation

enum ChatPayloadDecoding {
    static func decode<T: Decodable>(_ payload: AnyCodable, as _: T.Type = T.self) throws -> T {
        let data = try JSONEncoder().encode(payload)
        return try JSONDecoder().decode(T.self, from: data)
    }
}