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
69e6c37f
Commit
69e6c37f
authored
Sep 02, 2024
by
HoMeTown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: loading
parent
8f0d869b
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
8 deletions
+21
-8
src/assets/tetsloading.gif
+0
-0
src/components/SdreamLoading/index.tsx
+10
-0
src/pages/Chat/Chat.tsx
+3
-2
src/pages/Chat/components/ChatItem/ChatAnswerBox.tsx
+3
-2
src/pages/Chat/components/ChatItem/ChatAnswerParser.tsx
+2
-2
src/pages/Collect/Collect.tsx
+3
-2
No files found.
src/assets/tetsloading.gif
0 → 100644
View file @
69e6c37f
96.3 KB
src/components/SdreamLoading/index.tsx
0 → 100644
View file @
69e6c37f
import
React
from
'react'
import
LoadingGif
from
'@/assets/tetsloading.gif'
const
SdreamLoading
:
React
.
FC
=
()
=>
{
return
(
<
img
className=
"w-[26px] h-[26px]"
src=
{
LoadingGif
}
alt=
""
/>
)
}
export
default
SdreamLoading
src/pages/Chat/Chat.tsx
View file @
69e6c37f
import
React
,
{
useCallback
,
useEffect
,
useRef
,
useState
}
from
'react'
import
{
useParams
}
from
'react-router-dom'
import
{
Button
,
Spinner
}
from
'@nextui-org/react'
import
{
Button
}
from
'@nextui-org/react'
import
{
motion
}
from
'framer-motion'
import
{
useScroll
}
from
'ahooks'
import
styles
from
'./Chat.module.less'
...
...
@@ -20,6 +20,7 @@ import type { RootState } from '@/store'
import
{
useAppDispatch
,
useAppSelector
}
from
'@/store/hook'
import
ScrollBtoIcon
from
'@/assets/svg/scrollBto.svg?react'
import
{
setIsAsking
}
from
'@/store/chatSlice'
import
SdreamLoading
from
'@/components/SdreamLoading'
export
const
Chat
:
React
.
FC
=
()
=>
{
let
ignore
=
false
...
...
@@ -141,7 +142,7 @@ export const Chat: React.FC = () => {
<
ChatSlogan
/>
<
ChatMaskBar
/>
<
div
className=
{
styles
.
content
}
>
{
isLoading
&&
<
div
className=
"w-full h-full flex justify-center
"
><
Spinner
/></
div
>
}
{
isLoading
&&
<
div
className=
"w-full h-full flex justify-center
items-center"
><
SdreamLoading
/></
div
>
}
{
!
isLoading
&&
(
<
motion
.
div
ref=
{
scrollableRef
}
...
...
src/pages/Chat/components/ChatItem/ChatAnswerBox.tsx
View file @
69e6c37f
import
{
Avatar
,
Button
,
Spinner
}
from
'@nextui-org/react'
import
{
Avatar
,
Button
}
from
'@nextui-org/react'
import
{
motion
}
from
'framer-motion'
import
{
useEffect
,
useState
}
from
'react'
import
{
ChatAnswerShower
}
from
'./ChatAnswerShower'
...
...
@@ -8,6 +8,7 @@ import type { Answer, ChatRecord } from '@/types/chat'
import
AvatarBot
from
'@/assets/avatarBot.png'
import
{
useAppDispatch
}
from
'@/store/hook'
import
{
setIsAsking
}
from
'@/store/chatSlice'
import
SdreamLoading
from
'@/components/SdreamLoading'
interface
ChatAnswerBoxProps
{
record
:
ChatRecord
...
...
@@ -62,7 +63,7 @@ export const ChatAnswerBox: React.FC<ChatAnswerBoxProps> = ({ record, showIndex,
{
!
item
.
isShow
&&
<
ChatAnswerParser
onSubmitQuestion=
{
onSubmitQuestion
}
isLastAnswer=
{
isLastAnswer
}
isStopTyping=
{
item
.
isStopTyping
}
onTyping=
{
handleTyping
}
onComplate=
{
()
=>
handleComplate
(
item
)
}
answer=
{
item
}
/>
}
</
div
>
)
:
<
S
pinner
size=
"sm"
/>
}
:
<
S
dreamLoading
/>
}
</
motion
.
div
>
<
div
className=
"w-[65px] flex-shrink-0"
></
div
>
</
div
>
...
...
src/pages/Chat/components/ChatItem/ChatAnswerParser.tsx
View file @
69e6c37f
...
...
@@ -85,14 +85,14 @@ export const ChatAnswerParser: React.FC<ChatAnswerParserProps> = ({ isLastAnswer
setIsImageAnswer
(
true
)
const
timer
=
setTimeout
(()
=>
{
setCurrentIndex
(
prevIndex
=>
prevIndex
+
1
)
},
2
0
)
// 调整此值以改变打字速度
},
1
0
)
// 调整此值以改变打字速度
return
()
=>
clearTimeout
(
timer
)
}
else
{
const
timer
=
setTimeout
(()
=>
{
setDisplayedText
(
formatAnswer
.
slice
(
0
,
currentIndex
+
1
))
setCurrentIndex
(
prevIndex
=>
prevIndex
+
1
)
},
2
0
)
// 调整此值以改变打字速度
},
1
0
)
// 调整此值以改变打字速度
return
()
=>
clearTimeout
(
timer
)
}
}
...
...
src/pages/Collect/Collect.tsx
View file @
69e6c37f
import
{
useEffect
,
useState
}
from
'react'
import
{
Button
,
Modal
,
ModalBody
,
ModalContent
,
ModalFooter
,
ModalHeader
,
Spinner
,
Tooltip
}
from
'@nextui-org/react'
import
{
Button
,
Modal
,
ModalBody
,
ModalContent
,
ModalFooter
,
ModalHeader
,
Tooltip
}
from
'@nextui-org/react'
import
{
motion
}
from
'framer-motion'
import
{
ChatMaskBar
}
from
'../Chat/components/ChatMaskBar'
import
{
ChatSlogan
}
from
'../Chat/components/ChatSlogan'
...
...
@@ -17,6 +17,7 @@ import AIcon from '@/assets/svg/aicon.svg?react'
import
QIcon
from
'@/assets/svg/qicon.svg?react'
import
EmptyIcon
from
'@/assets/svg/empty.svg?react'
import
ShineBorder
from
'@/components/ShineBorder'
import
SdreamLoading
from
'@/components/SdreamLoading'
export
const
Collect
:
React
.
FC
=
()
=>
{
const
[
isLoading
,
setIsLoading
]
=
useState
(
false
)
...
...
@@ -155,7 +156,7 @@ export const Collect: React.FC = () => {
</
div
>
)
}
{
isLoading
&&
<
div
className=
"w-full flex justify-center
"
><
Spinner
/></
div
>
}
{
isLoading
&&
<
div
className=
"w-full flex justify-center
items-center"
><
SdreamLoading
/></
div
>
}
{
!
isLoading
&&
collectList
.
length
<
total
&&
(
<
div
className=
"w-full max-w-[1000px] mx-auto flex justify-center mt-[24px]"
>
...
...
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