Commit 54cf870d authored by 金伟强's avatar 金伟强

fix: show intro logic problem

parent efbc8468
...@@ -46,6 +46,7 @@ export type IChatProps = { ...@@ -46,6 +46,7 @@ export type IChatProps = {
suggestionList?: string[] suggestionList?: string[]
isShowSpeechToText?: boolean isShowSpeechToText?: boolean
answerIconClassName?: string answerIconClassName?: string
isShowConfigElem?: boolean
} }
const Chat: FC<IChatProps> = ({ const Chat: FC<IChatProps> = ({
...@@ -69,6 +70,7 @@ const Chat: FC<IChatProps> = ({ ...@@ -69,6 +70,7 @@ const Chat: FC<IChatProps> = ({
suggestionList, suggestionList,
isShowSpeechToText, isShowSpeechToText,
answerIconClassName, answerIconClassName,
isShowConfigElem,
}) => { }) => {
const { t } = useTranslation() const { t } = useTranslation()
const { notify } = useContext(ToastContext) const { notify } = useContext(ToastContext)
...@@ -145,13 +147,11 @@ const Chat: FC<IChatProps> = ({ ...@@ -145,13 +147,11 @@ const Chat: FC<IChatProps> = ({
}) })
} }
const hasChatStart = chatList.some(item => !item.isAnswer)
return ( return (
<div className={cn('px-3.5', 'h-full')}> <div className={cn('px-3.5', 'h-full')}>
{!hasChatStart && (configElem || null)} {isShowConfigElem && (configElem || null)}
{/* Chat List */} {/* Chat List */}
<div className={cn((!hasChatStart && configElem) ? 'h-0' : 'h-full', 'space-y-[30px]')}> <div className={cn((isShowConfigElem && configElem) ? 'h-0' : 'h-full', 'space-y-[30px]')}>
{chatList.map((item) => { {chatList.map((item) => {
if (item.isAnswer) { if (item.isAnswer) {
const isLast = item.id === chatList[chatList.length - 1].id const isLast = item.id === chatList[chatList.length - 1].id
......
...@@ -472,7 +472,6 @@ const Main: FC<IMainProps> = () => { ...@@ -472,7 +472,6 @@ const Main: FC<IMainProps> = () => {
setAbortController(abortController) setAbortController(abortController)
}, },
onData: (message: string, isFirstMessage: boolean, { conversationId: newConversationId, messageId, taskId }: any) => { onData: (message: string, isFirstMessage: boolean, { conversationId: newConversationId, messageId, taskId }: any) => {
// console.log('get message...')
responseItem.content = responseItem.content + message responseItem.content = responseItem.content + message
responseItem.id = messageId responseItem.id = messageId
if (isFirstMessage && newConversationId) if (isFirstMessage && newConversationId)
...@@ -511,7 +510,6 @@ const Main: FC<IMainProps> = () => { ...@@ -511,7 +510,6 @@ const Main: FC<IMainProps> = () => {
}, },
onThought(thought) { onThought(thought) {
// thought then start to return message // thought then start to return message
// console.log('thought...');
(responseItem as any).agent_thoughts.push(thought) (responseItem as any).agent_thoughts.push(thought)
}, },
onError() { onError() {
...@@ -626,6 +624,7 @@ const Main: FC<IMainProps> = () => { ...@@ -626,6 +624,7 @@ const Main: FC<IMainProps> = () => {
)} )}
<div className={cn((!isNewConversation || isResponsing) && 'pt-[90px]', 'pc:w-[794px] max-w-full mobile:w-full mx-auto h-full overflow-y-auto')} ref={chatListDomRef}> <div className={cn((!isNewConversation || isResponsing) && 'pt-[90px]', 'pc:w-[794px] max-w-full mobile:w-full mx-auto h-full overflow-y-auto')} ref={chatListDomRef}>
<Chat <Chat
isShowConfigElem={isNewConversation && !chatList.some(item => item.isAnswer)}
configElem={<Init configElem={<Init
modelId={modelId} modelId={modelId}
onModelChange={setModeId} onModelChange={setModeId}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment