100Years 2 weeks ago
parent
commit
1b0c98a804
36 changed files with 114 additions and 70 deletions
  1. 4 4
      AIEmoji.xcodeproj/project.pbxproj
  2. 2 2
      AIEmoji/Business/AIChat/TSChatViewController/TSChatViewController/TSChatViewController+NaviBar.swift
  3. 2 1
      AIEmoji/Business/AIChat/TSChatViewController/TSChatViewController/TSChatViewController.swift
  4. 1 1
      AIEmoji/Business/AIChat/TSChatViewController/Views/TSChatMsgBaseView/TSChatMsgToolView.swift
  5. 1 2
      AIEmoji/Business/TSAILIstVC/TSAIChangeEmoteVC/TSAIChangeEmoteVC.swift
  6. 1 2
      AIEmoji/Business/TSAILIstVC/TSAIPhotoGeneratorBaseVC/TSAIListPhotoGeneratorBaseVC.swift
  7. 5 5
      AIEmoji/Business/TSAILIstVC/TSAIPhotoGeneratorBaseVC/TSAIPhotoGeneratorBaseVM/TSAIListPhotoGeneratorBaseVM.swift
  8. 1 12
      AIEmoji/Business/TSGenmojiVC/TSGenmojiGennerateVC/TSGenmojiGennerateVC.swift
  9. 8 0
      AIEmoji/Business/TSGenmojiVC/TSGenmojiVC/Model/TSActionInfoModel.swift
  10. 1 2
      AIEmoji/Business/TSPTPGeneratorVC/TSPTPGeneratorVC/TSPTPGeneratorVC.swift
  11. 5 5
      AIEmoji/Business/TSPTPGeneratorVC/TSPTPGeneratorVC/VM/TSPTPGeneratorVM.swift
  12. 3 3
      AIEmoji/Business/TSPTPGeneratorVC/TSPTPInputVC/TSPTPInputVC.swift
  13. 8 0
      AIEmoji/Business/TSPTPGeneratorVC/TSPTPInputVC/VM/TSPTPInputVM.swift
  14. 6 3
      AIEmoji/Business/TSSetingVC/SetingVC/TSSetingVC.swift
  15. 2 0
      AIEmoji/Business/TSSetingVC/SetingVC/TSSetingViewModel.swift
  16. 3 3
      AIEmoji/Business/TSSetingVC/SetingVC/View/TSSettingListView.swift
  17. 6 1
      AIEmoji/Business/TSTextGeneralPictureVC/TSTTPInputVC/TSTTPInputVC.swift
  18. 4 3
      AIEmoji/Business/TSTextGeneralPictureVC/TSTTPInputVC/VM/TSTTPInputVM.swift
  19. 1 1
      AIEmoji/Business/TSTextGeneralPictureVC/TSTTPInputVC/View/TSPromptTextView.swift
  20. 1 2
      AIEmoji/Business/TSTextGeneralPictureVC/TSTextPicGennerateVC/TSTextPicGennerateVC.swift
  21. 3 3
      AIEmoji/Business/TSTextGeneralPictureVC/TSTextPicGennerateVC/TSTextPicGennerateVM.swift
  22. 1 2
      AIEmoji/Business/VIewTool/TSGeneratorloadingView.swift
  23. 4 7
      AIEmoji/Common/NetworkManager/TSNetWork/TSNetWork+Business.swift
  24. 6 3
      AIEmoji/Common/NetworkManager/TSNetWork/TSNetworkManager.swift
  25. 2 2
      AIEmoji/Common/Tool/OperationQueue/TSGenerateBaseOperation/TSGenerateBaseOperation.swift
  26. 1 1
      AIEmoji/Common/Tool/OperationQueue/TSGenerateBaseOperation/TSGeneratePosterOperation.swift
  27. 5 0
      AIEmoji/Common/Tool/TSCommonTool/TSCommonTool.swift
  28. 3 0
      AIEmoji/de.lproj/Localizable.strings
  29. 3 0
      AIEmoji/en.lproj/Localizable.strings
  30. 3 0
      AIEmoji/es.lproj/Localizable.strings
  31. 3 0
      AIEmoji/ja.lproj/Localizable.strings
  32. 3 0
      AIEmoji/ko.lproj/Localizable.strings
  33. 3 0
      AIEmoji/pt-BR.lproj/Localizable.strings
  34. 3 0
      AIEmoji/pt-PT.lproj/Localizable.strings
  35. 3 0
      AIEmoji/zh-Hans.lproj/Localizable.strings
  36. 3 0
      AIEmoji/zh-Hant.lproj/Localizable.strings

