fix: the try app always use the curent conversation

This commit is contained in:
Joel 2025-10-24 15:57:33 +08:00
parent 949bf38d3c
commit 0957ece92f
2 changed files with 5 additions and 4 deletions

View File

@ -167,7 +167,8 @@ const ChatWrapper = () => {
return chatList.filter(item => !item.isOpeningStatement)
}, [chatList, currentConversationId])
const [collapsed, setCollapsed] = useState(!!currentConversationId)
const isTryApp = appSourceType === AppSourceType.tryApp
const [collapsed, setCollapsed] = useState(!!currentConversationId && !isTryApp) // try app always use the new chat
const chatNode = useMemo(() => {
if (allInputsHidden || !inputsForms.length)
@ -240,7 +241,7 @@ const ChatWrapper = () => {
return (
<Chat
isTryApp={appSourceType === AppSourceType.tryApp}
isTryApp={isTryApp}
appData={appData || undefined}
config={appConfig}
chatList={messageList}

View File

@ -117,8 +117,8 @@ export const useEmbeddedChatbot = (appSourceType: AppSourceType, tryAppId?: stri
defaultValue: {},
})
const allowResetChat = !conversationId
const currentConversationId = useMemo(() => conversationIdInfo?.[appId || '']?.[userId || 'DEFAULT'] || conversationId || '',
[appId, conversationIdInfo, userId, conversationId])
const currentConversationId = useMemo(() => isTryApp ? '' : conversationIdInfo?.[appId || '']?.[userId || 'DEFAULT'] || conversationId || '',
[isTryApp, appId, conversationIdInfo, userId, conversationId])
const handleConversationIdInfoChange = useCallback((changeConversationId: string) => {
if (appId) {
let prevValue = conversationIdInfo?.[appId || '']