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

// AI

parent fe413bab
......@@ -269,8 +269,12 @@ extension YHAIMainChatViewController: UITableViewDelegate, UITableViewDataSource
self.uploadEvaluationMessage(textMsg)
}
if let img1 = dict["consultant_qr_code_with_text"] as? String {
let picMsg = YHAIChatMessage.createPictureMessage(url: img1, imgType: 1)
if let imgUrl = dict["consultant_qr_code_with_text"] as? String {
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)
self.uploadEvaluationMessage(picMsg)
}
......
......@@ -302,8 +302,12 @@ extension YHAIRobotChatViewController: UITableViewDelegate, UITableViewDataSourc
self.uploadEvaluationMessage(textMsg)
}
if let img1 = dict["consultant_qr_code_with_text"] as? String {
let picMsg = YHAIChatMessage.createPictureMessage(url: img1, imgType: 1)
if let imgUrl = dict["consultant_qr_code_with_text"] as? String {
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)
self.uploadEvaluationMessage(picMsg)
}
......
......@@ -20,7 +20,8 @@ class YHAIHistoryMessage: SmartCodable {
var type: String = ""
var cardsInfo: YHAIListInfoModel?
var imageInfo: YHAIImageInfo?
required init() {
}
......@@ -38,6 +39,7 @@ class YHAIHistoryMessage: SmartCodable {
body.chatId = self.chatId
body.type = self.type
body.cardsInfo = self.cardsInfo
body.imageInfo = self.imageInfo
msg.body = body
msg.setDone()
msg.updateBodyToData()
......
......@@ -107,7 +107,7 @@ class YHAIChatMessage: CustomStringConvertible {
return message
}
static func createPictureMessage(url: String, imgType: Int) -> YHAIChatMessage {
static func createPictureMessage(imgType: Int, url: String, downloadUrl: String) -> YHAIChatMessage {
let message = YHAIChatMessage()
message.messageId = UUID().uuidString + NSDate().timeIntervalSince1970.description
message.isSelf = false
......@@ -115,8 +115,9 @@ class YHAIChatMessage: CustomStringConvertible {
message.setDone()
body.contentType = YHAIMessageType.picture.rawValue
let imgInfo = YHAIImageInfo()
imgInfo.imageUrl = url
imgInfo.imageType = imgType
imgInfo.imageUrl = url
imgInfo.imageDownloadUrl = downloadUrl
body.imageInfo = imgInfo
message.body = body
message.updateBodyToData()
......@@ -286,6 +287,7 @@ class YHAIImageInfo: SmartCodable {
var imageType: Int = 0
var imageUrl: String = ""
var imageDownloadUrl: String = ""
required init() {
......
......@@ -114,7 +114,7 @@ class YHAIViewModel: NSObject {
let content = self.dicToJSONString(dict: msgDict)
let params:[String : Any] = ["conversationId" : conversationId,
"contentType" : "\(msg.body.contentType)",
"contentType" : "text",
"role" : role,
"content" : content]
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