mirror of
https://github.com/langgenius/webapp-conversation.git
synced 2025-12-08 17:32:27 +08:00
chore: can set the write input
This commit is contained in:
@ -325,13 +325,37 @@ const Main: FC<IMainProps> = () => {
|
||||
setChatList(newListWithAnswer)
|
||||
}
|
||||
|
||||
const transformToServerFile = (fileItem: any) => {
|
||||
return {
|
||||
type: 'image',
|
||||
transfer_method: fileItem.transferMethod,
|
||||
url: fileItem.url,
|
||||
upload_file_id: fileItem.id,
|
||||
}
|
||||
}
|
||||
|
||||
const handleSend = async (message: string, files?: VisionFile[]) => {
|
||||
if (isResponding) {
|
||||
notify({ type: 'info', message: t('app.errorMessage.waitForResponse') })
|
||||
return
|
||||
}
|
||||
const toServerInputs: Record<string, any> = {}
|
||||
if (currInputs) {
|
||||
Object.keys(currInputs).forEach((key) => {
|
||||
const value = currInputs[key]
|
||||
if (value.supportFileType)
|
||||
toServerInputs[key] = transformToServerFile(value)
|
||||
|
||||
else if (value[0]?.supportFileType)
|
||||
toServerInputs[key] = value.map((item: any) => transformToServerFile(item))
|
||||
|
||||
else
|
||||
toServerInputs[key] = value
|
||||
})
|
||||
}
|
||||
|
||||
const data: Record<string, any> = {
|
||||
inputs: currInputs,
|
||||
inputs: toServerInputs,
|
||||
query: message,
|
||||
conversation_id: isNewConversation ? null : currConversationId,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user