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
92f7d450
Commit
92f7d450
authored
Dec 17, 2025
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:链接打印
parent
358c9bf4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
7 deletions
+20
-7
src/pages/ChatTactics/TacticsChat.tsx
+20
-7
No files found.
src/pages/ChatTactics/TacticsChat.tsx
View file @
92f7d450
...
...
@@ -27,6 +27,19 @@ export const TacticsChat: React.FC = () => {
const
{
id
}
=
useParams
<
{
id
:
string
}
>
()
const
location
=
useLocation
()
const
navigate
=
useNavigate
()
const
logFullUrl
=
useCallback
((
reason
?:
string
)
=>
{
// eslint-disable-next-line no-console
console
.
log
(
'[TacticsChat] full url snapshot'
,
{
reason
,
href
:
window
.
location
.
href
,
pathname
:
location
.
pathname
,
search
:
location
.
search
,
state
:
location
.
state
,
})
},
[
location
.
pathname
,
location
.
search
,
location
.
state
])
useEffect
(()
=>
{
logFullUrl
(
'mount or location change'
)
},
[
logFullUrl
])
const
viteOutputObj
=
import
.
meta
.
env
.
VITE_OUTPUT_OBJ
||
'open'
const
[
isLoading
,
setIsLoading
]
=
useState
(
false
)
const
[
allItems
,
setAllItems
]
=
useState
<
ChatRecord
[]
>
([])
...
...
@@ -58,12 +71,12 @@ export const TacticsChat: React.FC = () => {
const
currentIdRef
=
useRef
<
string
|
undefined
>
(
id
)
const
lastSentQuestionRef
=
useRef
<
string
>
(
''
)
const
abortControllerRef
=
useRef
<
AbortController
|
null
>
(
null
)
// 读取 from=tactics
且 version=2
的额外参数
// 读取 from=tactics 的额外参数
const
tacticsMetaFromState
=
(
location
.
state
as
{
tacticsMeta
?:
any
}
|
null
)?.
tacticsMeta
const
tacticsMetaFromQuery
=
useMemo
(()
=>
{
const
from
=
searchParams
.
get
(
'from'
)
const
version
=
searchParams
.
get
(
'version'
)
if
(
from
!==
'tactics'
||
version
!==
'2'
)
{
if
(
from
!==
'tactics'
)
{
return
undefined
}
return
{
...
...
@@ -83,9 +96,7 @@ export const TacticsChat: React.FC = () => {
}
try
{
const
parsed
=
JSON
.
parse
(
raw
)
if
(
parsed
?.
version
===
'2'
)
{
return
parsed
}
return
parsed
}
catch
{
// ignore
...
...
@@ -633,9 +644,10 @@ export const TacticsChat: React.FC = () => {
// 重新拉取会话列表,保持原有行为
await
dispatch
(
fetchTacticsConversations
())
if
(
currentIdRef
.
current
)
{
logFullUrl
(
'before navigate reanalyze'
)
navigate
(
`/tactics/chat/
${
currentIdRef
.
current
}
`
)
}
},
[
dispatch
,
navigate
,
handleSubmitQuestion
,
userMeta
,
getNumberTypeWithUserMeta
,
isLoading
,
isAsking
])
},
[
dispatch
,
navigate
,
handleSubmitQuestion
,
userMeta
,
getNumberTypeWithUserMeta
,
isLoading
,
isAsking
,
logFullUrl
])
const
handleCancelClear
=
useCallback
(()
=>
{
setShowClearConfirm
(
false
)
...
...
@@ -724,6 +736,7 @@ export const TacticsChat: React.FC = () => {
// 创建新会话成功后跳转到新会话页面
useEffect
(()
=>
{
if
(
shouldNavigateToNewConversation
&&
currentConversationId
)
{
logFullUrl
(
'before navigate create new conversation'
)
navigate
(
`/tactics/chat/
${
currentConversationId
}
`
,
{
state
:
{
shouldSendQuestion
:
shouldSendQuestionFromState
,
...
...
@@ -734,7 +747,7 @@ export const TacticsChat: React.FC = () => {
})
dispatch
(
clearTacticsNavigationFlag
())
}
},
[
shouldNavigateToNewConversation
,
currentConversationId
,
navigate
,
dispatch
,
shouldSendQuestionFromState
,
tacticsMeta
,
userMeta
])
},
[
shouldNavigateToNewConversation
,
currentConversationId
,
navigate
,
dispatch
,
shouldSendQuestionFromState
,
tacticsMeta
,
userMeta
,
logFullUrl
])
// 处理shouldSendQuestion的变化 - 自动发送问题
useEffect
(()
=>
{
...
...
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