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
f2729c4c
Commit
f2729c4c
authored
Jan 20, 2025
by
HoMeTown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 优化功能
parent
08186cd0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
8 deletions
+20
-8
src/components/ChatEditor/index.tsx
+18
-6
src/components/JoyrideStep/index.tsx
+1
-1
src/pages/Home/Home.tsx
+1
-1
No files found.
src/components/ChatEditor/index.tsx
View file @
f2729c4c
import
React
,
{
useEffect
,
useRef
,
useState
}
from
'react'
import
{
AnimatePresence
,
motion
}
from
'framer-motion'
import
{
Button
}
from
'@nextui-org/react'
import
{
useToggle
}
from
'ahooks'
import
{
Button
,
Tooltip
}
from
'@nextui-org/react'
import
{
use
LocalStorageState
,
use
Toggle
}
from
'ahooks'
import
{
LoginModal
}
from
'../LoginModal'
import
type
{
RootState
}
from
'@/store'
import
SendIcon
from
'@/assets/svg/send.svg?react'
...
...
@@ -13,9 +13,10 @@ interface ChatEditorProps {
onFocus
?:
()
=>
void
onSubmit
?:
(
value
:
string
)
=>
void
placeholders
:
string
[]
showContentTips
?:
boolean
}
const
ChatEditorBase
:
React
.
FC
<
ChatEditorProps
&
WithAuthProps
>
=
({
checkAuth
,
onChange
,
onFocus
,
onSubmit
,
placeholders
})
=>
{
const
ChatEditorBase
:
React
.
FC
<
ChatEditorProps
&
WithAuthProps
>
=
({
checkAuth
,
onChange
,
onFocus
,
onSubmit
,
placeholders
,
showContentTips
=
false
})
=>
{
// const dispatch = useAppDispatch()
const
[
content
,
setContent
]
=
useState
(
''
)
const
editorRef
=
useRef
<
HTMLDivElement
>
(
null
)
...
...
@@ -97,6 +98,15 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
// }
}
},
[
content
])
const
[
token
]
=
useLocalStorageState
<
string
|
undefined
>
(
'__TOKEN__'
,
{
defaultValue
:
''
,
listenStorageChange
:
true
,
},
)
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
...
...
@@ -113,10 +123,12 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
resize
:
'none'
,
}
}
/>
<
Button
className=
"ask-send"
onClick=
{
handleSubmit
}
radius=
"full"
isDisabled=
{
!
content
||
isAsking
}
isIconOnly
color=
"primary"
>
<
SendIcon
/>
</
Button
>
<
Tooltip
isOpen=
{
Boolean
(
token
)
&&
showContentTips
&&
!
isAsking
&&
!
content
}
color=
"foreground"
content=
"请输入您的问题📖"
placement=
"top"
>
<
Button
className=
"ask-send"
onClick=
{
handleSubmit
}
radius=
"full"
isDisabled=
{
!
content
||
isAsking
}
isIconOnly
color=
"primary"
>
<
SendIcon
/>
</
Button
>
</
Tooltip
>
<
div
className=
"absolute inset-0 flex items-center rounded-full pointer-events-none"
>
<
AnimatePresence
mode=
"wait"
>
{
!
content
&&
(
...
...
src/components/JoyrideStep/index.tsx
View file @
f2729c4c
...
...
@@ -8,7 +8,7 @@ export default function JoyrideStep() {
const
steps
=
[
{
target
:
'.layoutNavBarJoyride'
,
content
:
'
点击logo
解锁更多功能 🎉'
,
content
:
'
登录
解锁更多功能 🎉'
,
},
]
...
...
src/pages/Home/Home.tsx
View file @
f2729c4c
...
...
@@ -79,7 +79,7 @@ export const Home: React.FC = () => {
{
/* /> */
}
</
div
>
<
div
className=
"box-border px-[0] mx-auto iptContainer w-full max-w-[912px] flex-shrink-0 sm:px-0 pb-[18px]"
>
<
ChatEditor
onSubmit=
{
handleCreateConversation
}
placeholders=
{
RECOMMEND_QUESTIONS_OTHER
}
/>
<
ChatEditor
showContentTips
onSubmit=
{
handleCreateConversation
}
placeholders=
{
RECOMMEND_QUESTIONS_OTHER
}
/>
<
div
className=
"w-full text-center mt-[12px] text-[#3333334d] text-[12px]"
>
内容由AI模型生成,其准确性和完整性无法保证,仅供参考
</
div
>
...
...
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