Commit 6d1f74bd by HoMeTown

feat: 新增了大于5轮弹出开启新对话的按钮

parent 0cbee674
......@@ -108,7 +108,7 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
)
return (
<div className="ask-input flex items-end w-full h-auto relative mx-auto bg-white rounded-[36px] overflow-hidden transition duration-200 py-[8px] pl-[12px] pr-[12px] sm:py-[12px] sm:pl-[32px] sm:pr-[20px]">
<div className="border-1 border-[#f6f6f6] ask-input flex items-end w-full h-auto relative mx-auto bg-white rounded-[36px] overflow-hidden transition duration-200 py-[8px] pl-[12px] pr-[12px] sm:py-[12px] sm:pl-[32px] sm:pr-[20px]">
<div
ref={editorRef}
contentEditable
......
......@@ -15,7 +15,7 @@ import { ChatEditor } from '@/components/ChatEditor'
import type { ChatRecord } from '@/types/chat'
import { fetchUserQaRecordPage } from '@/api/conversation'
import { fetchCheckTokenApi, fetchStreamResponse } from '@/api/chat'
import { clearShouldSendQuestion, fetchConversations } from '@/store/conversationSlice'
import { clearShouldSendQuestion, createConversation, fetchConversations } from '@/store/conversationSlice'
import type { RootState } from '@/store'
import { useAppDispatch, useAppSelector } from '@/store/hook'
import ScrollBtoIcon from '@/assets/svg/scrollBto.svg?react'
......@@ -190,6 +190,14 @@ export const Chat: React.FC = () => {
scrollableRef.current.scrollTo(scrollableRef.current.scrollHeight, { behavior: 'smooth' })
}
const handleCreateConversation = () => {
dispatch(createConversation({
conversationData: {},
shouldNavigate: true,
shouldSendQuestion: '',
}))
}
useEffect(() => {
if (id) {
if (!ignore) {
......@@ -227,6 +235,11 @@ export const Chat: React.FC = () => {
{record.role === 'ai' && <ChatAnswerBox onSubmitQuestion={handleSubmitQuestion} isLastAnswer={index === allItems.length - 1} showIndex={0} record={record} index={index} />}
</div>
))}
{allItems.length >= 11 && (
<div className="w-full chatItem max-w-[912px] mx-auto text-center">
<Button className="bg-white text-[#20ABD9] font-medium rounded-[20px] sm:w-auto" onPress={handleCreateConversation}>开启新对话 ➔</Button>
</div>
)}
</div>
</motion.div>
)}
......
......@@ -53,7 +53,7 @@ export const ChatAnswerBox: React.FC<ChatAnswerBoxProps> = ({ record, showIndex,
index === showIndex && (
<div className="chatItemBotContainer w-full" key={`${item.recordId}-${index}`}>
<div className="flex">
<Avatar className="sm:mr-[20px] hidden sm:block flex-shrink-0" src={AvatarBot} />
<Avatar className="sm:mr-[16px] hidden sm:block flex-shrink-0" src={AvatarBot} />
<div
className="bg-white rounded-[20px] box-border px-[16px] py-[12px] sm:px-[24px] sm:py-[20px] relative"
>
......
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