diff --git a/web/app/components/base/chat/embedded-chatbot/hooks.tsx b/web/app/components/base/chat/embedded-chatbot/hooks.tsx index 2f7cf23191..9fde01e037 100644 --- a/web/app/components/base/chat/embedded-chatbot/hooks.tsx +++ b/web/app/components/base/chat/embedded-chatbot/hooks.tsx @@ -388,12 +388,17 @@ export const useEmbeddedChatbot = (appSourceType: AppSourceType, tryAppId?: stri setClearChatList(false) }, [handleConversationIdInfoChange, setClearChatList]) const handleNewConversation = useCallback(async () => { + if (isTryApp) { + setClearChatList(true) + return + } + currentChatInstanceRef.current.handleStop() setShowNewConversationItemInList(true) handleChangeConversation('') handleNewConversationInputsChange(await getProcessedInputsFromUrlParams()) setClearChatList(true) - }, [handleChangeConversation, setShowNewConversationItemInList, handleNewConversationInputsChange, setClearChatList]) + }, [isTryApp, setShowNewConversationItemInList, handleNewConversationInputsChange, setClearChatList]) const handleNewConversationCompleted = useCallback((newConversationId: string) => { setNewConversationId(newConversationId) diff --git a/web/app/components/explore/try-app/app/chat.tsx b/web/app/components/explore/try-app/app/chat.tsx index 501b275535..745cc0bc62 100644 --- a/web/app/components/explore/try-app/app/chat.tsx +++ b/web/app/components/explore/try-app/app/chat.tsx @@ -17,6 +17,10 @@ import { useTranslation } from 'react-i18next' import { useBoolean } from 'ahooks' import type { TryAppInfo } from '@/service/try-app' import AppIcon from '@/app/components/base/app-icon' +import Tooltip from '@/app/components/base/tooltip' +import ActionButton from '@/app/components/base/action-button' +import { RiResetLeftLine } from '@remixicon/react' +import ViewFormDropdown from '@/app/components/base/chat/embedded-chatbot/inputs-form/view-form-dropdown' type Props = { appId: string @@ -34,7 +38,8 @@ const TryApp: FC = ({ const isMobile = media === MediaType.mobile const themeBuilder = useThemeContext() const { removeConversationIdInfo, ...chatData } = useEmbeddedChatbot(AppSourceType.tryApp, appId) - + const currentConversationId = chatData.currentConversationId + const inputsForms = chatData.inputsForms useEffect(() => { if (appId) removeConversationIdInfo(appId) @@ -42,6 +47,11 @@ const TryApp: FC = ({ const [isHideTryNotice, { setTrue: hideTryNotice, }] = useBoolean(false) + + const handleNewConversation = () => { + removeConversationIdInfo(appId) + chatData.handleNewConversation() + } return ( = ({ />
{appDetail.name}
+
+ {currentConversationId && ( + + + + + + )} + {currentConversationId && inputsForms.length > 0 && ( + + )} +
{!isHideTryNotice && (