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

@@ -29,6 +29,7 @@ const ChatWrapper = () => {
appMeta,
handleFeedback,
currentChatInstanceRef,
appData,
} = useChatWithHistoryContext()
const appConfig = useMemo(() => {
const config = appParams || {}
@@ -128,6 +129,7 @@ const ChatWrapper = () => {
return (
<Chat
appData={appData}
config={appConfig}
chatList={chatList}
isResponding={isResponding}

View File

@@ -47,7 +47,14 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {
const { id, app } = installedAppInfo!
return {
app_id: id,
site: { title: app.name, icon: app.icon, icon_background: app.icon_background, prompt_public: false, copyright: '' },
site: {
title: app.name,
icon: app.icon,
icon_background: app.icon_background,
prompt_public: false,
copyright: '',
show_workflow_steps: true,
},
plan: 'basic',
} as AppData
}

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}

View File

@@ -18,6 +18,7 @@ import LogoAvatar from '@/app/components/base/logo/logo-embeded-chat-avatar'
const ChatWrapper = () => {
const {
appData,
appParams,
appPrevChatList,
currentConversationId,
@@ -114,6 +115,7 @@ const ChatWrapper = () => {
return (
<Chat
appData={appData}
config={appConfig}
chatList={chatList}
isResponding={isResponding}