mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-06-02 09:54:13 +08:00
This commit is contained in:
parent
505d4cce78
commit
87da155477
@ -424,6 +424,8 @@ export const useChat = (
|
|||||||
const response = responseItem as any
|
const response = responseItem as any
|
||||||
if (thought.message_id && !hasSetResponseId)
|
if (thought.message_id && !hasSetResponseId)
|
||||||
response.id = thought.message_id
|
response.id = thought.message_id
|
||||||
|
if (thought.conversation_id)
|
||||||
|
response.conversationId = thought.conversation_id
|
||||||
|
|
||||||
if (response.agent_thoughts.length === 0) {
|
if (response.agent_thoughts.length === 0) {
|
||||||
response.agent_thoughts.push(thought)
|
response.agent_thoughts.push(thought)
|
||||||
|
@ -41,6 +41,7 @@ export type ThoughtItem = {
|
|||||||
tool_input: string
|
tool_input: string
|
||||||
tool_labels?: { [key: string]: TypeWithI18N }
|
tool_labels?: { [key: string]: TypeWithI18N }
|
||||||
message_id: string
|
message_id: string
|
||||||
|
conversation_id: string
|
||||||
observation: string
|
observation: string
|
||||||
position: number
|
position: number
|
||||||
files?: string[]
|
files?: string[]
|
||||||
|
@ -41,9 +41,10 @@ const useThinkTimer = (children: any) => {
|
|||||||
const timerRef = useRef<NodeJS.Timeout>()
|
const timerRef = useRef<NodeJS.Timeout>()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (isComplete) return
|
||||||
|
|
||||||
timerRef.current = setInterval(() => {
|
timerRef.current = setInterval(() => {
|
||||||
if (!isComplete)
|
setElapsedTime(Math.floor((Date.now() - startTime) / 100) / 10)
|
||||||
setElapsedTime(Math.floor((Date.now() - startTime) / 100) / 10)
|
|
||||||
}, 100)
|
}, 100)
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
@ -53,11 +54,8 @@ const useThinkTimer = (children: any) => {
|
|||||||
}, [startTime, isComplete])
|
}, [startTime, isComplete])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (hasEndThink(children)) {
|
if (hasEndThink(children))
|
||||||
setIsComplete(true)
|
setIsComplete(true)
|
||||||
if (timerRef.current)
|
|
||||||
clearInterval(timerRef.current)
|
|
||||||
}
|
|
||||||
}, [children])
|
}, [children])
|
||||||
|
|
||||||
return { elapsedTime, isComplete }
|
return { elapsedTime, isComplete }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user