Commit 5b082fd7 by weiyudumei

feat: 历史记录中如果 firstQaFlag 为 true 则不展示该条 chatItem

parent eb862599
......@@ -949,6 +949,11 @@ export const Chat: React.FC = () => {
>
<div className={styles.inter}>
{allItems.map((record, index) => {
// 如果历史记录中 firstQaFlag 为 true,则不展示该条 chatItem
if (record.role === 'ai' && record.answerList?.[0]?.firstQaFlag === true) {
return null
}
const recordId = record.answerList?.[0]?.recordId || record.groupId
const uniqueKey = recordId
? `${record.role}-${recordId}`
......
......@@ -391,11 +391,11 @@ export const TacticsChat: React.FC = () => {
...prevItems,
...(shouldIncludeQuestion
? [
{
role: 'user',
question,
} as ChatRecord,
]
{
role: 'user',
question,
} as ChatRecord,
]
: []),
{
role: 'ai',
......@@ -500,12 +500,12 @@ export const TacticsChat: React.FC = () => {
if (extra?.recordId) {
requestBody.recordId = extra.recordId
}
// workFlowSessionId 的传递逻辑:
// 1. 如果是重新分析(isReanalyze === true),不传递 workFlowSessionId
// 2. 优先使用 extra 中的值
// 3. 如果都没有,从会话历史中找到最后一个有 workFlowSessionId 的答案
const isReanalyze = extra?.isReanalyze === true
// 注意:isReanalyze 已在上面声明(第 366 行),这里直接使用
if (!isReanalyze) {
if (extra?.workFlowSessionId) {
requestBody.workFlowSessionId = extra.workFlowSessionId
......@@ -1063,7 +1063,7 @@ export const TacticsChat: React.FC = () => {
if (recordId) {
extraParams.recordId = recordId
}
if (orderMeta) {
return handleSubmitQuestion(
question,
......@@ -1139,11 +1139,10 @@ export const TacticsChat: React.FC = () => {
type="button"
onClick={handleReanalyze}
disabled={!currentIdRef.current || isLoading || isAsking || isRecommendLoading}
className={`flex items-center gap-[4px] text-[14px] transition-opacity bg-transparent border-none outline-none ${
!currentIdRef.current || isLoading || isAsking || isRecommendLoading
? 'text-[#B2B8C1] cursor-not-allowed opacity-60'
: 'text-[#4A90E2] hover:opacity-80 cursor-pointer'
}`}
className={`flex items-center gap-[4px] text-[14px] transition-opacity bg-transparent border-none outline-none ${!currentIdRef.current || isLoading || isAsking || isRecommendLoading
? 'text-[#B2B8C1] cursor-not-allowed opacity-60'
: 'text-[#4A90E2] hover:opacity-80 cursor-pointer'
}`}
>
<RefreshIcon className="w-[16px] h-[16px] text-[#B2B8C1]" />
<span>重新分析</span>
......@@ -1196,6 +1195,10 @@ export const TacticsChat: React.FC = () => {
if (record.role === 'user' && !record.question) {
return null
}
// 如果历史记录中 firstQaFlag 为 true,则不展示该条 chatItem
if (record.role === 'ai' && record.answerList?.[0]?.firstQaFlag === true) {
return null
}
const matchedDivider = historyDividers.find(divider => divider.index === index + 1)
const recordId = record.answerList?.[0]?.recordId || record.groupId
const uniqueKey = recordId
......@@ -1214,7 +1217,7 @@ export const TacticsChat: React.FC = () => {
<div
className="w-full chatItem mx-auto"
>
{record.role === 'system' && <TacticsWelcome cleared={hasCleared} />}
{record.role === 'system' && <TacticsWelcome cleared={hasCleared} />}
{record.role === 'user' && <ChatItemUser record={record} />}
{record.role === 'ai' && (
<ChatAnswerBox
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment