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
e5d0da79
Commit
e5d0da79
authored
Nov 30, 2025
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:输入框placeHoulder&&常见问题tooltip
parent
107247b0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
6 deletions
+27
-6
src/components/ChatEditor/index.tsx
+20
-1
src/pages/Home/components/QuestionList/QuestionList.tsx
+7
-5
No files found.
src/components/ChatEditor/index.tsx
View file @
e5d0da79
...
...
@@ -57,6 +57,7 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
const
[
selectedToolId
,
setSelectedToolId
]
=
useState
<
string
|
null
>
(
null
)
const
[
isToolBtnActive
,
setIsToolBtnActive
]
=
useState
<
boolean
>
(
true
)
const
currentToolId
=
useAppSelector
((
state
:
RootState
)
=>
state
.
conversation
.
currentToolId
)
const
[
showToolQuestion
,
setShowToolQuestion
]
=
useState
<
boolean
>
(
false
)
// 获取工具列表
const
getToolList
=
async
()
=>
{
...
...
@@ -163,6 +164,8 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
// 立即更新本地状态,让 UI 立即响应
setIsToolBtnActive
(
true
)
setSelectedToolId
(
null
)
sessionStorage
.
removeItem
(
'showToolQuestion'
)
setShowToolQuestion
(
false
)
try
{
await
dispatch
(
createConversation
({
conversationData
:
{},
...
...
@@ -182,9 +185,11 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
return
if
(
tool
.
toolName
===
'数据助手'
)
{
sessionStorage
.
setItem
(
'showToolQuestion'
,
'true'
)
setShowToolQuestion
(
true
)
}
else
{
sessionStorage
.
removeItem
(
'showToolQuestion'
)
setShowToolQuestion
(
false
)
}
dispatch
(
setCurrentToolId
(
tool
.
toolId
))
setSelectedToolId
(
tool
.
toolId
)
...
...
@@ -222,6 +227,20 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
getToolList
()
},
[])
// 监听 sessionStorage 中的 showToolQuestion
useEffect
(()
=>
{
const
checkShowToolQuestion
=
()
=>
{
const
value
=
sessionStorage
.
getItem
(
'showToolQuestion'
)
setShowToolQuestion
(
value
===
'true'
)
}
checkShowToolQuestion
()
// 监听 storage 事件以响应其他标签页的变化
window
.
addEventListener
(
'storage'
,
checkShowToolQuestion
)
return
()
=>
{
window
.
removeEventListener
(
'storage'
,
checkShowToolQuestion
)
}
},
[])
// 处理initialValue的变化
useEffect
(()
=>
{
if
(
initialValue
&&
editorRef
.
current
)
{
...
...
@@ -263,7 +282,7 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
onKeyDown=
{
handleKeyDown
}
onPaste=
{
handlePaste
}
suppressContentEditableWarning
data
-
placeholder=
"输入您想问的问题吧~"
data
-
placeholder=
{
showToolQuestion
?
'请输入您的问题'
:
'输入您想问的问题吧~'
}
style=
{
{
resize
:
'none'
,
maxHeight
:
'48px'
,
...
...
src/pages/Home/components/QuestionList/QuestionList.tsx
View file @
e5d0da79
import
{
Button
}
from
'@heroui/react'
import
{
Button
,
Tooltip
}
from
'@heroui/react'
import
type
React
from
'react'
import
{
Image
}
from
'@heroui/image'
import
{
motion
}
from
'framer-motion'
...
...
@@ -188,10 +188,12 @@ const QuestionListBase: React.FC<QuestionListProps & WithAuthProps> = ({
variant=
"light"
className=
"text-left bg-[#F8FBFF] w-full text-[#333] rounded-[23px] data-[hover=true]:bg-[#F0F8FF] data-[hover=true]:text-primary h-8"
>
<
div
className=
"w-full text-nowrap text-ellipsis overflow-hidden"
>
<
span
className=
"w-[6px] h-[6px] rounded-full inline-block mr-[6px]"
style=
{
{
backgroundColor
:
dotColor
}
}
></
span
>
<
span
className=
"ml-[8px]"
>
{
item
}
</
span
>
</
div
>
<
Tooltip
color=
"foreground"
content=
{
item
}
placement=
"top"
>
<
div
className=
"w-full text-nowrap text-ellipsis overflow-hidden"
>
<
span
className=
"w-[6px] h-[6px] rounded-full inline-block mr-[6px]"
style=
{
{
backgroundColor
:
dotColor
}
}
></
span
>
<
span
className=
"ml-[8px]"
>
{
item
}
</
span
>
</
div
>
</
Tooltip
>
</
Button
>
</
motion
.
li
>
))
}
...
...
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