123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- //
- // TSActionInfoModel.swift
- // AIRingtone
- //
- // Created by 100Years on 2025/3/5.
- //
- import ObjectMapper
- class TSActionInfoModel: TSBaseModel {
-
- enum ModelType:Int {
- case normal
- case example
- }
-
- enum ActionStatus:String ,Equatable {
- case success = "success"//成功
- case pending = "pending"//等待
- case running = "running"//运行
- case failed = "failed"//失败
-
- static func from(_ string: String) -> ActionStatus {
- return ActionStatus(rawValue: string) ?? .failed
- }
- }
- var modelType:ModelType = .normal
- var id:Int = 0
- var actionType:String = ""
- var comments:String = ""
- var request:TSActionInfoRequestModel = TSActionInfoRequestModel()
- var response:TSActionInfoResponseModel = TSActionInfoResponseModel()
- var createdTimestamp:Int = 0
- var status:String = ""
- var costTime:Int = 0
- var percent:Float = 0.0
- var actionStatus:ActionStatus = .failed
-
-
- override func mapping(map: ObjectMapper.Map) {
- modelType <- map["modelType"]
- id <- map["id"]
- actionType <- map["actionType"]
- comments <- map["comments"]
- request <- (map["request"],JsonStringTransform<TSActionInfoRequestModel>())
- response <- (map["response"],JsonStringTransform<TSActionInfoResponseModel>())
- createdTimestamp <- map["createdTimestamp"]
- status <- map["status"]
- costTime <- map["costTime"]
- percent <- map["percent"]
- actionStatus <- map["actionStatus"]
- actionStatus = ActionStatus.from(status)
- }
- }
- class TSActionInfoRequestModel : TSBaseModel {
- var prompt:String = ""
- var promptSort:String = ""
- //生成图用的
- var width:Int = 0
- var height:Int = 0
- //生成音乐用的
- var duration:Int = 0
- override func mapping(map: ObjectMapper.Map) {
- prompt <- map["prompt"]
- promptSort <- map["promptSort"]
- width <- map["width"]
- height <- map["height"]
- duration <- map["duration"]
- }
- }
- class TSActionInfoResponseModel : TSBaseModel {
- var vip:Bool = false
- //生成图片
- var resultUrl:String = ""
- //生成音乐用的
- var coverUrl:String = ""
- var title:String = ""
- var musicUrl:String = ""
-
- override func mapping(map: ObjectMapper.Map) {
- resultUrl <- map["resultUrl"]
- vip <- map["vip"]
-
- coverUrl <- map["coverUrl"]
- title <- map["title"]
- musicUrl <- map["musicUrl"]
- }
- }
|