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
84d29dc3
Commit
84d29dc3
authored
Jan 07, 2026
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:更换常见问题&&提质增效接口
parent
94e0db57
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
17 deletions
+44
-17
src/api/chat.ts
+1
-1
src/api/home.ts
+4
-2
src/pages/Chat/components/ChatItem/ChatAnswerRecommend.tsx
+9
-3
src/pages/Home/HomeNew.tsx
+30
-11
No files found.
src/api/chat.ts
View file @
84d29dc3
...
@@ -185,7 +185,7 @@ export function fetchQueryRecommendQuestion(
...
@@ -185,7 +185,7 @@ export function fetchQueryRecommendQuestion(
}
}
/**
/**
* 查询推荐问题
* 查询推荐问题
工单/提质增效
* @param conversationId
* @param conversationId
* @param recordId
* @param recordId
* @param toolId 可选的工具ID
* @param toolId 可选的工具ID
...
...
src/api/home.ts
View file @
84d29dc3
...
@@ -25,8 +25,10 @@ export function fetchToolList(params?: { userRoles?: string[] }) {
...
@@ -25,8 +25,10 @@ export function fetchToolList(params?: { userRoles?: string[] }) {
/**
/**
* 查询 提质增效 推荐问题列表
* 查询 提质增效 推荐问题列表
* @params
* @params
* toolId: 工具id
* conversationId: 会话id
* busiType: 业务类型,固定值 '01'
* recordType: 记录类型,固定值 'A14'
*/
*/
export
function
fetchEfficiencyQuestionList
(
data
:
any
)
{
export
function
fetchEfficiencyQuestionList
(
data
:
any
)
{
return
http
.
post
(
'/conversation/api/conversation/mobile/v1/
generate
_question'
,
data
)
return
http
.
post
(
'/conversation/api/conversation/mobile/v1/
query_strategy_recommend
_question'
,
data
)
}
}
src/pages/Chat/components/ChatItem/ChatAnswerRecommend.tsx
View file @
84d29dc3
...
@@ -25,9 +25,15 @@ export const ChatAnswerRecommend: React.FC<ChatAnswerRecommendProps> = ({ answer
...
@@ -25,9 +25,15 @@ export const ChatAnswerRecommend: React.FC<ChatAnswerRecommendProps> = ({ answer
const
place
=
searchParams
.
get
(
'place'
)
const
place
=
searchParams
.
get
(
'place'
)
const
shouldAttachBusiParams
=
from
===
'tactics'
const
shouldAttachBusiParams
=
from
===
'tactics'
const
isOrderTactics
=
from
===
'tactics'
&&
place
===
'order'
const
isOrderTactics
=
from
===
'tactics'
&&
place
===
'order'
const
busiType
=
shouldAttachBusiParams
?
'02'
:
undefined
const
isSpecialToolId
=
toolId
===
'6712395743241'
let
busiType
:
string
|
undefined
let
recordType
:
string
|
undefined
let
recordType
:
string
|
undefined
if
(
shouldAttachBusiParams
)
{
if
(
isSpecialToolId
)
{
busiType
=
'01'
recordType
=
'A15'
}
else
if
(
shouldAttachBusiParams
)
{
busiType
=
'02'
// from=tactics 且 place=order → recordType=A13 (使用 fetchOrderQueryRecommendQuestion)
// from=tactics 且 place=order → recordType=A13 (使用 fetchOrderQueryRecommendQuestion)
if
(
isOrderTactics
)
{
if
(
isOrderTactics
)
{
recordType
=
'A13'
recordType
=
'A13'
...
@@ -42,7 +48,7 @@ export const ChatAnswerRecommend: React.FC<ChatAnswerRecommendProps> = ({ answer
...
@@ -42,7 +48,7 @@ export const ChatAnswerRecommend: React.FC<ChatAnswerRecommendProps> = ({ answer
}
}
}
}
try
{
try
{
const
res
=
isOrderTactics
const
res
=
(
isOrderTactics
||
isSpecialToolId
)
?
await
fetchOrderQueryRecommendQuestion
(
?
await
fetchOrderQueryRecommendQuestion
(
answer
.
conversationId
||
''
,
answer
.
conversationId
||
''
,
answer
.
recordId
||
''
,
answer
.
recordId
||
''
,
...
...
src/pages/Home/HomeNew.tsx
View file @
84d29dc3
...
@@ -122,16 +122,23 @@ export const Home: React.FC = () => {
...
@@ -122,16 +122,23 @@ export const Home: React.FC = () => {
setIsDataLoaded
(
false
)
// 重置加载状态
setIsDataLoaded
(
false
)
// 重置加载状态
try
{
try
{
// 获取当前的 toolId,只从 sessionStorage 获取
// 从路由中获取 conversationId
const
sessionToolId
=
safeSessionStorageGetItem
(
'currentToolId'
)
||
''
const
conversationId
=
location
.
pathname
.
startsWith
(
'/chat/'
)
console
.
log
(
'[HomeNew] handleRefreshQuestions - 当前 toolId:'
,
sessionToolId
)
?
location
.
pathname
.
split
(
'/'
)[
2
]
:
null
console
.
log
(
'[HomeNew] handleRefreshQuestions - 当前 conversationId:'
,
conversationId
)
if
(
!
conversationId
)
{
console
.
warn
(
'[HomeNew] handleRefreshQuestions - conversationId 不存在,跳过接口调用'
)
setIsDataLoaded
(
true
)
return
}
// 调用接口重新获取问题列表
console
.
log
(
'[HomeNew] handleRefreshQuestions - 开始调用 fetchEfficiencyQuestionList 接口'
)
const
res
=
await
fetchEfficiencyQuestionList
({
const
res
=
await
fetchEfficiencyQuestionList
({
toolId
:
sessionToolId
,
conversationId
,
busiType
:
'01'
,
recordType
:
'A14'
,
})
})
console
.
log
(
'[HomeNew] handleRefreshQuestions - fetchEfficiencyQuestionList 接口返回:'
,
res
)
if
(
res
&&
res
.
data
&&
res
.
data
.
questions
)
{
if
(
res
&&
res
.
data
&&
res
.
data
.
questions
)
{
console
.
log
(
'[HomeNew] handleRefreshQuestions - 获取到问题数量:'
,
res
.
data
.
questions
.
length
)
console
.
log
(
'[HomeNew] handleRefreshQuestions - 获取到问题数量:'
,
res
.
data
.
questions
.
length
)
setOtherQuestions
((
prev
:
any
)
=>
({
setOtherQuestions
((
prev
:
any
)
=>
({
...
@@ -181,10 +188,22 @@ export const Home: React.FC = () => {
...
@@ -181,10 +188,22 @@ export const Home: React.FC = () => {
finalToolId
=
storedToolId
finalToolId
=
storedToolId
}
}
// 调用真实 API 获取常见问题列表,优先使用 sessionStorage 中的 currentToolId
// 从路由中获取 conversationId
const
sessionToolId
=
safeSessionStorageGetItem
(
'currentToolId'
)
||
''
const
conversationId
=
location
.
pathname
.
startsWith
(
'/chat/'
)
?
location
.
pathname
.
split
(
'/'
)[
2
]
:
null
if
(
!
conversationId
)
{
console
.
warn
(
'[HomeNew] _handleToolClick - conversationId 不存在,跳过接口调用'
)
setIsDataLoaded
(
true
)
return
}
// 调用真实 API 获取常见问题列表
const
res
=
await
fetchEfficiencyQuestionList
({
const
res
=
await
fetchEfficiencyQuestionList
({
toolId
:
sessionToolId
||
finalToolId
,
conversationId
,
busiType
:
'01'
,
recordType
:
'A14'
,
})
})
if
(
res
&&
res
.
data
&&
res
.
data
.
questions
)
{
if
(
res
&&
res
.
data
&&
res
.
data
.
questions
)
{
setOtherQuestions
((
prev
:
any
)
=>
({
setOtherQuestions
((
prev
:
any
)
=>
({
...
@@ -199,7 +218,7 @@ export const Home: React.FC = () => {
...
@@ -199,7 +218,7 @@ export const Home: React.FC = () => {
finally
{
finally
{
setIsDataLoaded
(
true
)
// 无论成功失败都标记为已加载
setIsDataLoaded
(
true
)
// 无论成功失败都标记为已加载
}
}
},
[
originalOtherQuestions
,
location
.
search
])
},
[
originalOtherQuestions
,
location
.
search
,
location
.
pathname
])
// 监听工具按钮点击事件
// 监听工具按钮点击事件
useEffect
(()
=>
{
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