Skip to content

Commit

Permalink
fix: send message error when chatting with opening statement (langgen…
Browse files Browse the repository at this point in the history
  • Loading branch information
xuzuodong authored and 黎斌 committed Sep 26, 2024
1 parent 0be35f7 commit b0082da
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit b0082da

Please sign in to comment.