123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- //
- // AIChatInfoManager.swift
- // PDF Reader Pro Edition
- //
- // Created by Niehaoyu on 2024/4/18.
- //
- import Cocoa
- class AIChatInfoModel: NSObject {
-
- var chateModelID: String = ""
- var aiConfigType: AIConfigType = .none
- var infoType: AIChatInfoType = .none
-
- var filePath: String = "" //使用的文件路径
- var uploadContent: String = "" //用户输入的内容
- var chatResult: String = "" //AI返回的结果
- var chatInfoState: AIChatInfoState = .stateNone
- var translateFromLanguage: String = ""
- var translateToLanguage: String = ""
- var creditsValid: Bool = false
- var costCredits: Int = 0
- var totalChart: Int = 0
-
-
- var infoDict: [String : String] = [:]
-
- override init() {
- super.init()
-
- self.chateModelID = self.tagString()
- self.creditsValid = true
-
- }
-
- func updateTagID() {
- self.chateModelID = self.tagString()
- }
-
- @objc func tagString() -> String {
- let dateFormatter = DateFormatter.init()
- dateFormatter.dateFormat = "yyyyMMddHHmmss"
- let dateString = dateFormatter.string(from: NSDate() as Date)
- return String(format: "%@%d", dateString, arc4random()%10000)
- }
- }
- @objcMembers class AIChatInfoManager: NSObject {
- public static let defaultManager = AIChatInfoManager.init()
-
- var modelsArrM: [AIChatInfoModel] = []
-
- var currentFilePath: String = ""
-
- var isAILoading: Bool = false
-
- override init() {
- super.init()
-
- let defaultChatModel = AIChatInfoModel.init()
- defaultChatModel.aiConfigType = .none
- defaultChatModel.infoType = .defaultTip
- self.modelsArrM.append(defaultChatModel)
-
-
- }
-
- func clearData() {
- self.modelsArrM.removeAll()
-
- let defaultChatModel = AIChatInfoModel.init()
- defaultChatModel.aiConfigType = .none
- defaultChatModel.infoType = .defaultTip
- self.modelsArrM.append(defaultChatModel)
-
- }
-
- }
|