feat: option to hide workflow steps (#5436)

This commit is contained in:
crazywoola
2024-06-21 12:51:10 +08:00
committed by GitHub
parent 1336b844fd
commit 92ddb410cd
29 changed files with 165 additions and 9 deletions

View File

@@ -20,6 +20,7 @@ import LoadingAnim from '@/app/components/app/chat/loading-anim'
import Citation from '@/app/components/app/chat/citation'
import { EditTitle } from '@/app/components/app/annotation/edit-annotation-modal/edit-item'
import type { Emoji } from '@/app/components/tools/types'
import type { AppData } from '@/models/share'
type AnswerProps = {
item: ChatItem
@@ -32,6 +33,7 @@ type AnswerProps = {
showPromptLog?: boolean
chatAnswerContainerInner?: string
hideProcessDetail?: boolean
appData?: AppData
}
const Answer: FC<AnswerProps> = ({
item,
@@ -44,6 +46,7 @@ const Answer: FC<AnswerProps> = ({
showPromptLog,
chatAnswerContainerInner,
hideProcessDetail,
appData,
}) => {
const { t } = useTranslation()
const {
@@ -129,8 +132,20 @@ const Answer: FC<AnswerProps> = ({
/>
)
}
{/** Render the normal steps */}
{
workflowProcess && (
workflowProcess && !hideProcessDetail && (
<WorkflowProcess
data={workflowProcess}
item={item}
hideInfo
hideProcessDetail={hideProcessDetail}
/>
)
}
{/** Hide workflow steps by it's settings in siteInfo */}
{
workflowProcess && hideProcessDetail && appData && appData.site.show_workflow_steps && (
<WorkflowProcess
data={workflowProcess}
item={item}

View File

@@ -30,8 +30,10 @@ import { StopCircle } from '@/app/components/base/icons/src/vender/solid/mediaAn
import AgentLogModal from '@/app/components/base/agent-log-modal'
import PromptLogModal from '@/app/components/base/prompt-log-modal'
import { useStore as useAppStore } from '@/app/components/app/store'
import type { AppData } from '@/models/share'
export type ChatProps = {
appData?: AppData
chatList: ChatItem[]
config?: ChatConfig
isResponding?: boolean
@@ -57,6 +59,7 @@ export type ChatProps = {
hideProcessDetail?: boolean
}
const Chat: FC<ChatProps> = ({
appData,
config,
onSend,
chatList,
@@ -196,6 +199,7 @@ const Chat: FC<ChatProps> = ({
const isLast = item.id === chatList[chatList.length - 1]?.id
return (
<Answer
appData={appData}
key={item.id}
item={item}
question={chatList[index - 1]?.content}