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
1c9672c1
Commit
1c9672c1
authored
Dec 17, 2025
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:A01时隐藏回答中的操作按钮
parent
47f1d0df
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
6 deletions
+28
-6
src/pages/Chat/components/ChatItem/ChatAnswerBox.tsx
+21
-3
src/pages/Chat/components/ChatItem/ChatAnswerShower.tsx
+6
-3
src/types/chat.ts
+1
-0
No files found.
src/pages/Chat/components/ChatItem/ChatAnswerBox.tsx
View file @
1c9672c1
import
{
Avatar
,
Button
}
from
'@heroui/react'
import
{
useEffect
,
useState
}
from
'react'
import
{
useEffect
,
use
Memo
,
use
State
}
from
'react'
import
{
ChatAnswerShower
}
from
'./ChatAnswerShower'
import
{
ChatAnswerParser
}
from
'./ChatAnswerParser'
import
{
ChatAnswerRecommend
}
from
'./ChatAnswerRecommend'
...
...
@@ -49,16 +49,34 @@ export const ChatAnswerBox: React.FC<ChatAnswerBoxProps> = ({ record, showIndex,
setInnerRecord
(
record
)
},
[
record
])
// 检查 sessionStorage 中是否存在 from=tactics
const
hasFromTactics
=
useMemo
(()
=>
{
try
{
const
raw
=
sessionStorage
.
getItem
(
'tacticsMeta'
)
if
(
!
raw
)
{
return
false
}
const
parsed
=
JSON
.
parse
(
raw
)
return
parsed
?.
from
===
'tactics'
}
catch
{
return
false
}
},
[])
/**
* 当当前 AI 记录没有对应的问题文本时(例如策略页进入会话后的自动分析、
* 点击「重新分析」触发的自动问题),需要隐藏点赞 / 点踩 / 复制按钮。
* 对于正常问答(有用户问题)则保持原有行为。
* 当 recordType 为 A01 且 sessionStorage 中存在 from=tactics 时,也需要隐藏点赞 / 点踩 / 复制按钮。
*/
const
hideOperateForRecord
=
!
innerRecord
.
question
return
(
<
div
>
{
innerRecord
.
answerList
.
map
((
item
,
index
)
=>
{
// 检查当前项的 recordType,如果是 A01 且 sessionStorage 中存在 from=tactics 则隐藏操作按钮
const
shouldHideOperate
=
hideOperateForRecord
||
(
hasFromTactics
&&
item
.
recordType
===
'A01'
)
return
(
index
===
showIndex
&&
(
<
div
className=
"chatItemBotContainer w-full"
key=
{
`${item.recordId}-${index}`
}
>
...
...
@@ -79,7 +97,7 @@ export const ChatAnswerBox: React.FC<ChatAnswerBoxProps> = ({ record, showIndex,
onSubmitQuestion=
{
onSubmitQuestion
}
isLastAnswer=
{
isLastAnswer
}
answer=
{
item
}
hideOperate=
{
hideOperateForRecord
}
hideOperate=
{
shouldHideOperate
}
/>
)
}
{
!
item
.
isShow
&&
!
item
.
isChatMaxCount
&&
(
...
...
@@ -90,7 +108,7 @@ export const ChatAnswerBox: React.FC<ChatAnswerBoxProps> = ({ record, showIndex,
onTyping=
{
handleTyping
}
onComplate=
{
()
=>
handleComplate
(
item
)
}
answer=
{
item
}
hideOperate=
{
hideOperateForRecord
}
hideOperate=
{
shouldHideOperate
}
/>
)
}
{
!
item
.
isShow
&&
item
.
isChatMaxCount
&&
<
ChatMaxCount
/>
}
...
...
src/pages/Chat/components/ChatItem/ChatAnswerShower.tsx
View file @
1c9672c1
import
React
from
'react'
import
{
formatMarkdown
}
from
'./markdownFormatter'
import
{
ChatAnswerAttachment
}
from
'./ChatAnswerAttchment'
import
{
ChatAnswerOperate
}
from
'./ChatAnswerOperate'
...
...
@@ -8,10 +9,12 @@ interface ChatAnswerShowerProps {
answer
:
Answer
isLastAnswer
:
boolean
onSubmitQuestion
:
(
question
:
string
)
=>
void
hideOperate
?:
boolean
}
export
const
ChatAnswerShower
:
React
.
FC
<
ChatAnswerShowerProps
>
=
({
answer
,
isLastAnswer
,
onSubmitQuestion
})
=>
{
const
hideOperate
=
(
answer
.
cardList
||
[]).
some
(
attachment
=>
attachment
.
type
===
'box'
||
attachment
?.
type
?.
includes
(
'card-'
))
export
const
ChatAnswerShower
:
React
.
FC
<
ChatAnswerShowerProps
>
=
({
answer
,
isLastAnswer
,
onSubmitQuestion
,
hideOperate
:
hideOperateProp
})
=>
{
const
hideOperateByCard
=
(
answer
.
cardList
||
[]).
some
(
attachment
=>
attachment
.
type
===
'box'
||
attachment
?.
type
?.
includes
(
'card-'
))
const
hideOperate
=
hideOperateByCard
||
hideOperateProp
return
(
<
div
className=
"answerShower"
>
{
answer
.
answer
&&
(
...
...
@@ -23,7 +26,7 @@ export const ChatAnswerShower: React.FC<ChatAnswerShowerProps> = ({ answer, isLa
)
}
{
answer
.
cardList
&&
answer
.
cardList
?.
length
!==
0
&&
<
ChatAnswerAttachment
onSubmitQuestion=
{
onSubmitQuestion
}
isLastAnswer=
{
isLastAnswer
}
answer=
{
answer
}
/>
}
{
/* {} */
}
{
!
hideOperate
&&
<
ChatAnswerOperate
answer=
{
answer
}
/>
}
{
!
hideOperate
&&
<
ChatAnswerOperate
answer=
{
answer
}
hideFeedbackAndCopy=
{
hideOperateProp
}
/>
}
<
div
className=
"flex text-[10px] right-[16px] text-[#d0d1d2] bottom-[4px]"
>
AI生成
</
div
>
</
div
>
)
...
...
src/types/chat.ts
View file @
1c9672c1
...
...
@@ -48,6 +48,7 @@ export interface Answer {
toolId
?:
string
cardList
:
Attachment
[]
step
?:
AnswerStep
recordType
?:
string
}
export
interface
OriginalRecord
{
...
...
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