Download apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatPayloadDecoding.swift from shimen/shinclaw: direct link, hf CLI and curl.
- Browser
- Download file 283 Bytes
-
https://huggingface.co/spaces/shimen/shinclaw/resolve/main/apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatPayloadDecoding.swift
- Command line
-
hf download hf://spaces/shimen/shinclaw/apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatPayloadDecoding.swift
-
curl -L -o ChatPayloadDecoding.swift https://huggingface.co/spaces/shimen/shinclaw/resolve/main/apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatPayloadDecoding.swift
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) | |
| } | |
| } | |