diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/build-chat.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/build-chat.tsx index f7dc441aabe..4a04587549e 100644 --- a/web/features/agent-v2/agent-detail/configure/components/preview/build-chat.tsx +++ b/web/features/agent-v2/agent-detail/configure/components/preview/build-chat.tsx @@ -8,11 +8,13 @@ const buildIconGridCells = Array.from({ length: 16 }, (_, index) => `build-icon- type AgentBuildChatProps = Omit -function AgentBuildChatEmptyState() { +function AgentBuildChatEmptyState({ + inputNode, +}: AgentChatRuntimeEmptyStateProps) { const { t } = useTranslation('agentV2') return ( -
+
@@ -28,6 +30,7 @@ function AgentBuildChatEmptyState() {

{t('agentDetail.configure.build.empty.description')}

+ {inputNode}
) @@ -40,8 +43,8 @@ export function AgentBuildChat(props: AgentBuildChatProps) { ( - + renderEmptyState={(emptyStateProps: AgentChatRuntimeEmptyStateProps) => ( + )} /> ) diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/chat-runtime.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/chat-runtime.tsx index f01066c415e..0908fb0b7d0 100644 --- a/web/features/agent-v2/agent-detail/configure/components/preview/chat-runtime.tsx +++ b/web/features/agent-v2/agent-detail/configure/components/preview/chat-runtime.tsx @@ -23,6 +23,7 @@ import { cn } from '@langgenius/dify-ui/cn' import { useQuery } from '@tanstack/react-query' import { useAtomValue } from 'jotai' import { useCallback, useMemo } from 'react' +import ChatInputArea from '@/app/components/base/chat/chat/chat-input-area' import { useChat } from '@/app/components/base/chat/chat/hooks' import { buildChatItemTree, getLastAnswer, isValidGeneratedAnswer } from '@/app/components/base/chat/utils' import { getProcessedFilesFromResponse } from '@/app/components/base/file-uploader/utils' @@ -395,6 +396,7 @@ export type AgentChatRuntimeEmptyStateProps = { agentIconType?: AgentIconType | null agentName?: string hasInstructions: boolean + inputNode: ReactNode } export type AgentChatRuntimeProps = { @@ -587,6 +589,21 @@ function AgentPreviewChatSession({ }, [chatList, doSend]) const isEmptyChat = chatList.length === 0 const hasInstructions = !!config.pre_prompt.trim() + const emptyChatInputNode = ( +
+ +
+ ) return ( setTargetMessageId(siblingMessageId)} onStopResponding={handleStop} + noChatInput={isEmptyChat} showPromptLog questionIcon={} onAnnotationEdited={handleAnnotationEdited} diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/preview-chat.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/preview-chat.tsx index bd1ca6ed999..a112cac7f3a 100644 --- a/web/features/agent-v2/agent-detail/configure/components/preview/preview-chat.tsx +++ b/web/features/agent-v2/agent-detail/configure/components/preview/preview-chat.tsx @@ -13,13 +13,14 @@ function AgentPreviewChatEmptyState({ agentIconType, agentName, hasInstructions, + inputNode, }: AgentChatRuntimeEmptyStateProps) { const { t } = useTranslation('agentV2') const imageUrl = (agentIconType === 'image' || agentIconType === 'link') ? agentIcon : undefined const iconType = imageUrl ? 'image' : agentIconType return ( -
+
)} + {inputNode}
)