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
2ddd5326
Commit
2ddd5326
authored
Aug 14, 2024
by
HoMeTown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 增加控制台带银
parent
f682c8e8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
28 deletions
+39
-28
src/components/MarkdownDetail/index.tsx
+2
-2
src/index.tsx
+3
-0
src/pages/Chat/Chat.tsx
+1
-1
src/pages/Chat/components/ChatItem/ChatAnswerParser.tsx
+1
-1
src/pages/Home/components/QuestionList/QuestionList.tsx
+22
-24
src/utils/console.ts
+10
-0
No files found.
src/components/MarkdownDetail/index.tsx
View file @
2ddd5326
...
...
@@ -19,12 +19,12 @@ export const MarkdownDetail: React.FC<MarkdownDetailProps> = ({ children }) => {
img
:
({
...
data
}):
JSX
.
Element
=>
(
<
PhotoProvider
maskOpacity=
{
0.1
}
bannerVisible=
{
false
}
>
<
PhotoView
{
...
(
data
as
any
)}
>
<
img
className=
"w-2/3 cursor-pointer"
{
...
data
}
/>
<
img
className=
"w-2/3 cursor-pointer
mt-[24px] mb-[8px]
"
{
...
data
}
/>
</
PhotoView
>
</
PhotoProvider
>
),
p
(
data
):
JSX
.
Element
{
return
<
p
{
...
data
}
/>
return
<
p
className=
"leading-[24px]"
{
...
data
}
/>
},
ul
(
data
):
JSX
.
Element
{
return
<
ul
className=
"mb-[24px]"
{
...
data
}
/>
...
...
src/index.tsx
View file @
2ddd5326
...
...
@@ -4,11 +4,14 @@ import { NextUIProvider } from '@nextui-org/react'
import
App
from
'./App'
import
'./styles/index.less'
import
'react-photo-view/dist/react-photo-view.css'
import
{
printText2Console
}
from
'./utils/console'
const
rootEl
=
document
.
getElementById
(
'root'
)
document
.
documentElement
.
classList
.
add
(
'light'
)
printText2Console
()
if
(
rootEl
)
{
const
root
=
ReactDOM
.
createRoot
(
rootEl
)
root
.
render
(
...
...
src/pages/Chat/Chat.tsx
View file @
2ddd5326
...
...
@@ -32,7 +32,7 @@ export const Chat: React.FC = () => {
const
position
=
useScroll
(
scrollableRef
)
const
handleSubmitQuestion
=
async
(
question
:
string
)
=>
{
const
isNew
=
allItems
.
length
===
0
const
isNew
=
allItems
.
length
<=
1
dispatch
(
setIsAsking
(
true
))
// 添加用户提问的问题
setAllItems
(
prevItems
=>
[
...
...
src/pages/Chat/components/ChatItem/ChatAnswerParser.tsx
View file @
2ddd5326
...
...
@@ -31,7 +31,7 @@ export const ChatAnswerParser: React.FC<ChatAnswerParserProps> = ({ onTyping, on
const
timer
=
setTimeout
(()
=>
{
setDisplayedText
(
formatAnswer
.
slice
(
0
,
currentIndex
+
1
))
setCurrentIndex
(
prevIndex
=>
prevIndex
+
1
)
},
10
0
)
// 调整此值以改变打字速度
},
2
0
)
// 调整此值以改变打字速度
return
()
=>
clearTimeout
(
timer
)
}
...
...
src/pages/Home/components/QuestionList/QuestionList.tsx
View file @
2ddd5326
import
{
Button
}
from
'@nextui-org/react'
import
type
React
from
'react'
import
{
Image
}
from
'@nextui-org/image'
import
{
AnimatePresence
,
motion
}
from
'framer-motion'
import
{
motion
}
from
'framer-motion'
import
{
useCallback
,
useEffect
,
useState
}
from
'react'
import
Refresh
from
'@/assets/svg/refresh.svg?react'
import
{
type
WithAuthProps
,
withAuth
}
from
'@/auth/withAuth'
...
...
@@ -118,29 +118,27 @@ const QuestionListBase: React.FC<QuestionListProps & WithAuthProps> = ({ checkAu
animate=
"visible"
className=
"mt-[18px] flex flex-col gap-[8px] w-full"
>
<
AnimatePresence
mode=
"wait"
>
{
displayedItems
.
map
((
item
,
index
)
=>
(
<
motion
.
li
key=
{
`${item}-${index}`
}
custom=
{
index
}
variants=
{
itemVariants
}
initial=
"hidden"
animate=
"visible"
exit=
"exit"
layout
className=
"w-full"
>
<
Button
onClick=
{
()
=>
handleClick
(
item
)
}
color=
"primary"
variant=
"light"
className=
"text-left bg-[#F7FCFF] w-full text-[#333] rounded-[23px] data-[hover=true]:bg-[#E5F6FF] data-[hover=true]:text-primary"
>
<
div
className=
"w-full text-nowrap text-ellipsis overflow-hidden"
>
<
span
style=
{
{
color
:
dotColor
}
}
>
·
</
span
>
<
span
className=
"ml-[8px]"
>
{
item
}
</
span
>
</
div
>
</
Button
>
</
motion
.
li
>
))
}
</
AnimatePresence
>
{
displayedItems
.
map
((
item
,
index
)
=>
(
<
motion
.
li
key=
{
`${item}-${index}`
}
custom=
{
index
}
variants=
{
itemVariants
}
initial=
"hidden"
animate=
"visible"
exit=
"exit"
layout
className=
"w-full"
>
<
Button
onClick=
{
()
=>
handleClick
(
item
)
}
color=
"primary"
variant=
"light"
className=
"text-left bg-[#F7FCFF] w-full text-[#333] rounded-[23px] data-[hover=true]:bg-[#E5F6FF] data-[hover=true]:text-primary"
>
<
div
className=
"w-full text-nowrap text-ellipsis overflow-hidden"
>
<
span
style=
{
{
color
:
dotColor
}
}
>
·
</
span
>
<
span
className=
"ml-[8px]"
>
{
item
}
</
span
>
</
div
>
</
Button
>
</
motion
.
li
>
))
}
</
motion
.
ul
>
</
div
>
)
...
...
src/utils/console.ts
0 → 100644
View file @
2ddd5326
/* eslint-disable no-console */
export
function
printText2Console
()
{
console
.
log
(
'%c 晓得.'
,
'color: #29B6FD; font-weight: bold; font-size: 44px; text-shadow:-1px -1px #fff,1px 1px #333;'
)
console
.
group
(
'%c🌟 晓得.AI 📖 - 晓得解惑,让沟通更智能'
,
'background-color: #29B6FD ; color: #ffffff ; font-weight: bold ; padding: 6px 14px ; border-radius: 4px;'
,
)
console
.
log
(
'%c🎉 知晓市场脉搏,引领行业潮流,晓得AI助手全方位为您保驾护航.'
,
'color: #29B6FD; font-weight: bold;'
)
console
.
groupEnd
()
}
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