shinclaw / apps /shared /OpenClawKit /Sources /OpenClawChatUI /ChatPayloadDecoding.swift
HF Bot
chore: snapshot for Hugging Face Space
c91968c
Raw
History Blame Contribute Delete
283 Bytes
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)
}
}