fix: send message error when chatting with opening statement (#8627)

This commit is contained in:
Hash Brown 2024-09-22 16:41:40 +08:00 committed by GitHub
parent eaa7e9b1f0
commit 2d869d6831
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 28 additions and 4 deletions

View File

@ -83,11 +83,17 @@ const DebugWithSingleModel = forwardRef<DebugWithSingleModelRefType, DebugWithSi
},
}
const lastAnswer = chatListRef.current.at(-1)
const data: any = {
query: message,
inputs,
model_config: configData,
parent_message_id: last_answer?.id || chatListRef.current.at(-1)?.id || null,
parent_message_id: last_answer?.id || (lastAnswer
? lastAnswer.isOpeningStatement
? null
: lastAnswer.id
: null),
}
if (visionConfig.enabled && files?.length && supportVision)

View File

@ -67,11 +67,17 @@ const ChatWrapper = () => {
}, [])
const doSend: OnSend = useCallback((message, files, last_answer) => {
const lastAnswer = chatListRef.current.at(-1)
const data: any = {
query: message,
inputs: currentConversationId ? currentConversationItem?.inputs : newConversationInputs,
conversation_id: currentConversationId,
parent_message_id: last_answer?.id || chatListRef.current.at(-1)?.id || null,
parent_message_id: last_answer?.id || (lastAnswer
? lastAnswer.isOpeningStatement
? null
: lastAnswer.id
: null),
}
if (appConfig?.file_upload?.image.enabled && files?.length)

View File

@ -69,11 +69,17 @@ const ChatWrapper = () => {
}, [])
const doSend: OnSend = useCallback((message, files, last_answer) => {
const lastAnswer = chatListRef.current.at(-1)
const data: any = {
query: message,
inputs: currentConversationId ? currentConversationItem?.inputs : newConversationInputs,
conversation_id: currentConversationId,
parent_message_id: last_answer?.id || chatListRef.current.at(-1)?.id || null,
parent_message_id: last_answer?.id || (lastAnswer
? lastAnswer.isOpeningStatement
? null
: lastAnswer.id
: null),
}
if (appConfig?.file_upload?.image.enabled && files?.length)

View File

@ -76,13 +76,19 @@ const ChatWrapper = forwardRef<ChatWrapperRefType, ChatWrapperProps>(({ showConv
)
const doSend = useCallback<OnSend>((query, files, last_answer) => {
const lastAnswer = chatListRef.current.at(-1)
handleSend(
{
query,
files,
inputs: workflowStore.getState().inputs,
conversation_id: conversationId,
parent_message_id: last_answer?.id || chatListRef.current.at(-1)?.id || null,
parent_message_id: last_answer?.id || (lastAnswer
? lastAnswer.isOpeningStatement
? null
: lastAnswer.id
: null),
},
{
onGetSuggestedQuestions: (messageId, getAbortController) => fetchSuggestedQuestions(appDetail!.id, messageId, getAbortController),