+ 4 - 4
AIEmoji.xcodeproj/project.pbxproj

@@ -2480,7 +2480,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 3;
+				CURRENT_PROJECT_VERSION = 1;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;
@@ -2496,7 +2496,7 @@
 					"$(inherited)",
 					"@executable_path/Frameworks",
 				);
-				MARKETING_VERSION = 3.6.5;
+				MARKETING_VERSION = 3.6.6;
 				PRODUCT_BUNDLE_IDENTIFIER = com.girl.music.wallpaper;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@@ -2519,7 +2519,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 3;
+				CURRENT_PROJECT_VERSION = 1;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;
@@ -2535,7 +2535,7 @@
 					"$(inherited)",
 					"@executable_path/Frameworks",
 				);
-				MARKETING_VERSION = 3.6.5;
+				MARKETING_VERSION = 3.6.6;
 				PRODUCT_BUNDLE_IDENTIFIER = com.girl.music.wallpaper;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";

+ 2 - 2
AIEmoji/Business/AIChat/TSChatViewController/TSChatViewController/TSChatViewController+NaviBar.swift

@@ -98,9 +98,9 @@ extension TSChatViewController {
     public func pop() {
         
         if viewModel.copyHint.isEmpty {
-            textBlock?(inputBarVC.text)
+            textBlock?(inputBarVC.text,false)
         }else{
-            textBlock?(viewModel.copyHint)
+            textBlock?(viewModel.copyHint,true)
         }
 
         if navigationController == nil {

+ 2 - 1
AIEmoji/Business/AIChat/TSChatViewController/TSChatViewController/TSChatViewController.swift

@@ -28,7 +28,7 @@ class TSChatViewController: MessagesViewController, MessagesDataSource {
 
     //传参数
     var inputText:String = "" //输入框里面的词
-    var textBlock:((String)->Void)? //回调
+    var textBlock:((String,Bool)->Void)? //回调
     var deleteBlock:(()->Void)?
     //数据
     var viewModel:TSAIChatVM = TSAIChatVM()
@@ -223,6 +223,7 @@ class TSChatViewController: MessagesViewController, MessagesDataSource {
     }
 
     deinit {
+        debugPrint("- ♻️♻️♻️TSChatViewController deinit ♻️♻️♻️")
         saveChatList()
     }
 }

+ 1 - 1
AIEmoji/Business/AIChat/TSChatViewController/Views/TSChatMsgBaseView/TSChatMsgToolView.swift

@@ -49,7 +49,7 @@ class TSChatMsgToolView: TSChatMsgBaseView {
     
     
     lazy var usePromptsBtn: UIButton = {
-        let usePromptsBtn = UIButton.createButton(title: "Use prompts".localized, backgroundColor: .white.withAlphaComponent(0.05), font: .font(size: 14), titleColor: .white, corner: 8) { [weak self]  in
+        let usePromptsBtn = UIButton.createButton(title: "Use prompt".localized, backgroundColor: .white.withAlphaComponent(0.05), font: .font(size: 14), titleColor: .white, corner: 8) { [weak self]  in
             guard let self = self else { return }
             didTapCustomViewBlock?(.copyHint)
         }

+ 1 - 2
AIEmoji/Business/TSAILIstVC/TSAIChangeEmoteVC/TSAIChangeEmoteVC.swift

@@ -288,8 +288,7 @@ extension TSAIChangeEmoteVC {
     }
     
     func showError(text:String?){
-        let msg = "Failed to generate, please try later".localized
-        generateInView.updateShowError(text: msg)
+        generateInView.updateShowError(text: text)
         
         generateInView.xBtn.isHidden = false
         generateInView.regenerateBtn.isHidden = false

+ 1 - 2
AIEmoji/Business/TSAILIstVC/TSAIPhotoGeneratorBaseVC/TSAIListPhotoGeneratorBaseVC.swift

@@ -279,8 +279,7 @@ extension TSAIListPhotoGeneratorBaseVC {
     }
     
     func showError(text:String?){
-        let msg = "Failed to generate, please try later".localized
-        generateInView.updateShowError(text: msg)
+        generateInView.updateShowError(text: text)
 
         isClickTheBlankClosePage = true
         

+ 5 - 5
AIEmoji/Business/TSAILIstVC/TSAIPhotoGeneratorBaseVC/TSAIPhotoGeneratorBaseVM/TSAIListPhotoGeneratorBaseVM.swift

@@ -87,7 +87,7 @@ class TSAIListPhotoGeneratorBaseVM {
             guard let self = self else { return }
             if let error = error {
                 imageUrl = nil
-                self.stateDatauPblished = (.failed(error.localizedDescription),nil)
+                self.stateDatauPblished = (.failed(""),nil)
             }else{
                 if let string = data as? String {
                     imageUrl = string
@@ -180,7 +180,7 @@ class TSAIListPhotoGeneratorBaseVM {
                     self.getActionInfo(action_id:actionId)
                 }
             }else{
-                self.stateDatauPblished = (.failed(error?.localizedDescription ?? ""),nil)
+                self.stateDatauPblished = (.failed(""),nil)
             }
         }
     }
@@ -207,7 +207,7 @@ class TSAIListPhotoGeneratorBaseVM {
                                         self.stateDatauPblished = (.success(nil),genmojiModel)
                                         self.generatingProgress = 0
                                     }else{
-                                        self.stateDatauPblished = (.failed(kNetWorkMessage(data: data) ?? ""),nil)
+                                        self.stateDatauPblished = (.failed(""),nil)
                                         self.generatingProgress = 0
                                     }
                                 }
@@ -224,7 +224,7 @@ class TSAIListPhotoGeneratorBaseVM {
                         }
                         
                     case .failed:
-                        self.stateDatauPblished = (.failed(kNetWorkMessage(data: data) ?? ""),nil)
+                        self.stateDatauPblished = (.failed(genmojiModel.response.codeErrorMsg),nil)
                         generatingProgress = 0
                     default:
                         stateDatauPblished = (.progressString(generating(progress: genmojiModel.percent)),nil)
@@ -236,7 +236,7 @@ class TSAIListPhotoGeneratorBaseVM {
                     }
                 }
             }else{
-                self.stateDatauPblished = (.failed(error?.localizedDescription ?? ""),nil)
+                self.stateDatauPblished = (.failed(""),nil)
             }
         }
     }

+ 1 - 12
AIEmoji/Business/TSGenmojiVC/TSGenmojiGennerateVC/TSGenmojiGennerateVC.swift

@@ -167,19 +167,8 @@ extension TSGenmojiGennerateVC {
     }
     
     func showError(text:String?){
-        let msg = "Failed to generate, please try later".localized
-//        if let str = text{
-//            if str.count == 0 {
-//                msg = "Generation failed".localized
-//            }else{
-//                msg = str
-//            }
-//        }else{
-//            msg = "Generation failed".localized
-//        }
-        
         generateInView.isHidden = false
-        generateInView.showError(text: msg)
+        generateInView.showError(text: text ?? kGenerateFailed)
         generateInView.isRotating = false
         submitBtn.isHidden = false
         cancelBtn.isHidden = true

+ 8 - 0
AIEmoji/Business/TSGenmojiVC/TSGenmojiVC/Model/TSActionInfoModel.swift

@@ -123,6 +123,14 @@ class TSActionResponseModel : TSBaseModel {
         vip                 <- map["vip"]
         code                <- map["code"]
     }
+    
+    //获取生成错误 code 对应的文案
+    var codeErrorMsg:String {
+        if code == -10003 || code == -10004 {
+            return "Your photo may contain nudity, gore or violence that does not comply with the health policy, please replace the photo and try again.".localized
+        }
+        return "Sorry there was a slight problem with the image processing, please try again later.".localized
+    }
 }
 
 

+ 1 - 2
AIEmoji/Business/TSPTPGeneratorVC/TSPTPGeneratorVC/TSPTPGeneratorVC.swift

@@ -264,8 +264,7 @@ extension TSPTPGeneratorVC {
     }
     
     func showError(text:String?){
-        let msg = "Failed to generate, please try later".localized
-        generateInView.updateShowError(text: msg)
+        generateInView.updateShowError(text: text)
 
         isClickTheBlankClosePage = true
         

+ 5 - 5
AIEmoji/Business/TSPTPGeneratorVC/TSPTPGeneratorVC/VM/TSPTPGeneratorVM.swift

@@ -98,7 +98,7 @@ class TSPTPGeneratorVM {
             guard let self = self else { return }
             if let error = error {
                 generateStyleModel.upLoadImageUrl = nil
-                self.stateDatauPblished = (.failed(error.localizedDescription),nil)
+                self.stateDatauPblished = (.failed(""),nil)
             }else{
                 if let string = data as? String {
                     generateStyleModel.upLoadImageUrl = string
@@ -129,7 +129,7 @@ class TSPTPGeneratorVM {
             guard let self = self else { return }
             if let error = error {
                 generateStyleModel.upLoadImageUrl = nil
-                self.stateDatauPblished = (.failed(error.localizedDescription),nil)
+                self.stateDatauPblished = (.failed(""),nil)
             }else{
                 if let string = data as? String {
                     generateStyleModel.upLoadImageUrl = string
@@ -169,7 +169,7 @@ class TSPTPGeneratorVM {
                     self.getActionInfo(action_id:actionId)
                 }
             }else{
-                self.stateDatauPblished = (.failed(error?.localizedDescription ?? ""),nil)
+                self.stateDatauPblished = (.failed(""),nil)
             }
         }
     }
@@ -201,7 +201,7 @@ class TSPTPGeneratorVM {
                         }
                         
                     case .failed:
-                        self.stateDatauPblished = (.failed(kNetWorkMessage(data: data) ?? ""),nil)
+                        self.stateDatauPblished = (.failed(genmojiModel.response.codeErrorMsg),nil)
                         generatingProgress = 0
                     default:
                         stateDatauPblished = (.progressString(generating(progress: genmojiModel.percent)),nil)
@@ -213,7 +213,7 @@ class TSPTPGeneratorVM {
                     }
                 }
             }else{
-                self.stateDatauPblished = (.failed(error?.localizedDescription ?? ""),nil)
+                self.stateDatauPblished = (.failed(""),nil)
             }
         }
     }

+ 3 - 3
AIEmoji/Business/TSPTPGeneratorVC/TSPTPInputVC/TSPTPInputVC.swift

@@ -478,9 +478,9 @@ extension TSPTPInputVC {
     }
 
     func generateImage() {
-        viewModel.selectedPTPStyleModel.upLoadImage = viewModel.upLoadImage
-        viewModel.selectedPTPStyleModel.upLoadImageUrl = nil
-        let gennerateVC = TSPTPGeneratorVC(generateStyleModel: viewModel.selectedPTPStyleModel) { [weak self] _ in
+//        viewModel.selectedPTPStyleModel.upLoadImage = viewModel.upLoadImage
+//        viewModel.selectedPTPStyleModel.upLoadImageUrl = nil
+        let gennerateVC = TSPTPGeneratorVC(generateStyleModel: viewModel.generateStyleModel) { [weak self] _ in
             guard let self = self else { return }
             updateVipView()
         }

+ 8 - 0
AIEmoji/Business/TSPTPGeneratorVC/TSPTPInputVC/VM/TSPTPInputVM.swift

@@ -89,6 +89,14 @@ class TSPTPInputVM {
     func gennerateChange(){
         isCanGennerateBlock?(isCanGennerate)
     }
+    
+    //用户生成图片的TSGenerateStyleModel
+    var generateStyleModel:TSGenerateStyleModel{
+        let generateStyleModel = selectedPTPStyleModel.copy() as! TSGenerateStyleModel
+        generateStyleModel.upLoadImage = upLoadImage
+        generateStyleModel.upLoadImageUrl = nil
+        return generateStyleModel
+    }
 }
  
 extension TSPTPInputVM {

+ 6 - 3
AIEmoji/Business/TSSetingVC/SetingVC/TSSetingVC.swift

@@ -90,9 +90,12 @@ class TSSetingVC: TSBaseVC {
     }
     
     @objc func refreshView() {
-        
-        if UIApplication.compareAppVersions(newVersion1: kAppNewVerison, oldVersion: appShortVersion()) == .newer {
-            self.viewModel.isHaveNewVersion = true
+        kExecuteOnMainThread {
+            dePrint("checkAppConfig 刷新版本号refreshView = \(kAppNewVerison),appShortVersion=\(appShortVersion())")
+            if UIApplication.compareAppVersions(newVersion1: kAppNewVerison, oldVersion: appShortVersion()) == .newer {
+                self.viewModel.isHaveNewVersion = true
+            }
         }
     }
+    
 }

+ 2 - 0
AIEmoji/Business/TSSetingVC/SetingVC/TSSetingViewModel.swift

@@ -101,6 +101,8 @@ class TSSetingViewModel: ObservableObject {
         }
     
 #if DEBUG
+        
+//        kSaveSuccesswShared.show(atView: parent.view)
 //        TSAbnormalPopUpAlertVC.showRobotWarning()
 //        guard let window = WindowHelper.getKeyWindow() else {
 //            debugPrint("getKeyWindow nil")

+ 3 - 3
AIEmoji/Business/TSSetingVC/SetingVC/View/TSSettingListView.swift

@@ -27,7 +27,7 @@ struct TSSettingListView: View {
                 
                 ForEach(viewModel.settingTypes, id:\.self) { type in
                     Spacer().frame(height: 16)
-                    SettingListItemView(type: type,viewModel: viewModel)
+                    SettingListItemView(type: type,isHaveNewVersion: $viewModel.isHaveNewVersion)
                     .onTapGesture {
                         publisher.settingPublisher.send(type)
                     }
@@ -52,7 +52,7 @@ struct TSSettingListView: View {
 
 struct SettingListItemView: View {
     var type : SettingType
-    var viewModel: TSSetingViewModel
+    @Binding var isHaveNewVersion: Bool
     var body: some View {
         
         ZStack {
@@ -67,7 +67,7 @@ struct SettingListItemView: View {
 //                }
                 
                 if type == .update {
-                    if viewModel.isHaveNewVersion {
+                    if isHaveNewVersion {
                         Color.hex("#FECB34").frame(width: 4, height: 4).cornerRadius(2)
                         Spacer().frame(width: 4)
                     }

+ 6 - 1
AIEmoji/Business/TSTextGeneralPictureVC/TSTTPInputVC/TSTTPInputVC.swift

@@ -80,10 +80,15 @@ class TSTTPInputVC: TSBaseVC {
             vc.viewModel.uiStyle = .perfectHint
             vc.inputText = promptTextView.text
             
-            vc.textBlock = { [weak self] text in
+            vc.textBlock = { [weak self] text ,bool in
                 guard let self = self else { return }
                 promptTextView.setText(text: text)
                 viewModel.promptText = text
+                if bool {
+                    kDelayMainShort {
+                        self.view.endEditing(true)
+                    }
+                }
             }
             kPushVC(target: self, modelVC: vc)
         }

+ 4 - 3
AIEmoji/Business/TSTextGeneralPictureVC/TSTTPInputVC/VM/TSTTPInputVM.swift

@@ -79,9 +79,10 @@ class TSTTPInputVM {
     
     //用户生成图片的TSGenerateStyleModel
     var generateStyleModel:TSGenerateStyleModel{
-        selectPromptModel.generateSize = selectRatio.ttpSize
-        selectPromptModel.prompt = prompt
-        return selectPromptModel
+        let generateStyleModel = selectPromptModel.copy() as! TSGenerateStyleModel
+        generateStyleModel.generateSize = selectRatio.ttpSize
+        generateStyleModel.prompt = prompt
+        return generateStyleModel
     }
 }
 

+ 1 - 1
AIEmoji/Business/TSTextGeneralPictureVC/TSTTPInputVC/View/TSPromptTextView.swift

@@ -47,7 +47,7 @@ class TSPromptTextView : TSBaseView{
             backgroundColor: .clear
         )
         customTextView.delegate = self
-        customTextView.returnKeyType = .send
+        customTextView.returnKeyType = .done
         return customTextView
     }()
     

+ 1 - 2
AIEmoji/Business/TSTextGeneralPictureVC/TSTextPicGennerateVC/TSTextPicGennerateVC.swift

@@ -157,8 +157,7 @@ extension TSTextPicGennerateVC {
     }
     
     func showError(text:String?){
-        let msg = "Failed to generate, please try later".localized
-        generateInView.updateShowError(text: msg)
+        generateInView.updateShowError(text: text)
         
         isClickTheBlankClosePage = true
         

+ 3 - 3
AIEmoji/Business/TSTextGeneralPictureVC/TSTextPicGennerateVC/TSTextPicGennerateVM.swift

@@ -86,7 +86,7 @@ class TSTextPicGennerateVM {
                     self.getActionInfo(action_id:actionId)
                 }
             }else{
-                self.stateDatauPblished = (.failed(error?.localizedDescription ?? ""),nil)
+                self.stateDatauPblished = (.failed(""),nil)
             }
         }
     }
@@ -120,7 +120,7 @@ class TSTextPicGennerateVM {
                         }
                         
                     case .failed:
-                        self.stateDatauPblished = (.failed(kNetWorkMessage(data: data) ?? ""),nil)
+                        self.stateDatauPblished = (.failed(genmojiModel.response.codeErrorMsg),nil)
                         generatingProgress = 0
                     default:
                         stateDatauPblished = (.progressString(generating(progress: genmojiModel.percent)),nil)
@@ -132,7 +132,7 @@ class TSTextPicGennerateVM {
                     }
                 }
             }else{
-                self.stateDatauPblished = (.failed(error?.localizedDescription ?? ""),nil)
+                self.stateDatauPblished = (.failed(""),nil)
             }
         }
     }

+ 1 - 2
AIEmoji/Business/VIewTool/TSGeneratorloadingView.swift

@@ -286,9 +286,8 @@ extension TSGeneratorloadingView{
     }
     
     func updateShowError(text:String?){
-        let msg = "Failed to generate, please try later".localized
         isHidden = false
-        showError(text: msg)
+        showError(text: text ?? kGenerateFailed)
         isRotating = false
         timeLabel.superview?.isHidden = true
         infoLabel.superview?.isHidden = true

+ 4 - 7
AIEmoji/Common/NetworkManager/TSNetWork/TSNetWork+Business.swift

@@ -45,7 +45,7 @@ enum TSNeURLType:String {
     }
 }
 
-func getUserInfoJsonString()->String {
+func getUserInfoJsonString()->[String:Any] {
     let uuid: String
     let uuidUdKey = "my_UUID"
     if let saved = UserDefaults.standard.string(forKey: uuidUdKey),
@@ -65,12 +65,8 @@ func getUserInfoJsonString()->String {
         "appVersion":appShortVersion(),
         "subscriptionStatus":kPurchaseDefault.isVip ? "active" : "fallow",
     ]
-    
-    if let jSONString = dic.toJSONString() {
-        return jSONString
-    }
-    
-    return ""
+
+    return dic
 }
 
 
@@ -246,3 +242,4 @@ extension TSNetworkManager {
     }
     
 }
+

+ 6 - 3
AIEmoji/Common/NetworkManager/TSNetWork/TSNetworkManager.swift

@@ -25,7 +25,10 @@ class TSNetworkManager {
         ]
     }
     
-    
+    lazy var encoder: JSONEncoding = {
+        return JSONEncoding(options: .withoutEscapingSlashes)// 关键:禁用斜杠转义
+    }()
+
     func postStreamRequest(
         urlString: String,
         parameters: [String: Any]? = nil,
@@ -45,7 +48,7 @@ class TSNetworkManager {
         
         // 2. 将字典参数转换为 JSON 数据并设置为请求体
         do {
-            let jsonData = try JSONSerialization.data(withJSONObject: parameters, options: [])
+            let jsonData = try JSONSerialization.data(withJSONObject: parameters, options: [.withoutEscapingSlashes])//去掉转义
             urlRequest.httpBody = jsonData
         } catch {
             dePrint("Failed to encode parameters: \(error)")
@@ -90,7 +93,7 @@ class TSNetworkManager {
         
         var encoding: ParameterEncoding = URLEncoding.default
         if method == .post {
-            encoding = JSONEncoding.default
+            encoding = encoder
         }
         let request = AF.request(urlString, method: method, parameters: parameters, encoding: encoding, headers: defaultHeaders, interceptor: nil)
         request.responseString { response in

+ 2 - 2
AIEmoji/Common/Tool/OperationQueue/TSGenerateBaseOperation/TSGenerateBaseOperation.swift

@@ -140,7 +140,7 @@ class TSGenerateBaseOperation: TSBaseOperation , @unchecked Sendable{
                             successBlock()
                         }
                     case .failed:
-                        handleFailInfoModel(errorString: kNetWorkMessage(data: data) ?? "")
+                        handleFailInfoModel(errorString:genmojiModel.response.codeErrorMsg )
                     default:
                         stateDatauPblished = (.progressString(generating(progress: genmojiModel.percent)),currentActionInfoModel)
                         if stopNetwork == false {
@@ -154,7 +154,7 @@ class TSGenerateBaseOperation: TSBaseOperation , @unchecked Sendable{
                 }
             }
  
-            handleFailInfoModel(errorString: error?.localizedDescription)
+            handleFailInfoModel(errorString: nil)
             
         }
     }

+ 1 - 1
AIEmoji/Common/Tool/OperationQueue/TSGenerateBaseOperation/TSGeneratePosterOperation.swift

@@ -144,7 +144,7 @@ class TSGeneratePTPOperation: TSGenerateBaseOperation , @unchecked Sendable{
             if stopNetwork == true { return }
             if let error = error {
                 generateStyleModel.upLoadImageUrl = nil
-                self.stateDatauPblished = (.failed(error.localizedDescription),nil)
+                self.stateDatauPblished = (.failed(""),nil)
                 complete(nil)
             }else{
                 if let string = data as? String {

+ 5 - 0
AIEmoji/Common/Tool/TSCommonTool/TSCommonTool.swift

@@ -224,3 +224,8 @@ func kExecuteOnMainThread(_ block: @escaping () -> Void) {
 let kAppName:String = "Chibii" //Chibii Chibi Ghiblii AI Image
 let kUploadImageMaxBit10Size:Int = 10 * 1024 * 1024 //10M
 let kUploadImageMaxBit5Size:Int = 5 * 1024 * 1024 //5M
+
+
+
+//let kGenerateFailed:String = "Failed to generate, please try later".localized
+let kGenerateFailed:String = "Sorry there was a slight problem with the image processing, please try again later.".localized

+ 3 - 0
AIEmoji/de.lproj/Localizable.strings

@@ -353,3 +353,6 @@
 "Are you sure to delete all histories?" = "Sind Sie sicher, alle Historien zu löschen?";
 "Delete All" = "Alle löschen";
 "Select an image with face fully visible" = "Wählen Sie ein Bild aus, auf dem das Gesicht vollständig sichtbar ist";
+"Use prompt" = "Verwenden";
+"Your photo may contain nudity, gore or violence that does not comply with the health policy, please replace the photo and try again." = "Ihr Foto enthält möglicherweise Nacktheit, blutige Szenen oder Gewaltdarstellungen, die nicht mit den Gesundheitsrichtlinien übereinstimmen. Bitte ersetzen Sie das Foto und versuchen Sie es erneut.";
+"Sorry there was a slight problem with the image processing, please try again later." = "Leider gab es ein kleines Problem mit der Bildverarbeitung, bitte versuchen Sie es später noch einmal.";

+ 3 - 0
AIEmoji/en.lproj/Localizable.strings

@@ -350,3 +350,6 @@
 "Are you sure to delete all histories?" = "Are you sure to delete all histories?";
 "Delete All" = "Delete All";
 "Select an image with face fully visible" = "Select an image with face fully visible";
+"Use prompt" = "Use prompt";
+"Your photo may contain nudity, gore or violence that does not comply with the health policy, please replace the photo and try again." = "Your photo may contain nudity, gore or violence that does not comply with the health policy, please replace the photo and try again.";
+"Sorry there was a slight problem with the image processing, please try again later." = "Sorry there was a slight problem with the image processing, please try again later.";

+ 3 - 0
AIEmoji/es.lproj/Localizable.strings

@@ -350,3 +350,6 @@
 "Are you sure to delete all histories?" = "¿Estás seguro de borrar todos los historiales?";
 "Delete All" = "Eliminar todo";
 "Select an image with face fully visible" = "Seleccione una imagen con la cara completamente visible";
+"Use prompt" = "Usar";
+"Your photo may contain nudity, gore or violence that does not comply with the health policy, please replace the photo and try again." = "Es posible que tu foto contenga desnudos, escenas sangrientas o violencia que no se ajusten a la política sanitaria; sustituye la foto e inténtalo de nuevo.";
+"Sorry there was a slight problem with the image processing, please try again later." = "Lo sentimos, ha habido un pequeño problema con el procesamiento de la imagen, inténtalo de nuevo más tarde.";

+ 3 - 0
AIEmoji/ja.lproj/Localizable.strings

@@ -349,3 +349,6 @@
 "Are you sure to delete all histories?" = "すべての履歴を削除してもよろしいですか?";
 "Delete All" = "すべて削除";
 "Select an image with face fully visible" = "顔が完全に見える画像を選択してください";
+"Use prompt" = "使用";
+"Your photo may contain nudity, gore or violence that does not comply with the health policy, please replace the photo and try again." = "あなたの写真にはヌード、グロ、暴力が含まれている可能性があります。";
+"Sorry there was a slight problem with the image processing, please try again later." = "画像処理に少し問題がありました。";

+ 3 - 0
AIEmoji/ko.lproj/Localizable.strings

@@ -355,3 +355,6 @@
 "Are you sure to delete all histories?" = "모든 기록을 삭제하시겠습니까?";
 "Delete All" = "모두 삭제";
 "Select an image with face fully visible" = "얼굴이 완전히 보이는 이미지를 선택하세요.";
+"Use prompt" = "사용";
+"Your photo may contain nudity, gore or violence that does not comply with the health policy, please replace the photo and try again." = "사진에 건강 정책을 준수하지 않는 노출, 유혈, 폭력 등이 포함되어 있을 수 있으니 사진을 교체하고 다시 시도하세요.";
+"Sorry there was a slight problem with the image processing, please try again later." = "이미지 처리에 약간의 문제가 발생했습니다. 나중에 다시 시도해 주세요.";

+ 3 - 0
AIEmoji/pt-BR.lproj/Localizable.strings

@@ -349,3 +349,6 @@
 "Are you sure to delete all histories?" = "Tem certeza de que deseja excluir todos os históricos?";
 "Delete All" = "Excluir tudo";
 "Select an image with face fully visible" = "Selecione uma imagem com o rosto totalmente visível";
+"Use prompt" = "Usar";
+"Your photo may contain nudity, gore or violence that does not comply with the health policy, please replace the photo and try again." = "Sua foto pode conter nudez, sangue ou violência que não está em conformidade com a política de saúde. Substitua a foto e tente novamente.";
+"Sorry there was a slight problem with the image processing, please try again later." = "Desculpe, houve um pequeno problema com o processamento da imagem, tente novamente mais tarde.";

+ 3 - 0
AIEmoji/pt-PT.lproj/Localizable.strings

@@ -349,3 +349,6 @@
 "Are you sure to delete all histories?" = "Tem certeza de que deseja excluir todos os históricos?";
 "Delete All" = "Excluir tudo";
 "Select an image with face fully visible" = "Selecione uma imagem com o rosto totalmente visível";
+"Use prompt" = "Usar";
+"Your photo may contain nudity, gore or violence that does not comply with the health policy, please replace the photo and try again." = "Sua foto pode conter nudez, sangue ou violência que não está em conformidade com a política de saúde. Substitua a foto e tente novamente.";
+"Sorry there was a slight problem with the image processing, please try again later." = "Desculpe, houve um pequeno problema com o processamento da imagem, tente novamente mais tarde.";

+ 3 - 0
AIEmoji/zh-Hans.lproj/Localizable.strings

@@ -351,3 +351,6 @@
 "Are you sure to delete all histories?" = "确定要删除所有历史记录吗?";
 "Delete All" = "全部删除";
 "Select an image with face fully visible" = "选择面部完全可见的图像";
+"Use prompt" = "使用关键词";
+"Your photo may contain nudity, gore or violence that does not comply with the health policy, please replace the photo and try again." = "您的照片可能包含裸露、血腥或暴力等不符合健康政策的内容,请更换照片后重试。";
+"Sorry there was a slight problem with the image processing, please try again later." = "抱歉图片处理遇到了一点小问题,请稍后再试。";

+ 3 - 0
AIEmoji/zh-Hant.lproj/Localizable.strings

@@ -341,3 +341,6 @@
 "Are you sure to delete all histories?" = "確定要刪除所有歷史記錄嗎?";
 "Delete All" = "全部刪除";
 "Select an image with face fully visible" = "選擇臉部完全可見的影像";
+"Use prompt" = "使用關鍵字";
+"Your photo may contain nudity, gore or violence that does not comply with the health policy, please replace the photo and try again." = "您的照片可能包含不符合健康政策的裸露、血腥或暴力內容,請更換照片並重試。";
+"Sorry there was a slight problem with the image processing, please try again later." = "對不起,圖片處理過程中出了一點問題,請稍後再試。";