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
887c7712
Commit
887c7712
authored
Dec 12, 2025
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:右上角按钮
parent
d586835c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
1 deletions
+63
-1
src/api/tactics.ts
+9
-0
src/pages/ChatTactics/TacticsHome.tsx
+54
-1
No files found.
src/api/tactics.ts
View file @
887c7712
...
@@ -30,3 +30,12 @@ export function fetchDeleteTacticsConversation(conversationIdList: string[]) {
...
@@ -30,3 +30,12 @@ export function fetchDeleteTacticsConversation(conversationIdList: string[]) {
conversationIdList
,
conversationIdList
,
})
})
}
}
/**
* 清空记录 接口
* @params
* conversationIdList: 会话id (只传一个)
*/
// export function deleteUserConversation(data: any) {
// return http.post('/api/conversation/mobile/v1/delete_user_conversation', data)
// }
src/pages/ChatTactics/TacticsHome.tsx
View file @
887c7712
...
@@ -5,7 +5,7 @@ import { useLocation, useNavigate } from 'react-router-dom'
...
@@ -5,7 +5,7 @@ import { useLocation, useNavigate } from 'react-router-dom'
import
{
useLocalStorageState
}
from
'ahooks'
import
{
useLocalStorageState
}
from
'ahooks'
import
styles
from
'../Home/Home.module.less'
import
styles
from
'../Home/Home.module.less'
import
{
TacticsWelcome
}
from
'./components/TacticsWelcome'
import
{
TacticsWelcome
}
from
'./components/TacticsWelcome'
import
{
clearTacticsNavigationFlag
,
createTacticsConversation
,
fetchTacticsConversations
}
from
'@/store/tacticsSlice'
import
{
clearTacticsNavigationFlag
,
createTacticsConversation
,
deleteTacticsConversations
,
fetchTacticsConversations
}
from
'@/store/tacticsSlice'
import
{
useAppDispatch
,
useAppSelector
}
from
'@/store/hook'
import
{
useAppDispatch
,
useAppSelector
}
from
'@/store/hook'
import
type
{
RootState
}
from
'@/store'
import
type
{
RootState
}
from
'@/store'
import
{
fetchLoginByToken
,
fetchLoginByUid
}
from
'@/api/common'
import
{
fetchLoginByToken
,
fetchLoginByUid
}
from
'@/api/common'
...
@@ -13,6 +13,8 @@ import { getUserRolesFromRoute } from '@/lib/utils'
...
@@ -13,6 +13,8 @@ import { getUserRolesFromRoute } from '@/lib/utils'
import
{
ChatEditor
}
from
'@/components/ChatEditor'
import
{
ChatEditor
}
from
'@/components/ChatEditor'
import
{
RECOMMEND_QUESTIONS_OTHER
}
from
'@/config/recommendQuestion'
import
{
RECOMMEND_QUESTIONS_OTHER
}
from
'@/config/recommendQuestion'
import
{
fetchCheckTokenApi
,
fetchStreamResponse
}
from
'@/api/chat'
import
{
fetchCheckTokenApi
,
fetchStreamResponse
}
from
'@/api/chat'
import
DeleteIcon
from
'@/assets/svg/delete.svg?react'
import
RefreshIcon
from
'@/assets/svg/refresh.svg?react'
export
const
TacticsHome
:
React
.
FC
=
()
=>
{
export
const
TacticsHome
:
React
.
FC
=
()
=>
{
const
viteOutputObj
=
import
.
meta
.
env
.
VITE_OUTPUT_OBJ
||
'open'
const
viteOutputObj
=
import
.
meta
.
env
.
VITE_OUTPUT_OBJ
||
'open'
...
@@ -175,6 +177,37 @@ export const TacticsHome: React.FC = () => {
...
@@ -175,6 +177,37 @@ export const TacticsHome: React.FC = () => {
login
()
login
()
},
[])
},
[])
// 处理清除记录
const
handleClearRecord
=
useCallback
(
async
()
=>
{
if
(
!
currentConversationId
)
{
return
}
try
{
await
dispatch
(
deleteTacticsConversations
([
currentConversationId
])).
unwrap
()
// 清除后创建新会话
dispatch
(
createTacticsConversation
({
conversationData
:
{},
shouldNavigate
:
false
,
shouldSendQuestion
:
''
,
}),
)
}
catch
(
error
)
{
console
.
error
(
'清除记录失败:'
,
error
)
}
},
[
currentConversationId
,
dispatch
])
// 处理重新分析
const
handleReanalyze
=
useCallback
(
async
()
=>
{
// 重新获取会话列表
await
dispatch
(
fetchTacticsConversations
())
// 如果有当前会话,可以重新加载
if
(
currentConversationId
)
{
navigate
(
`/tactics/chat/
${
currentConversationId
}
`
)
}
},
[
currentConversationId
,
dispatch
,
navigate
])
return
(
return
(
<
div
<
div
className=
{
styles
.
homePage
}
className=
{
styles
.
homePage
}
...
@@ -192,6 +225,26 @@ export const TacticsHome: React.FC = () => {
...
@@ -192,6 +225,26 @@ export const TacticsHome: React.FC = () => {
zIndex
:
1000
,
zIndex
:
1000
,
}
}
}
}
>
>
{
/* 按钮区域 - 右侧展示 */
}
<
div
className=
"flex justify-end items-center gap-[16px] px-[16px] pt-[16px] pb-[8px]"
>
<
button
type=
"button"
onClick=
{
handleClearRecord
}
className=
"flex items-center gap-[4px] text-[#4A90E2] text-[14px] hover:opacity-80 transition-opacity cursor-pointer bg-transparent border-none outline-none"
>
<
DeleteIcon
className=
"w-[16px] h-[16px] text-[#B2B8C1]"
/>
<
span
>
清除记录
</
span
>
</
button
>
<
button
type=
"button"
onClick=
{
handleReanalyze
}
className=
"flex items-center gap-[4px] text-[#4A90E2] text-[14px] hover:opacity-80 transition-opacity cursor-pointer bg-transparent border-none outline-none"
>
<
RefreshIcon
className=
"w-[16px] h-[16px] text-[#B2B8C1]"
/>
<
span
>
重新分析
</
span
>
</
button
>
</
div
>
<
div
className=
"h-full w-full flex flex-col"
>
<
div
className=
"h-full w-full flex flex-col"
>
{
/* 主要内容区域 - 全屏显示 */
}
{
/* 主要内容区域 - 全屏显示 */
}
<
div
className=
"flex-1 overflow-hidden flex flex-col"
>
<
div
className=
"flex-1 overflow-hidden flex flex-col"
>
...
...
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