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
20e1aed4
Commit
20e1aed4
authored
Dec 07, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// AI
parent
4c59fe74
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
24 deletions
+50
-24
YHAIMainChatViewController.swift
...s/AI/AI-Dialogue(AI对话)/C/YHAIMainChatViewController.swift
+20
-12
YHAIRobotChatViewController.swift
.../AI/AI-Dialogue(AI对话)/C/YHAIRobotChatViewController.swift
+30
-12
No files found.
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/C/YHAIMainChatViewController.swift
View file @
20e1aed4
...
@@ -54,16 +54,7 @@ class YHAIMainChatViewController: YHBaseViewController {
...
@@ -54,16 +54,7 @@ class YHAIMainChatViewController: YHBaseViewController {
v
.
stopSendBlock
=
{
v
.
stopSendBlock
=
{
[
weak
self
]
in
[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
self
.
manager
.
stopChat
(
chatId
:
self
.
manager
.
chatId
,
conversationId
:
self
.
conversationId
)
{
success
,
error
in
self
.
stopAutoResponse
()
self
.
bottomInputView
.
status
=
self
.
bottomInputView
.
textView
.
text
.
isEmpty
?
.
disableSend
:
.
enableSend
if
success
{
self
.
manager
.
request
?
.
cancel
()
self
.
chatConfig
.
disableHandleMessage
=
true
self
.
chatConfig
.
removeThinkingMessageFromChatList
(
&
self
.
messages
)
self
.
bottomInputView
.
status
=
self
.
bottomInputView
.
textView
.
text
.
isEmpty
?
.
disableSend
:
.
enableSend
self
.
tableView
.
reloadData
()
}
}
}
}
return
v
return
v
}()
}()
...
@@ -190,6 +181,20 @@ class YHAIMainChatViewController: YHBaseViewController {
...
@@ -190,6 +181,20 @@ class YHAIMainChatViewController: YHBaseViewController {
}
}
}
}
func
stopAutoResponse
(
completion
:((
Bool
)
->
())?
=
nil
)
{
self
.
manager
.
stopChat
(
chatId
:
self
.
manager
.
chatId
,
conversationId
:
self
.
conversationId
)
{
success
,
error
in
self
.
bottomInputView
.
status
=
self
.
bottomInputView
.
textView
.
text
.
isEmpty
?
.
disableSend
:
.
enableSend
if
success
{
self
.
manager
.
request
?
.
cancel
()
self
.
chatConfig
.
disableHandleMessage
=
true
self
.
chatConfig
.
removeThinkingMessageFromChatList
(
&
self
.
messages
)
self
.
bottomInputView
.
status
=
self
.
bottomInputView
.
textView
.
text
.
isEmpty
?
.
disableSend
:
.
enableSend
self
.
tableView
.
reloadData
()
completion
?(
success
)
}
}
}
func
uploadEvaluationMessage
(
_
msg
:
YHAIChatMessage
,
callback
:((
Bool
)
->
())?
=
nil
)
{
func
uploadEvaluationMessage
(
_
msg
:
YHAIChatMessage
,
callback
:((
Bool
)
->
())?
=
nil
)
{
viewModel
.
createMessage
(
conversationId
:
conversationId
,
role
:
"assistant"
,
msg
:
msg
)
{
viewModel
.
createMessage
(
conversationId
:
conversationId
,
role
:
"assistant"
,
msg
:
msg
)
{
[
weak
self
]
success
,
error
in
[
weak
self
]
success
,
error
in
...
@@ -238,8 +243,11 @@ extension YHAIMainChatViewController: UITableViewDelegate, UITableViewDataSource
...
@@ -238,8 +243,11 @@ extension YHAIMainChatViewController: UITableViewDelegate, UITableViewDataSource
cell
.
messageClick
=
{
cell
.
messageClick
=
{
[
weak
self
]
text
in
[
weak
self
]
text
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
self
.
sendMessage
(
text
)
self
.
stopAutoResponse
{
success
in
}
if
success
{
self
.
sendMessage
(
text
)
}
}
}
return
cell
return
cell
}
else
if
msgType
==
.
thinking
{
}
else
if
msgType
==
.
thinking
{
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/C/YHAIRobotChatViewController.swift
View file @
20e1aed4
...
@@ -60,15 +60,7 @@ class YHAIRobotChatViewController: YHBaseViewController {
...
@@ -60,15 +60,7 @@ class YHAIRobotChatViewController: YHBaseViewController {
v
.
stopSendBlock
=
{
v
.
stopSendBlock
=
{
[
weak
self
]
in
[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
self
.
manager
.
stopChat
(
chatId
:
self
.
manager
.
chatId
,
conversationId
:
self
.
conversationId
)
{
success
,
error
in
self
.
stopAutoResponse
()
self
.
bottomInputView
.
status
=
self
.
bottomInputView
.
textView
.
text
.
isEmpty
?
.
disableSend
:
.
enableSend
if
success
{
self
.
chatConfig
.
disableHandleMessage
=
true
self
.
chatConfig
.
removeThinkingMessageFromChatList
(
&
self
.
messages
)
self
.
bottomInputView
.
status
=
self
.
bottomInputView
.
textView
.
text
.
isEmpty
?
.
disableSend
:
.
enableSend
self
.
tableView
.
reloadData
()
}
}
}
}
return
v
return
v
}()
}()
...
@@ -220,6 +212,20 @@ class YHAIRobotChatViewController: YHBaseViewController {
...
@@ -220,6 +212,20 @@ class YHAIRobotChatViewController: YHBaseViewController {
}
}
}
}
func
stopAutoResponse
(
completion
:((
Bool
)
->
())?
=
nil
)
{
self
.
manager
.
stopChat
(
chatId
:
self
.
manager
.
chatId
,
conversationId
:
self
.
conversationId
)
{
success
,
error
in
self
.
bottomInputView
.
status
=
self
.
bottomInputView
.
textView
.
text
.
isEmpty
?
.
disableSend
:
.
enableSend
if
success
{
self
.
manager
.
request
?
.
cancel
()
self
.
chatConfig
.
disableHandleMessage
=
true
self
.
chatConfig
.
removeThinkingMessageFromChatList
(
&
self
.
messages
)
self
.
bottomInputView
.
status
=
self
.
bottomInputView
.
textView
.
text
.
isEmpty
?
.
disableSend
:
.
enableSend
self
.
tableView
.
reloadData
()
completion
?(
success
)
}
}
}
@objc
func
didCleanButtonClicked
()
{
@objc
func
didCleanButtonClicked
()
{
YHCommonAlertView
.
show
(
"删除历史记录"
,
"删除后记录无法恢复"
,
"取消"
,
"删除"
,
fullGuestureEnable
:
false
)
{
YHCommonAlertView
.
show
(
"删除历史记录"
,
"删除后记录无法恢复"
,
"取消"
,
"删除"
,
fullGuestureEnable
:
false
)
{
...
@@ -295,7 +301,11 @@ extension YHAIRobotChatViewController: UITableViewDelegate, UITableViewDataSourc
...
@@ -295,7 +301,11 @@ extension YHAIRobotChatViewController: UITableViewDelegate, UITableViewDataSourc
cell
.
messageClick
=
{
cell
.
messageClick
=
{
[
weak
self
]
text
in
[
weak
self
]
text
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
self
.
sendMessage
(
text
)
self
.
stopAutoResponse
{
success
in
if
success
{
self
.
sendMessage
(
text
)
}
}
}
}
return
cell
return
cell
...
@@ -395,7 +405,11 @@ extension YHAIRobotChatViewController: UITableViewDelegate, UITableViewDataSourc
...
@@ -395,7 +405,11 @@ extension YHAIRobotChatViewController: UITableViewDelegate, UITableViewDataSourc
view
.
selectFlowMsgBlock
=
{
view
.
selectFlowMsgBlock
=
{
[
weak
self
]
text
in
[
weak
self
]
text
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
self
.
sendMessage
(
text
)
self
.
stopAutoResponse
{
success
in
if
success
{
self
.
sendMessage
(
text
)
}
}
}
}
view
.
selectBannerItemBlock
=
{
view
.
selectBannerItemBlock
=
{
[
weak
self
]
model
in
[
weak
self
]
model
in
...
@@ -408,7 +422,11 @@ extension YHAIRobotChatViewController: UITableViewDelegate, UITableViewDataSourc
...
@@ -408,7 +422,11 @@ extension YHAIRobotChatViewController: UITableViewDelegate, UITableViewDataSourc
text
=
model
.
desc
text
=
model
.
desc
}
}
self
.
sendMessage
(
text
)
self
.
stopAutoResponse
{
success
in
if
success
{
self
.
sendMessage
(
text
)
}
}
}
}
return
view
return
view
}
}
...
...
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