Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
f9143eac
Commit
f9143eac
authored
Dec 09, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// AI
parent
77223e6f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
16 deletions
+21
-16
YHAIMainChatViewController.swift
...s/AI/AI-Dialogue(AI对话)/C/YHAIMainChatViewController.swift
+11
-9
YHAIRobotChatViewController.swift
.../AI/AI-Dialogue(AI对话)/C/YHAIRobotChatViewController.swift
+10
-7
No files found.
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/C/YHAIMainChatViewController.swift
View file @
f9143eac
...
@@ -97,7 +97,7 @@ class YHAIMainChatViewController: YHBaseViewController {
...
@@ -97,7 +97,7 @@ class YHAIMainChatViewController: YHBaseViewController {
sesseionId
in
sesseionId
in
YHHUD
.
hide
()
YHHUD
.
hide
()
self
.
conversationId
=
sesseionId
self
.
conversationId
=
sesseionId
self
.
getHistoryMessages
(
false
)
self
.
getHistoryMessages
()
}
}
}
}
...
@@ -111,7 +111,7 @@ class YHAIMainChatViewController: YHBaseViewController {
...
@@ -111,7 +111,7 @@ class YHAIMainChatViewController: YHBaseViewController {
self
.
bottomInputView
.
showKeyBoard
(
false
)
self
.
bottomInputView
.
showKeyBoard
(
false
)
}
}
func
reloadAndScrollToBottom
(
_
forceScrollToBottom
:
Bool
=
false
)
{
func
reloadAndScrollToBottom
(
_
forceScrollToBottom
:
Bool
=
false
,
_
isNeedAccurate
:
Bool
=
false
)
{
self
.
tableView
.
reloadData
()
self
.
tableView
.
reloadData
()
if
!
forceScrollToBottom
&&
!
canTriggerProgrammaticScroll
()
{
if
!
forceScrollToBottom
&&
!
canTriggerProgrammaticScroll
()
{
...
@@ -119,8 +119,12 @@ class YHAIMainChatViewController: YHBaseViewController {
...
@@ -119,8 +119,12 @@ class YHAIMainChatViewController: YHBaseViewController {
}
}
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
.
now
()
+
0.5
)
{
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
.
now
()
+
0.5
)
{
// self.tableView.setContentOffset(.zero, animated: true)
// self.tableView.setContentOffset(CGPointMake(0, 90000), animated: true)
if
isNeedAccurate
{
self
.
tableView
.
setContentOffset
(
.
zero
,
animated
:
true
)
self
.
tableView
.
setContentOffset
(
CGPointMake
(
0
,
90000
),
animated
:
true
)
}
// 使用 performBatchUpdates 来确保所有布局更新完成后再滚动
// 使用 performBatchUpdates 来确保所有布局更新完成后再滚动
self
.
tableView
.
performBatchUpdates
(
nil
)
{
_
in
self
.
tableView
.
performBatchUpdates
(
nil
)
{
_
in
...
@@ -158,10 +162,8 @@ class YHAIMainChatViewController: YHBaseViewController {
...
@@ -158,10 +162,8 @@ class YHAIMainChatViewController: YHBaseViewController {
}
}
// isPull 是否是下拉组件触发
// isPull 是否是下拉组件触发
func
getHistoryMessages
(
_
isPull
:
Bool
)
{
func
getHistoryMessages
()
{
if
!
isPull
{
YHHUD
.
show
(
.
progress
(
message
:
"加载历史消息中..."
))
YHHUD
.
show
(
.
progress
(
message
:
"加载中..."
))
}
viewModel
.
getHistoryChatMessages
(
botId
:
robotId
,
conversationId
:
conversationId
,
messageId
:
""
)
{
viewModel
.
getHistoryChatMessages
(
botId
:
robotId
,
conversationId
:
conversationId
,
messageId
:
""
)
{
[
weak
self
]
success
,
error
in
[
weak
self
]
success
,
error
in
YHHUD
.
hide
()
YHHUD
.
hide
()
...
@@ -180,7 +182,7 @@ class YHAIMainChatViewController: YHBaseViewController {
...
@@ -180,7 +182,7 @@ class YHAIMainChatViewController: YHBaseViewController {
return
!
uuids
.
contains
(
$0
.
messageId
)
return
!
uuids
.
contains
(
$0
.
messageId
)
}
}
messages
.
insert
(
contentsOf
:
results
,
at
:
0
)
messages
.
insert
(
contentsOf
:
results
,
at
:
0
)
self
.
reloadAndScrollToBottom
()
self
.
reloadAndScrollToBottom
(
true
,
true
)
}
}
}
}
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/C/YHAIRobotChatViewController.swift
View file @
f9143eac
...
@@ -186,7 +186,7 @@ class YHAIRobotChatViewController: YHBaseViewController {
...
@@ -186,7 +186,7 @@ class YHAIRobotChatViewController: YHBaseViewController {
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
}
func
reloadAndScrollToBottom
(
_
forceScrollToBottom
:
Bool
=
false
)
{
func
reloadAndScrollToBottom
(
_
forceScrollToBottom
:
Bool
=
false
,
_
isNeedAccurate
:
Bool
=
false
)
{
self
.
tableView
.
reloadData
()
self
.
tableView
.
reloadData
()
if
!
forceScrollToBottom
&&
!
canTriggerProgrammaticScroll
()
{
if
!
forceScrollToBottom
&&
!
canTriggerProgrammaticScroll
()
{
...
@@ -194,8 +194,12 @@ class YHAIRobotChatViewController: YHBaseViewController {
...
@@ -194,8 +194,12 @@ class YHAIRobotChatViewController: YHBaseViewController {
}
}
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
.
now
()
+
0.5
)
{
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
.
now
()
+
0.5
)
{
// self.tableView.setContentOffset(.zero, animated: true)
// self.tableView.setContentOffset(CGPointMake(0, 90000), animated: true)
if
isNeedAccurate
{
self
.
tableView
.
setContentOffset
(
.
zero
,
animated
:
true
)
self
.
tableView
.
setContentOffset
(
CGPointMake
(
0
,
90000
),
animated
:
true
)
}
// 使用 performBatchUpdates 来确保所有布局更新完成后再滚动
// 使用 performBatchUpdates 来确保所有布局更新完成后再滚动
self
.
tableView
.
performBatchUpdates
(
nil
)
{
_
in
self
.
tableView
.
performBatchUpdates
(
nil
)
{
_
in
...
@@ -231,10 +235,10 @@ class YHAIRobotChatViewController: YHBaseViewController {
...
@@ -231,10 +235,10 @@ class YHAIRobotChatViewController: YHBaseViewController {
func
getHistoryMessages
()
{
func
getHistoryMessages
()
{
// YHHUD.show(.progress(message: "加载
中..."))
YHHUD
.
show
(
.
progress
(
message
:
"加载历史消息
中..."
))
viewModel
.
getHistoryChatMessages
(
botId
:
robotId
,
conversationId
:
conversationId
,
messageId
:
""
)
{
viewModel
.
getHistoryChatMessages
(
botId
:
robotId
,
conversationId
:
conversationId
,
messageId
:
""
)
{
[
weak
self
]
success
,
error
in
[
weak
self
]
success
,
error
in
//
YHHUD.hide()
YHHUD
.
hide
()
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
var
results
=
self
.
viewModel
.
historyMessages
.
map
{
var
results
=
self
.
viewModel
.
historyMessages
.
map
{
...
@@ -249,7 +253,7 @@ class YHAIRobotChatViewController: YHBaseViewController {
...
@@ -249,7 +253,7 @@ class YHAIRobotChatViewController: YHBaseViewController {
return
!
uuids
.
contains
(
$0
.
messageId
)
return
!
uuids
.
contains
(
$0
.
messageId
)
}
}
messages
.
insert
(
contentsOf
:
results
,
at
:
0
)
messages
.
insert
(
contentsOf
:
results
,
at
:
0
)
self
.
tableView
.
reloadData
(
)
reloadAndScrollToBottom
(
true
,
true
)
autoResponseLocalTextMessage
()
autoResponseLocalTextMessage
()
}
}
...
@@ -374,7 +378,6 @@ class YHAIRobotChatViewController: YHBaseViewController {
...
@@ -374,7 +378,6 @@ class YHAIRobotChatViewController: YHBaseViewController {
func
isNeedStopResonse
()
->
Bool
{
func
isNeedStopResonse
()
->
Bool
{
return
self
.
bottomInputView
.
status
==
.
loading
return
self
.
bottomInputView
.
status
==
.
loading
}
}
}
}
extension
YHAIRobotChatViewController
:
UITableViewDelegate
,
UITableViewDataSource
{
extension
YHAIRobotChatViewController
:
UITableViewDelegate
,
UITableViewDataSource
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment