Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sdream-ai-fe
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
侯明涛
sdream-ai-fe
Commits
6d1f74bd
Commit
6d1f74bd
authored
Feb 19, 2025
by
HoMeTown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增了大于5轮弹出开启新对话的按钮
parent
0cbee674
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
3 deletions
+16
-3
src/components/ChatEditor/index.tsx
+1
-1
src/pages/Chat/Chat.tsx
+14
-1
src/pages/Chat/components/ChatItem/ChatAnswerBox.tsx
+1
-1
No files found.
src/components/ChatEditor/index.tsx
View file @
6d1f74bd
...
...
@@ -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
...
...
src/pages/Chat/Chat.tsx
View file @
6d1f74bd
...
...
@@ -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
>
)
}
...
...
src/pages/Chat/components/ChatItem/ChatAnswerBox.tsx
View file @
6d1f74bd
...
...
@@ -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-[
20
px] hidden sm:block flex-shrink-0"
src=
{
AvatarBot
}
/>
<
Avatar
className=
"sm:mr-[
16
px] 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"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment