Commit 42a898b1 authored by Steven杜宇's avatar Steven杜宇

// AI

parent c15f3219
...@@ -111,7 +111,7 @@ class YHAIMainChatViewController: YHBaseViewController { ...@@ -111,7 +111,7 @@ class YHAIMainChatViewController: YHBaseViewController {
self.tableView.reloadData() self.tableView.reloadData()
if canTriggerProgrammaticScroll() { if disableScrollToBottom {
return return
} }
...@@ -224,7 +224,9 @@ class YHAIMainChatViewController: YHBaseViewController { ...@@ -224,7 +224,9 @@ class YHAIMainChatViewController: YHBaseViewController {
} callBack: { } callBack: {
self.manager.clearGlobalConverastionId() self.manager.clearGlobalConverastionId()
YHHUD.flash(message: "删除历史记录中...")
self.viewModel.requestConversationId { sessionId in self.viewModel.requestConversationId { sessionId in
YHHUD.hide()
if !sessionId.isEmpty { if !sessionId.isEmpty {
self.conversationId = sessionId self.conversationId = sessionId
self.manager.saveGlobalConverastionId(sessionId) self.manager.saveGlobalConverastionId(sessionId)
...@@ -417,11 +419,6 @@ extension YHAIMainChatViewController: UITableViewDelegate, UITableViewDataSource ...@@ -417,11 +419,6 @@ extension YHAIMainChatViewController: UITableViewDelegate, UITableViewDataSource
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
} }
// 检查是否可以执行代码触发的滚动
func canTriggerProgrammaticScroll() -> Bool {
return !disableScrollToBottom
}
} }
extension YHAIMainChatViewController: JXSegmentedListContainerViewListDelegate { extension YHAIMainChatViewController: JXSegmentedListContainerViewListDelegate {
......
...@@ -183,14 +183,16 @@ class YHAIRobotChatViewController: YHBaseViewController { ...@@ -183,14 +183,16 @@ class YHAIRobotChatViewController: YHBaseViewController {
self.tableView.reloadData() self.tableView.reloadData()
if canTriggerProgrammaticScroll() {
return
}
DispatchQueue.main.async { DispatchQueue.main.async {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
if disableScrollToBottom {
return
}
// 使用 UIView.animate 实现更丝滑的滚动效果 // 使用 UIView.animate 实现更丝滑的滚动效果
UIView.animate(withDuration: 0.5, UIView.animate(withDuration: 0.5,
delay: 0, delay: 0,
...@@ -304,7 +306,9 @@ class YHAIRobotChatViewController: YHBaseViewController { ...@@ -304,7 +306,9 @@ class YHAIRobotChatViewController: YHBaseViewController {
} callBack: { } callBack: {
self.manager.clearLobalSubRobotConversationIdForListItemId("\(self.listItemId)") self.manager.clearLobalSubRobotConversationIdForListItemId("\(self.listItemId)")
YHHUD.flash(message: "删除历史记录中...")
self.viewModel.requestConversationId { sessionId in self.viewModel.requestConversationId { sessionId in
YHHUD.hide()
if !sessionId.isEmpty { if !sessionId.isEmpty {
self.conversationId = sessionId self.conversationId = sessionId
self.manager.saveLobalSubRobotConversationId(sessionId, listItemId: "\(self.listItemId)") self.manager.saveLobalSubRobotConversationId(sessionId, listItemId: "\(self.listItemId)")
...@@ -549,6 +553,7 @@ extension YHAIRobotChatViewController: UITableViewDelegate, UITableViewDataSourc ...@@ -549,6 +553,7 @@ extension YHAIRobotChatViewController: UITableViewDelegate, UITableViewDataSourc
} }
func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
printLog("DisableScrollToBottom")
disableScrollToBottom = true disableScrollToBottom = true
self.bottomInputView.showKeyBoard(false) self.bottomInputView.showKeyBoard(false)
} }
...@@ -561,11 +566,6 @@ extension YHAIRobotChatViewController: UITableViewDelegate, UITableViewDataSourc ...@@ -561,11 +566,6 @@ extension YHAIRobotChatViewController: UITableViewDelegate, UITableViewDataSourc
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
} }
// 检查是否可以执行代码触发的滚动
func canTriggerProgrammaticScroll() -> Bool {
return !disableScrollToBottom
}
} }
extension YHAIRobotChatViewController: JXSegmentedListContainerViewListDelegate { extension YHAIRobotChatViewController: JXSegmentedListContainerViewListDelegate {
......
...@@ -207,7 +207,8 @@ extension YHAIServiceListViewController: UICollectionViewDelegate, UICollectionV ...@@ -207,7 +207,8 @@ extension YHAIServiceListViewController: UICollectionViewDelegate, UICollectionV
headerView.updateGreetingText() headerView.updateGreetingText()
return headerView return headerView
} }
return UICollectionReusableView()
return UICollectionReusableView(frame: CGRectMake(0, 0, KScreenWidth, 42.0))
} }
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection:Int) -> CGSize { func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection:Int) -> CGSize {
......
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