Chores: fix name typo (#6987)

This commit is contained in:
Vico Chu 2024-08-06 13:33:21 +08:00 committed by GitHub
parent 23ed15d19f
commit 1c043b8426
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 14 deletions

View File

@ -83,7 +83,7 @@ export const useChat = (
const { t } = useTranslation() const { t } = useTranslation()
const { formatTime } = useTimestamp() const { formatTime } = useTimestamp()
const { notify } = useToastContext() const { notify } = useToastContext()
const connversationId = useRef('') const conversationId = useRef('')
const hasStopResponded = useRef(false) const hasStopResponded = useRef(false)
const [isResponding, setIsResponding] = useState(false) const [isResponding, setIsResponding] = useState(false)
const isRespondingRef = useRef(false) const isRespondingRef = useRef(false)
@ -152,7 +152,7 @@ export const useChat = (
}, [stopChat, handleResponding]) }, [stopChat, handleResponding])
const handleRestart = useCallback(() => { const handleRestart = useCallback(() => {
connversationId.current = '' conversationId.current = ''
taskIdRef.current = '' taskIdRef.current = ''
handleStop() handleStop()
const newChatList = config?.opening_statement const newChatList = config?.opening_statement
@ -248,7 +248,7 @@ export const useChat = (
const bodyParams = { const bodyParams = {
response_mode: 'streaming', response_mode: 'streaming',
conversation_id: connversationId.current, conversation_id: conversationId.current,
...data, ...data,
} }
if (bodyParams?.files?.length) { if (bodyParams?.files?.length) {
@ -302,7 +302,7 @@ export const useChat = (
} }
if (isFirstMessage && newConversationId) if (isFirstMessage && newConversationId)
connversationId.current = newConversationId conversationId.current = newConversationId
taskIdRef.current = taskId taskIdRef.current = taskId
if (messageId) if (messageId)
@ -322,11 +322,11 @@ export const useChat = (
return return
if (onConversationComplete) if (onConversationComplete)
onConversationComplete(connversationId.current) onConversationComplete(conversationId.current)
if (connversationId.current && !hasStopResponded.current && onGetConvesationMessages) { if (conversationId.current && !hasStopResponded.current && onGetConvesationMessages) {
const { data }: any = await onGetConvesationMessages( const { data }: any = await onGetConvesationMessages(
connversationId.current, conversationId.current,
newAbortController => conversationMessagesAbortControllerRef.current = newAbortController, newAbortController => conversationMessagesAbortControllerRef.current = newAbortController,
) )
const newResponseItem = data.find((item: any) => item.id === responseItem.id) const newResponseItem = data.find((item: any) => item.id === responseItem.id)
@ -361,7 +361,7 @@ export const useChat = (
latency: newResponseItem.provider_response_latency.toFixed(2), latency: newResponseItem.provider_response_latency.toFixed(2),
}, },
// for agent log // for agent log
conversationId: connversationId.current, conversationId: conversationId.current,
input: { input: {
inputs: newResponseItem.inputs, inputs: newResponseItem.inputs,
query: newResponseItem.query, query: newResponseItem.query,
@ -640,7 +640,7 @@ export const useChat = (
return { return {
chatList, chatList,
setChatList, setChatList,
conversationId: connversationId.current, conversationId: conversationId.current,
isResponding, isResponding,
setIsResponding, setIsResponding,
handleSend, handleSend,

View File

@ -35,7 +35,7 @@ export const useChat = (
const { notify } = useToastContext() const { notify } = useToastContext()
const { handleRun } = useWorkflowRun() const { handleRun } = useWorkflowRun()
const hasStopResponded = useRef(false) const hasStopResponded = useRef(false)
const connversationId = useRef('') const conversationId = useRef('')
const taskIdRef = useRef('') const taskIdRef = useRef('')
const [chatList, setChatList] = useState<ChatItem[]>(prevChatList || []) const [chatList, setChatList] = useState<ChatItem[]>(prevChatList || [])
const chatListRef = useRef<ChatItem[]>(prevChatList || []) const chatListRef = useRef<ChatItem[]>(prevChatList || [])
@ -100,7 +100,7 @@ export const useChat = (
}, [handleResponding, stopChat]) }, [handleResponding, stopChat])
const handleRestart = useCallback(() => { const handleRestart = useCallback(() => {
connversationId.current = '' conversationId.current = ''
taskIdRef.current = '' taskIdRef.current = ''
handleStop() handleStop()
const newChatList = config?.opening_statement const newChatList = config?.opening_statement
@ -185,7 +185,7 @@ export const useChat = (
handleResponding(true) handleResponding(true)
const bodyParams = { const bodyParams = {
conversation_id: connversationId.current, conversation_id: conversationId.current,
...params, ...params,
} }
if (bodyParams?.files?.length) { if (bodyParams?.files?.length) {
@ -214,7 +214,7 @@ export const useChat = (
} }
if (isFirstMessage && newConversationId) if (isFirstMessage && newConversationId)
connversationId.current = newConversationId conversationId.current = newConversationId
taskIdRef.current = taskId taskIdRef.current = taskId
if (messageId) if (messageId)
@ -403,7 +403,7 @@ export const useChat = (
}, [handleRun, handleResponding, handleUpdateChatList, notify, t, updateCurrentQA, config.suggested_questions_after_answer?.enabled]) }, [handleRun, handleResponding, handleUpdateChatList, notify, t, updateCurrentQA, config.suggested_questions_after_answer?.enabled])
return { return {
conversationId: connversationId.current, conversationId: conversationId.current,
chatList, chatList,
handleSend, handleSend,
handleStop, handleStop,