mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 22:29:03 +08:00
fix: frontend handle sometimes server not generate the wrong follow up data struct (#7916)
This commit is contained in:
parent
0cfcc97e9d
commit
7fdd964379
@ -372,12 +372,17 @@ export const useChat = (
|
|||||||
handleUpdateChatList(newChatList)
|
handleUpdateChatList(newChatList)
|
||||||
}
|
}
|
||||||
if (config?.suggested_questions_after_answer?.enabled && !hasStopResponded.current && onGetSuggestedQuestions) {
|
if (config?.suggested_questions_after_answer?.enabled && !hasStopResponded.current && onGetSuggestedQuestions) {
|
||||||
|
try {
|
||||||
const { data }: any = await onGetSuggestedQuestions(
|
const { data }: any = await onGetSuggestedQuestions(
|
||||||
responseItem.id,
|
responseItem.id,
|
||||||
newAbortController => suggestedQuestionsAbortControllerRef.current = newAbortController,
|
newAbortController => suggestedQuestionsAbortControllerRef.current = newAbortController,
|
||||||
)
|
)
|
||||||
setSuggestQuestions(data)
|
setSuggestQuestions(data)
|
||||||
}
|
}
|
||||||
|
catch (e) {
|
||||||
|
setSuggestQuestions([])
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onFile(file) {
|
onFile(file) {
|
||||||
const lastThought = responseItem.agent_thoughts?.[responseItem.agent_thoughts?.length - 1]
|
const lastThought = responseItem.agent_thoughts?.[responseItem.agent_thoughts?.length - 1]
|
||||||
|
@ -248,12 +248,17 @@ export const useChat = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (config?.suggested_questions_after_answer?.enabled && !hasStopResponded.current && onGetSuggestedQuestions) {
|
if (config?.suggested_questions_after_answer?.enabled && !hasStopResponded.current && onGetSuggestedQuestions) {
|
||||||
|
try {
|
||||||
const { data }: any = await onGetSuggestedQuestions(
|
const { data }: any = await onGetSuggestedQuestions(
|
||||||
responseItem.id,
|
responseItem.id,
|
||||||
newAbortController => suggestedQuestionsAbortControllerRef.current = newAbortController,
|
newAbortController => suggestedQuestionsAbortControllerRef.current = newAbortController,
|
||||||
)
|
)
|
||||||
setSuggestQuestions(data)
|
setSuggestQuestions(data)
|
||||||
}
|
}
|
||||||
|
catch (error) {
|
||||||
|
setSuggestQuestions([])
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onMessageEnd: (messageEnd) => {
|
onMessageEnd: (messageEnd) => {
|
||||||
responseItem.citation = messageEnd.metadata?.retriever_resources || []
|
responseItem.citation = messageEnd.metadata?.retriever_resources || []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user