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
565563bd
Commit
565563bd
authored
Dec 04, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// AI
parent
a54bcece
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
13 deletions
+23
-13
YHAIChatConfiguration.swift
...odules/AI/AI-Dialogue(AI对话)/C/YHAIChatConfiguration.swift
+0
-1
YHAIMainChatViewController.swift
...s/AI/AI-Dialogue(AI对话)/C/YHAIMainChatViewController.swift
+11
-6
YHAIRobotChatViewController.swift
.../AI/AI-Dialogue(AI对话)/C/YHAIRobotChatViewController.swift
+11
-6
YHAIServiceListViewController.swift
...I/AI-Dialogue(AI对话)/C/YHAIServiceListViewController.swift
+1
-0
No files found.
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/C/YHAIChatConfiguration.swift
View file @
565563bd
...
...
@@ -10,7 +10,6 @@ import UIKit
class
YHAIChatConfiguration
{
static
let
defaultConfig
=
YHAIChatConfiguration
()
var
disableHandleMessage
:
Bool
=
false
func
registerMessageGroupCells
(
_
tableView
:
UITableView
)
{
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/C/YHAIMainChatViewController.swift
View file @
565563bd
...
...
@@ -21,6 +21,11 @@ class YHAIMainChatViewController: YHBaseViewController {
let
manager
=
YHAIRequestManager
()
let
viewModel
=
YHAIViewModel
()
lazy
var
chatConfig
:
YHAIChatConfiguration
=
{
let
config
=
YHAIChatConfiguration
()
return
config
}()
lazy
var
tableView
:
UITableView
=
{
...
...
@@ -36,7 +41,7 @@ class YHAIMainChatViewController: YHBaseViewController {
tableView
.
separatorStyle
=
.
none
tableView
.
delegate
=
self
tableView
.
dataSource
=
self
YHAIChatConfiguration
.
defaul
tConfig
.
registerMessageGroupCells
(
tableView
)
cha
tConfig
.
registerMessageGroupCells
(
tableView
)
return
tableView
}()
...
...
@@ -53,8 +58,8 @@ class YHAIMainChatViewController: YHBaseViewController {
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
{
YHAIChatConfiguration
.
defaul
tConfig
.
disableHandleMessage
=
true
YHAIChatConfiguration
.
defaul
tConfig
.
removeThinkingMessageFromChatList
(
&
self
.
messages
)
self
.
cha
tConfig
.
disableHandleMessage
=
true
self
.
cha
tConfig
.
removeThinkingMessageFromChatList
(
&
self
.
messages
)
self
.
bottomInputView
.
status
=
self
.
bottomInputView
.
textView
.
text
.
isEmpty
?
.
disableSend
:
.
enableSend
self
.
tableView
.
reloadData
()
}
...
...
@@ -119,17 +124,17 @@ class YHAIMainChatViewController: YHBaseViewController {
self
.
manager
.
getMainChatConversationId
{
sesseionId
in
self
.
conversationId
=
sesseionId
YHAIChatConfiguration
.
defaul
tConfig
.
removeThinkingMessageFromChatList
(
&
self
.
messages
)
self
.
cha
tConfig
.
removeThinkingMessageFromChatList
(
&
self
.
messages
)
let
question
=
YHAIChatMessage
.
createQuestionMessage
(
text
)
self
.
messages
.
append
(
question
)
self
.
messages
.
append
(
self
.
thinkingMessage
)
self
.
scrollToBottom
()
self
.
bottomInputView
.
status
=
.
loading
YHAIChatConfiguration
.
defaul
tConfig
.
disableHandleMessage
=
false
self
.
cha
tConfig
.
disableHandleMessage
=
false
self
.
manager
.
requestAI
(
botId
:
self
.
robotId
,
conversationId
:
self
.
conversationId
,
question
:
text
)
{
[
weak
self
]
res
,
done
in
guard
let
self
=
self
else
{
return
}
YHAIChatConfiguration
.
defaul
tConfig
.
handleReceiveMessage
(
res
,
done
,
&
messages
)
self
.
cha
tConfig
.
handleReceiveMessage
(
res
,
done
,
&
messages
)
if
done
{
print
(
"RESPONSE-DONE"
)
self
.
bottomInputView
.
status
=
self
.
bottomInputView
.
textView
.
text
.
isEmpty
?
.
disableSend
:
.
enableSend
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/C/YHAIRobotChatViewController.swift
View file @
565563bd
...
...
@@ -20,6 +20,11 @@ class YHAIRobotChatViewController: YHBaseViewController {
let
manager
=
YHAIRequestManager
()
let
viewModel
=
YHAIViewModel
()
lazy
var
chatConfig
:
YHAIChatConfiguration
=
{
let
config
=
YHAIChatConfiguration
()
return
config
}()
lazy
var
tableView
:
UITableView
=
{
let
tableView
=
UITableView
(
frame
:
.
zero
,
style
:
.
grouped
)
...
...
@@ -34,7 +39,7 @@ class YHAIRobotChatViewController: YHBaseViewController {
tableView
.
separatorStyle
=
.
none
tableView
.
delegate
=
self
tableView
.
dataSource
=
self
YHAIChatConfiguration
.
defaul
tConfig
.
registerMessageGroupCells
(
tableView
)
cha
tConfig
.
registerMessageGroupCells
(
tableView
)
return
tableView
}()
...
...
@@ -56,8 +61,8 @@ class YHAIRobotChatViewController: YHBaseViewController {
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
{
YHAIChatConfiguration
.
defaul
tConfig
.
disableHandleMessage
=
true
YHAIChatConfiguration
.
defaul
tConfig
.
removeThinkingMessageFromChatList
(
&
self
.
messages
)
self
.
cha
tConfig
.
disableHandleMessage
=
true
self
.
cha
tConfig
.
removeThinkingMessageFromChatList
(
&
self
.
messages
)
self
.
bottomInputView
.
status
=
self
.
bottomInputView
.
textView
.
text
.
isEmpty
?
.
disableSend
:
.
enableSend
self
.
tableView
.
reloadData
()
}
...
...
@@ -133,17 +138,17 @@ class YHAIRobotChatViewController: YHBaseViewController {
}
func
sendMessage
(
_
text
:
String
)
{
YHAIChatConfiguration
.
defaul
tConfig
.
removeThinkingMessageFromChatList
(
&
messages
)
self
.
cha
tConfig
.
removeThinkingMessageFromChatList
(
&
messages
)
let
question
=
YHAIChatMessage
.
createQuestionMessage
(
text
)
messages
.
append
(
question
)
messages
.
append
(
thinkingMessage
)
self
.
scrollToBottom
()
self
.
bottomInputView
.
status
=
.
loading
YHAIChatConfiguration
.
defaul
tConfig
.
disableHandleMessage
=
false
self
.
cha
tConfig
.
disableHandleMessage
=
false
self
.
manager
.
requestAI
(
botId
:
self
.
robotId
,
conversationId
:
self
.
conversationId
,
question
:
text
)
{
[
weak
self
]
res
,
done
in
guard
let
self
=
self
else
{
return
}
YHAIChatConfiguration
.
defaul
tConfig
.
handleReceiveMessage
(
res
,
done
,
&
messages
)
self
.
cha
tConfig
.
handleReceiveMessage
(
res
,
done
,
&
messages
)
if
done
{
print
(
"RESPONSE-DONE"
)
self
.
bottomInputView
.
status
=
self
.
bottomInputView
.
textView
.
text
.
isEmpty
?
.
disableSend
:
.
enableSend
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/C/YHAIServiceListViewController.swift
View file @
565563bd
...
...
@@ -31,6 +31,7 @@ class YHAIServiceListViewController: YHBaseViewController {
collectView
.
register
(
YHAIProductCell
.
self
,
forCellWithReuseIdentifier
:
YHAIProductCell
.
cellReuseIdentifier
)
collectView
.
register
(
YHAIGreetCollectionReusableView
.
self
,
forSupplementaryViewOfKind
:
UICollectionView
.
elementKindSectionHeader
,
withReuseIdentifier
:
YHAIGreetCollectionReusableView
.
reuseIdentifier
)
collectView
.
contentInset
=
.
zero
collectView
.
showsVerticalScrollIndicator
=
false
return
collectView
}()
...
...
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