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
9a06c24b
Commit
9a06c24b
authored
Dec 12, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// AI
parent
2a84e42d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
22 deletions
+45
-22
YHAIMainChatViewController.swift
...s/AI/AI-Dialogue(AI对话)/C/YHAIMainChatViewController.swift
+17
-7
YHAIRobotChatViewController.swift
.../AI/AI-Dialogue(AI对话)/C/YHAIRobotChatViewController.swift
+17
-7
YHAITextMessageCell.swift
.../Modules/AI/AI-Dialogue(AI对话)/V/YHAITextMessageCell.swift
+11
-8
No files found.
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/C/YHAIMainChatViewController.swift
View file @
9a06c24b
...
@@ -382,14 +382,24 @@ extension YHAIMainChatViewController: UITableViewDelegate, UITableViewDataSource
...
@@ -382,14 +382,24 @@ extension YHAIMainChatViewController: UITableViewDelegate, UITableViewDataSource
if
msgType
!=
.
text
{
if
msgType
!=
.
text
{
return
UITableView
.
automaticDimension
return
UITableView
.
automaticDimension
}
}
let
text
=
message
.
body
.
contentText
// 要显示的文本内容
let
font
=
UIFont
.
PFSC_R
(
ofSize
:
14
)
// 字体大小
let
maxWidth
=
KScreenWidth
-
20*
2
-
16*
2
// 最大宽度限制
let
attributes
=
[
NSAttributedString
.
Key
.
font
:
font
]
as
[
NSAttributedString
.
Key
:
Any
]
let
label
=
UILabel
()
let
size
=
(
text
as
NSString
)
.
boundingRect
(
with
:
CGSize
(
width
:
maxWidth
,
height
:
.
greatestFiniteMagnitude
),
options
:
.
usesLineFragmentOrigin
,
attributes
:
attributes
,
context
:
nil
)
.
size
label
.
textAlignment
=
.
left
label
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
14
)
label
.
numberOfLines
=
0
let
paragraphStyle
=
NSMutableParagraphStyle
()
paragraphStyle
.
lineSpacing
=
4.0
let
attributedText
=
NSAttributedString
(
string
:
message
.
body
.
contentText
,
attributes
:
[
NSAttributedString
.
Key
.
paragraphStyle
:
paragraphStyle
,
NSAttributedString
.
Key
.
font
:
UIFont
.
PFSC_R
(
ofSize
:
14
)]
)
label
.
attributedText
=
attributedText
let
maxWidth
=
KScreenWidth
-
20*
2
-
16*
2
// 最大宽度限制
let
size
=
label
.
sizeThatFits
(
CGSize
(
width
:
maxWidth
,
height
:
.
greatestFiniteMagnitude
))
var
textHeight
=
ceil
(
size
.
height
)
var
textHeight
=
ceil
(
size
.
height
)
if
textHeight
<
20.0
{
if
textHeight
<
20.0
{
textHeight
=
20.0
textHeight
=
20.0
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/C/YHAIRobotChatViewController.swift
View file @
9a06c24b
...
@@ -516,14 +516,24 @@ extension YHAIRobotChatViewController: UITableViewDelegate, UITableViewDataSourc
...
@@ -516,14 +516,24 @@ extension YHAIRobotChatViewController: UITableViewDelegate, UITableViewDataSourc
if
msgType
!=
.
text
{
if
msgType
!=
.
text
{
return
UITableView
.
automaticDimension
return
UITableView
.
automaticDimension
}
}
let
text
=
message
.
body
.
contentText
// 要显示的文本内容
let
font
=
UIFont
.
PFSC_R
(
ofSize
:
14
)
// 字体大小
let
maxWidth
=
KScreenWidth
-
20*
2
-
16*
2
// 最大宽度限制
let
attributes
=
[
NSAttributedString
.
Key
.
font
:
font
]
as
[
NSAttributedString
.
Key
:
Any
]
let
label
=
UILabel
()
let
size
=
(
text
as
NSString
)
.
boundingRect
(
with
:
CGSize
(
width
:
maxWidth
,
height
:
.
greatestFiniteMagnitude
),
options
:
.
usesLineFragmentOrigin
,
attributes
:
attributes
,
context
:
nil
)
.
size
label
.
textAlignment
=
.
left
label
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
14
)
label
.
numberOfLines
=
0
let
paragraphStyle
=
NSMutableParagraphStyle
()
paragraphStyle
.
lineSpacing
=
4.0
let
attributedText
=
NSAttributedString
(
string
:
message
.
body
.
contentText
,
attributes
:
[
NSAttributedString
.
Key
.
paragraphStyle
:
paragraphStyle
,
NSAttributedString
.
Key
.
font
:
UIFont
.
PFSC_R
(
ofSize
:
14
)]
)
label
.
attributedText
=
attributedText
let
maxWidth
=
KScreenWidth
-
20*
2
-
16*
2
// 最大宽度限制
let
size
=
label
.
sizeThatFits
(
CGSize
(
width
:
maxWidth
,
height
:
.
greatestFiniteMagnitude
))
var
textHeight
=
ceil
(
size
.
height
)
var
textHeight
=
ceil
(
size
.
height
)
if
textHeight
<
20.0
{
if
textHeight
<
20.0
{
textHeight
=
20.0
textHeight
=
20.0
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/V/YHAITextMessageCell.swift
View file @
9a06c24b
...
@@ -18,15 +18,22 @@ class YHAITextMessageCell: UITableViewCell {
...
@@ -18,15 +18,22 @@ class YHAITextMessageCell: UITableViewCell {
var
message
:
YHAIChatMessage
=
YHAIChatMessage
()
{
var
message
:
YHAIChatMessage
=
YHAIChatMessage
()
{
didSet
{
didSet
{
messageLabel
.
text
=
message
.
body
.
contentText
let
paragraphStyle
=
NSMutableParagraphStyle
()
paragraphStyle
.
lineSpacing
=
4.0
let
textColor
:
UIColor
=
message
.
isSelf
?
.
white
:
.
mainTextColor
let
attributedText
=
NSAttributedString
(
string
:
message
.
body
.
contentText
,
attributes
:
[
NSAttributedString
.
Key
.
paragraphStyle
:
paragraphStyle
,
NSAttributedString
.
Key
.
foregroundColor
:
textColor
,
NSAttributedString
.
Key
.
font
:
UIFont
.
PFSC_R
(
ofSize
:
14
)]
)
messageLabel
.
attributedText
=
attributedText
rightAngleView
.
backgroundColor
=
message
.
isSelf
?
.
brandMainColor
:
.
white
rightAngleView
.
backgroundColor
=
message
.
isSelf
?
.
brandMainColor
:
.
white
rightAngleView
.
isHidden
=
message
.
getType
()
!=
.
text
rightAngleView
.
isHidden
=
message
.
getType
()
!=
.
text
if
message
.
isSelf
{
if
message
.
isSelf
{
whiteContentView
.
backgroundColor
=
.
brandMainColor
whiteContentView
.
backgroundColor
=
.
brandMainColor
messageLabel
.
textColor
=
.
white
whiteContentView
.
snp
.
remakeConstraints
{
make
in
whiteContentView
.
snp
.
remakeConstraints
{
make
in
make
.
left
.
greaterThanOrEqualTo
(
20
)
make
.
left
.
greaterThanOrEqualTo
(
20
)
make
.
right
.
equalTo
(
-
20
)
make
.
right
.
equalTo
(
-
20
)
...
@@ -45,11 +52,7 @@ class YHAITextMessageCell: UITableViewCell {
...
@@ -45,11 +52,7 @@ class YHAITextMessageCell: UITableViewCell {
}
else
{
}
else
{
messageLabel
.
text
=
message
.
body
.
contentText
whiteContentView
.
backgroundColor
=
.
white
whiteContentView
.
backgroundColor
=
.
white
messageLabel
.
textColor
=
.
mainTextColor
whiteContentView
.
snp
.
remakeConstraints
{
make
in
whiteContentView
.
snp
.
remakeConstraints
{
make
in
make
.
left
.
equalTo
(
20
)
make
.
left
.
equalTo
(
20
)
if
message
.
getType
()
==
.
recommendText
{
if
message
.
getType
()
==
.
recommendText
{
...
...
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