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
05eda689
Commit
05eda689
authored
Dec 05, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// AI
parent
a75ba694
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
77 additions
and
26 deletions
+77
-26
YHAIChatConfiguration.swift
...odules/AI/AI-Dialogue(AI对话)/C/YHAIChatConfiguration.swift
+7
-1
YHAIRequestManager.swift
...s/Modules/AI/AI-Dialogue(AI对话)/C/YHAIRequestManager.swift
+2
-2
YHAIServiceListViewController.swift
...I/AI-Dialogue(AI对话)/C/YHAIServiceListViewController.swift
+47
-9
YHAIMessageModel.swift
...ses/Modules/AI/AI-Dialogue(AI对话)/M/YHAIMessageModel.swift
+14
-6
YHAIProductCell.swift
...sses/Modules/AI/AI-Dialogue(AI对话)/V/YHAIProductCell.swift
+1
-6
YHAITextMessageCell.swift
.../Modules/AI/AI-Dialogue(AI对话)/V/YHAITextMessageCell.swift
+1
-1
YHCardMessageCell.swift
...es/Modules/AI/AI-Dialogue(AI对话)/V/YHCardMessageCell.swift
+5
-1
No files found.
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/C/YHAIChatConfiguration.swift
View file @
05eda689
...
@@ -43,7 +43,13 @@ class YHAIChatConfiguration {
...
@@ -43,7 +43,13 @@ class YHAIChatConfiguration {
if
msg
.
isNeedSpiceMessage
(),
res
.
isNeedSpiceMessage
()
{
if
msg
.
isNeedSpiceMessage
(),
res
.
isNeedSpiceMessage
()
{
// 多个文字需要拼接
// 多个文字需要拼接
find
=
true
find
=
true
msg
.
body
.
contentText
+=
res
.
body
.
contentText
if
res
.
isTextCompleted
()
{
msg
.
isDone
=
true
}
else
{
msg
.
body
.
contentText
+=
res
.
body
.
contentText
}
msg
.
updateBodyToData
()
msg
.
updateBodyToData
()
}
}
}
}
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/C/YHAIRequestManager.swift
View file @
05eda689
...
@@ -221,11 +221,11 @@ class YHAIRequestManager: NSObject {
...
@@ -221,11 +221,11 @@ class YHAIRequestManager: NSObject {
if
sessionDone
{
if
sessionDone
{
print
(
"SESSION DONE"
)
print
(
"SESSION DONE"
)
}
}
if
receiveMessage
.
isCompleted
()
{
if
receiveMessage
.
is
Message
Completed
()
{
// 一段话结束需要重新生成uuid 来
// 一段话结束需要重新生成uuid 来
self
.
uuid
=
UUID
()
.
uuidString
+
NSDate
()
.
timeIntervalSince1970
.
description
self
.
uuid
=
UUID
()
.
uuidString
+
NSDate
()
.
timeIntervalSince1970
.
description
}
}
if
!
receiveMessage
.
isNot
UserfulMessage
()
{
if
receiveMessage
.
is
UserfulMessage
()
{
completion
?(
receiveMessage
,
sessionDone
)
completion
?(
receiveMessage
,
sessionDone
)
}
}
}
}
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/C/YHAIServiceListViewController.swift
View file @
05eda689
...
@@ -140,15 +140,53 @@ extension YHAIServiceListViewController: UICollectionViewDelegate, UICollectionV
...
@@ -140,15 +140,53 @@ extension YHAIServiceListViewController: UICollectionViewDelegate, UICollectionV
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
if
0
<=
indexPath
.
item
&&
indexPath
.
item
<
serviceArr
.
count
{
if
0
<=
indexPath
.
item
&&
indexPath
.
item
<
serviceArr
.
count
{
let
model
=
serviceArr
[
indexPath
.
item
]
let
model
=
serviceArr
[
indexPath
.
item
]
self
.
manager
.
getSubRobotChatConversationId
(
robotId
:
model
.
botId
)
{
sesseionId
in
if
model
.
redirectMode
==
1
{
// web页面
let
vc
=
YHAIRobotChatViewController
()
if
!
model
.
redirectPath
.
isEmpty
{
vc
.
isNeedShowBannerHeader
=
model
.
isNeedShowBannerHeader
()
let
vc
=
YHH5WebViewVC
()
vc
.
myTitle
=
model
.
title
vc
.
url
=
model
.
redirectPath
vc
.
robotId
=
model
.
botId
let
isEvaluation
=
true
vc
.
conversationId
=
sesseionId
if
isEvaluation
{
vc
.
robotType
=
model
.
botType
vc
.
isPushed
=
false
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
vc
.
isFullScreenFlag
=
true
vc
.
isHideNavigationBar
=
true
vc
.
evaluationResultCallback
=
{
dict
in
block
?(
dict
)
}
UIViewController
.
current
?
.
present
(
vc
,
animated
:
true
)
}
else
{
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
}
else
if
model
.
redirectMode
==
2
{
// customerVoice -> APP客户心声 productList -> APP-首页银河甄选
if
path
==
YHAIJumpPageType
.
customerHeart
.
rawValue
{
//客户心声
let
vc
=
YHOtherServiceViewController
()
vc
.
classID
=
5
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
)
}
else
if
path
==
YHAIJumpPageType
.
galaxySelect
.
rawValue
{
// 银河甄选
let
vc
=
YHSelectViewController
()
vc
.
hideFlag
=
false
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
else
if
mode
==
3
{
// agent
self
.
manager
.
getSubRobotChatConversationId
(
robotId
:
model
.
botId
)
{
sesseionId
in
let
vc
=
YHAIRobotChatViewController
()
vc
.
isNeedShowBannerHeader
=
model
.
isNeedShowBannerHeader
()
vc
.
myTitle
=
model
.
title
vc
.
robotId
=
model
.
botId
vc
.
conversationId
=
sesseionId
vc
.
robotType
=
model
.
botType
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
}
}
}
}
}
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/M/YHAIMessageModel.swift
View file @
05eda689
...
@@ -41,15 +41,23 @@ class YHAIChatMessage: CustomStringConvertible {
...
@@ -41,15 +41,23 @@ class YHAIChatMessage: CustomStringConvertible {
var
isDone
:
Bool
=
false
var
isDone
:
Bool
=
false
var
body
=
YHAIMessageBody
()
var
body
=
YHAIMessageBody
()
func
isCompleted
()
->
Bool
{
func
isMessageCompleted
()
->
Bool
{
if
event
.
contains
(
completeText
)
{
if
self
.
body
.
status
==
"completed"
{
return
true
}
return
false
}
func
isTextCompleted
()
->
Bool
{
if
self
.
body
.
contentType
==
YHAIMessageType
.
text
.
rawValue
&&
self
.
body
.
status
==
"done"
&&
self
.
body
.
type
==
"answer"
{
return
true
return
true
}
}
return
false
return
false
}
}
func
setCompleted
()
{
func
setCompleted
()
{
event
=
self
.
completeText
self
.
body
.
status
=
"completed"
}
}
func
isTextMessage
()
->
Bool
{
func
isTextMessage
()
->
Bool
{
...
@@ -59,7 +67,7 @@ class YHAIChatMessage: CustomStringConvertible {
...
@@ -59,7 +67,7 @@ class YHAIChatMessage: CustomStringConvertible {
func
isNeedSpiceMessage
()
->
Bool
{
func
isNeedSpiceMessage
()
->
Bool
{
let
type
=
self
.
getType
()
let
type
=
self
.
getType
()
return
type
==
.
text
return
type
==
.
text
&&
self
.
body
.
type
==
"answer"
}
}
static
func
createQuestionMessage
(
_
text
:
String
)
->
YHAIChatMessage
{
static
func
createQuestionMessage
(
_
text
:
String
)
->
YHAIChatMessage
{
...
@@ -133,8 +141,8 @@ class YHAIChatMessage: CustomStringConvertible {
...
@@ -133,8 +141,8 @@ class YHAIChatMessage: CustomStringConvertible {
}
}
//
//
func
is
Not
UserfulMessage
()
->
Bool
{
func
isUserfulMessage
()
->
Bool
{
if
!
self
.
body
.
isStart
()
&&
!
self
.
isCompleted
()
&&
!
self
.
body
.
isDone
()
{
if
!
self
.
body
.
isStart
()
&&
!
self
.
body
.
isDone
()
{
return
true
return
true
}
}
return
false
return
false
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/V/YHAIProductCell.swift
View file @
05eda689
...
@@ -120,11 +120,6 @@ class YHAIProductCell: UICollectionViewCell {
...
@@ -120,11 +120,6 @@ class YHAIProductCell: UICollectionViewCell {
let
degree
=
isRotateRight
?
2.0
:
-
2.0
let
degree
=
isRotateRight
?
2.0
:
-
2.0
let
transform
=
CGAffineTransform
(
rotationAngle
:
CGFloat
(
degree
*
CGFloat
.
pi
/
180
))
// 2 度转换为弧度
let
transform
=
CGAffineTransform
(
rotationAngle
:
CGFloat
(
degree
*
CGFloat
.
pi
/
180
))
// 2 度转换为弧度
titleLabel
.
transform
=
transform
bgImgView
.
transform
=
transform
subtitleLabel
.
transform
=
transform
blackButton
.
transform
=
transform
if
model
.
cover
.
isEmpty
{
bgImgView
.
image
=
UIImage
(
named
:
isRotateRight
?
"ai_product_left"
:
"ai_product_right"
)
}
}
}
}
}
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/V/YHAITextMessageCell.swift
View file @
05eda689
...
@@ -68,7 +68,7 @@ class YHAITextMessageCell: UITableViewCell {
...
@@ -68,7 +68,7 @@ class YHAITextMessageCell: UITableViewCell {
}
else
{
}
else
{
isNeedShowCopyView
=
message
.
isDone
isNeedShowCopyView
=
message
.
isDone
let
complete
=
message
.
is
Completed
()
||
message
.
is
Done
let
complete
=
message
.
isDone
isNeedShowLoadingView
=
!
complete
isNeedShowLoadingView
=
!
complete
}
}
}
}
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/V/YHCardMessageCell.swift
View file @
05eda689
...
@@ -10,6 +10,7 @@ import UIKit
...
@@ -10,6 +10,7 @@ import UIKit
class
YHAIJumpPageTool
{
class
YHAIJumpPageTool
{
// mode = 0 // 1 web 2 原生页面 3 AI_Robot
// type = 0 // 0 普通 1 测评
// type = 0 // 0 普通 1 测评
static
func
jumpPageWithType
(
_
type
:
Int
=
0
,
mode
:
Int
,
path
:
String
,
block
:(([
String
:
Any
])
->
())?)
{
static
func
jumpPageWithType
(
_
type
:
Int
=
0
,
mode
:
Int
,
path
:
String
,
block
:(([
String
:
Any
])
->
())?)
{
...
@@ -26,8 +27,9 @@ class YHAIJumpPageTool {
...
@@ -26,8 +27,9 @@ class YHAIJumpPageTool {
vc
.
evaluationResultCallback
=
{
vc
.
evaluationResultCallback
=
{
dict
in
dict
in
block
?(
dict
)
block
?(
dict
)
UIViewController
.
current
?
.
present
(
vc
,
animated
:
true
)
}
}
UIViewController
.
current
?
.
present
(
vc
,
animated
:
true
)
}
else
{
}
else
{
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
...
@@ -47,6 +49,8 @@ class YHAIJumpPageTool {
...
@@ -47,6 +49,8 @@ class YHAIJumpPageTool {
vc
.
hideFlag
=
false
vc
.
hideFlag
=
false
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
}
else
if
mode
==
3
{
}
}
}
}
}
}
...
...
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