Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sdream-ai-fe
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
侯明涛
sdream-ai-fe
Commits
974b0191
Commit
974b0191
authored
Jan 23, 2026
by
weiyudumei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复隐藏逻辑,只隐藏答案文本部分,保留 ChatAnswerAttachment 渲染以确保 CardWorkflowForm 的自动提交逻辑能够正常执行
parent
5c59a5d0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
src/pages/Chat/components/ChatItem/ChatAnswerParser.tsx
+8
-7
src/pages/Chat/components/ChatItem/ChatAnswerShower.tsx
+6
-7
No files found.
src/pages/Chat/components/ChatItem/ChatAnswerParser.tsx
View file @
974b0191
...
...
@@ -178,15 +178,15 @@ export const ChatAnswerParser: React.FC<ChatAnswerParserProps> = ({ isLastAnswer
const
shouldHideOperate
=
hideOperateByCard
||
hideOperate
// 如果 firstQaFlag 为 true 且存在 workflow 卡片,隐藏整个答案内容(表单会自动提交,用户不需要看到这次的结果)
// 如果 firstQaFlag 为 true 且存在 workflow 卡片,隐藏答案文本(表单会自动提交,用户不需要看到这次的结果)
// 但保留 ChatAnswerAttachment 的渲染,确保 CardWorkflowForm 的自动提交逻辑能够执行
const
hasWorkflowCard
=
(
answer
.
cardList
||
[]).
some
(
attachment
=>
attachment
.
type
===
'card-workflow'
)
if
(
answer
.
firstQaFlag
===
true
&&
hasWorkflowCard
)
{
return
null
}
const
shouldHideAnswerText
=
answer
.
firstQaFlag
===
true
&&
hasWorkflowCard
return
(
<
div
className=
"answerParser"
>
{
!
shouldHideAnswerText
&&
(
<
div
className=
"mb-[8px]"
>
{
/* <Chip color="primary" className="mb-[12px]">{answer.step?.message}</Chip> */
}
{
answer
.
step
?.
step
===
'answering'
&&
(
...
...
@@ -200,8 +200,9 @@ export const ChatAnswerParser: React.FC<ChatAnswerParserProps> = ({ isLastAnswer
</
Chip
>
)
}
</
div
>
)
}
{
!!
displayedText
.
length
&&
(
{
!!
displayedText
.
length
&&
!
shouldHideAnswerText
&&
(
<
div
style=
{
{
background
:
'#F7FAFD'
}
}
className=
{
answer
.
cardList
?.
length
?
'mb-[20px]'
:
''
}
>
<
MarkdownDetail
>
{
displayedText
}
...
...
@@ -223,9 +224,9 @@ export const ChatAnswerParser: React.FC<ChatAnswerParserProps> = ({ isLastAnswer
)
}
{
/* 操作区:仅根据卡片类型 / 上层显式 hideOperate 控制是否展示 */
}
{
!
isTyping
&&
!
shouldHideOperate
&&
<
ChatAnswerOperate
answer=
{
answer
}
/>
}
{
!
isTyping
&&
!
shouldHideOperate
&&
!
shouldHideAnswerText
&&
<
ChatAnswerOperate
answer=
{
answer
}
/>
}
{
!
isTyping
&&
<
div
className=
"flex text-[10px] right-[16px] text-[#d0d1d2] bottom-[4px]"
>
AI生成
</
div
>
}
{
!
isTyping
&&
!
shouldHideAnswerText
&&
<
div
className=
"flex text-[10px] right-[16px] text-[#d0d1d2] bottom-[4px]"
>
AI生成
</
div
>
}
</
div
>
)
}
src/pages/Chat/components/ChatItem/ChatAnswerShower.tsx
View file @
974b0191
...
...
@@ -19,15 +19,14 @@ export const ChatAnswerShower: React.FC<ChatAnswerShowerProps> = ({ answer, isLa
const
hideOperateByCard
=
(
answer
.
cardList
||
[]).
some
(
attachment
=>
attachment
.
type
===
'box'
||
attachment
?.
type
?.
includes
(
'card-'
))
const
hideOperate
=
hideOperateByCard
||
hideOperateProp
// 如果 firstQaFlag 为 true 且存在 workflow 卡片,隐藏整个答案内容(表单会自动提交,用户不需要看到这次的结果)
// 如果 firstQaFlag 为 true 且存在 workflow 卡片,隐藏答案文本(表单会自动提交,用户不需要看到这次的结果)
// 但保留 ChatAnswerAttachment 的渲染,确保 CardWorkflowForm 的自动提交逻辑能够执行
const
hasWorkflowCard
=
(
answer
.
cardList
||
[]).
some
(
attachment
=>
attachment
.
type
===
'card-workflow'
)
if
(
answer
.
firstQaFlag
===
true
&&
hasWorkflowCard
)
{
return
null
}
const
shouldHideAnswerText
=
answer
.
firstQaFlag
===
true
&&
hasWorkflowCard
return
(
<
div
className=
"answerShower"
>
{
answer
.
answer
&&
(
{
answer
.
answer
&&
!
shouldHideAnswerText
&&
(
<
div
className=
{
answer
.
cardList
?.
length
?
'mb-[12px] sm:mb-[20px]'
:
''
}
>
<
MarkdownDetail
>
{
formatMarkdown
(
answer
.
answer
||
''
)
}
...
...
@@ -45,8 +44,8 @@ export const ChatAnswerShower: React.FC<ChatAnswerShowerProps> = ({ answer, isLa
/>
)
}
{
/* 操作区:仅根据卡片类型 / 上层显式 hideOperate 控制是否展示 */
}
{
!
hideOperate
&&
<
ChatAnswerOperate
answer=
{
answer
}
/>
}
<
div
className=
"flex text-[10px] right-[16px] text-[#d0d1d2] bottom-[4px]"
>
AI生成
</
div
>
{
!
hideOperate
&&
!
shouldHideAnswerText
&&
<
ChatAnswerOperate
answer=
{
answer
}
/>
}
{
!
shouldHideAnswerText
&&
<
div
className=
"flex text-[10px] right-[16px] text-[#d0d1d2] bottom-[4px]"
>
AI生成
</
div
>
}
</
div
>
)
}
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