Commit 450f6cf2 authored by Steven杜宇's avatar Steven杜宇

// AI

parent fe413bab
...@@ -269,8 +269,12 @@ extension YHAIMainChatViewController: UITableViewDelegate, UITableViewDataSource ...@@ -269,8 +269,12 @@ extension YHAIMainChatViewController: UITableViewDelegate, UITableViewDataSource
self.uploadEvaluationMessage(textMsg) self.uploadEvaluationMessage(textMsg)
} }
if let img1 = dict["consultant_qr_code_with_text"] as? String { if let imgUrl = dict["consultant_qr_code_with_text"] as? String {
let picMsg = YHAIChatMessage.createPictureMessage(url: img1, imgType: 1) var downUrl = ""
if let downloadImgUrl = dict["consultant_qr_code"] as? String {
downUrl = downloadImgUrl
}
let picMsg = YHAIChatMessage.createPictureMessage(imgType: 1, url: imgUrl, downloadUrl: downUrl)
arr.append(picMsg) arr.append(picMsg)
self.uploadEvaluationMessage(picMsg) self.uploadEvaluationMessage(picMsg)
} }
......
...@@ -302,8 +302,12 @@ extension YHAIRobotChatViewController: UITableViewDelegate, UITableViewDataSourc ...@@ -302,8 +302,12 @@ extension YHAIRobotChatViewController: UITableViewDelegate, UITableViewDataSourc
self.uploadEvaluationMessage(textMsg) self.uploadEvaluationMessage(textMsg)
} }
if let img1 = dict["consultant_qr_code_with_text"] as? String { if let imgUrl = dict["consultant_qr_code_with_text"] as? String {
let picMsg = YHAIChatMessage.createPictureMessage(url: img1, imgType: 1) var downUrl = ""
if let downloadImgUrl = dict["consultant_qr_code"] as? String {
downUrl = downloadImgUrl
}
let picMsg = YHAIChatMessage.createPictureMessage(imgType: 1, url: imgUrl, downloadUrl: downUrl)
arr.append(picMsg) arr.append(picMsg)
self.uploadEvaluationMessage(picMsg) self.uploadEvaluationMessage(picMsg)
} }
......
...@@ -20,6 +20,7 @@ class YHAIHistoryMessage: SmartCodable { ...@@ -20,6 +20,7 @@ class YHAIHistoryMessage: SmartCodable {
var type: String = "" var type: String = ""
var cardsInfo: YHAIListInfoModel? var cardsInfo: YHAIListInfoModel?
var imageInfo: YHAIImageInfo?
required init() { required init() {
...@@ -38,6 +39,7 @@ class YHAIHistoryMessage: SmartCodable { ...@@ -38,6 +39,7 @@ class YHAIHistoryMessage: SmartCodable {
body.chatId = self.chatId body.chatId = self.chatId
body.type = self.type body.type = self.type
body.cardsInfo = self.cardsInfo body.cardsInfo = self.cardsInfo
body.imageInfo = self.imageInfo
msg.body = body msg.body = body
msg.setDone() msg.setDone()
msg.updateBodyToData() msg.updateBodyToData()
......
...@@ -107,7 +107,7 @@ class YHAIChatMessage: CustomStringConvertible { ...@@ -107,7 +107,7 @@ class YHAIChatMessage: CustomStringConvertible {
return message return message
} }
static func createPictureMessage(url: String, imgType: Int) -> YHAIChatMessage { static func createPictureMessage(imgType: Int, url: String, downloadUrl: String) -> YHAIChatMessage {
let message = YHAIChatMessage() let message = YHAIChatMessage()
message.messageId = UUID().uuidString + NSDate().timeIntervalSince1970.description message.messageId = UUID().uuidString + NSDate().timeIntervalSince1970.description
message.isSelf = false message.isSelf = false
...@@ -115,8 +115,9 @@ class YHAIChatMessage: CustomStringConvertible { ...@@ -115,8 +115,9 @@ class YHAIChatMessage: CustomStringConvertible {
message.setDone() message.setDone()
body.contentType = YHAIMessageType.picture.rawValue body.contentType = YHAIMessageType.picture.rawValue
let imgInfo = YHAIImageInfo() let imgInfo = YHAIImageInfo()
imgInfo.imageUrl = url
imgInfo.imageType = imgType imgInfo.imageType = imgType
imgInfo.imageUrl = url
imgInfo.imageDownloadUrl = downloadUrl
body.imageInfo = imgInfo body.imageInfo = imgInfo
message.body = body message.body = body
message.updateBodyToData() message.updateBodyToData()
...@@ -286,6 +287,7 @@ class YHAIImageInfo: SmartCodable { ...@@ -286,6 +287,7 @@ class YHAIImageInfo: SmartCodable {
var imageType: Int = 0 var imageType: Int = 0
var imageUrl: String = "" var imageUrl: String = ""
var imageDownloadUrl: String = ""
required init() { required init() {
......
...@@ -114,7 +114,7 @@ class YHAIViewModel: NSObject { ...@@ -114,7 +114,7 @@ class YHAIViewModel: NSObject {
let content = self.dicToJSONString(dict: msgDict) let content = self.dicToJSONString(dict: msgDict)
let params:[String : Any] = ["conversationId" : conversationId, let params:[String : Any] = ["conversationId" : conversationId,
"contentType" : "\(msg.body.contentType)", "contentType" : "text",
"role" : role, "role" : role,
"content" : content] "content" : content]
printLog("CREATE_MSG:\n \(params)") printLog("CREATE_MSG:\n \(params)")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment