mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-29 13:01:14 +03:00
Show transcribed audio inputs as message along with audio clip in internal chat
This commit is contained in:
@@ -1811,7 +1811,7 @@ export class App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run Speech to Text conversion
|
// Run Speech to Text conversion
|
||||||
if (upload.mime === 'audio/webm' && incomingInput.uploads?.length === 1) {
|
if (upload.mime === 'audio/webm') {
|
||||||
let speechToTextConfig: ICommonObject = {}
|
let speechToTextConfig: ICommonObject = {}
|
||||||
if (chatflow.speechToText) {
|
if (chatflow.speechToText) {
|
||||||
const speechToTextProviders = JSON.parse(chatflow.speechToText)
|
const speechToTextProviders = JSON.parse(chatflow.speechToText)
|
||||||
@@ -2111,6 +2111,9 @@ export class App {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Prepare response
|
// Prepare response
|
||||||
|
// return the question in the response
|
||||||
|
// this is used when input text is empty but question is in audio format
|
||||||
|
result.question = incomingInput.question
|
||||||
result.chatId = chatId
|
result.chatId = chatId
|
||||||
result.chatMessageId = chatMessage.id
|
result.chatMessageId = chatMessage.id
|
||||||
if (sessionId) result.sessionId = sessionId
|
if (sessionId) result.sessionId = sessionId
|
||||||
|
|||||||
@@ -688,9 +688,9 @@ const ViewMessagesDialog = ({ show, dialogProps, onCancel }) => {
|
|||||||
style={{
|
style={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexWrap: 'wrap',
|
flexWrap: 'wrap',
|
||||||
flexDirection: 'row',
|
flexDirection: 'column',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
gap: '4px'
|
gap: '8px'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{message.fileUploads.map((item, index) => {
|
{message.fileUploads.map((item, index) => {
|
||||||
|
|||||||
@@ -391,6 +391,17 @@ export const ChatMessage = ({ open, chatflowid, isDialog, previews, setPreviews
|
|||||||
|
|
||||||
if (!chatId) setChatId(data.chatId)
|
if (!chatId) setChatId(data.chatId)
|
||||||
|
|
||||||
|
if (input === '' && data.question) {
|
||||||
|
// the response contains the question even if it was in an audio format
|
||||||
|
// so if input is empty but the response contains the question, update the user message to show the question
|
||||||
|
setMessages((prevMessages) => {
|
||||||
|
let allMessages = [...cloneDeep(prevMessages)]
|
||||||
|
if (allMessages[allMessages.length - 2].type === 'apiMessage') return allMessages
|
||||||
|
allMessages[allMessages.length - 2].message = data.question
|
||||||
|
return allMessages
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if (!isChatFlowAvailableToStream) {
|
if (!isChatFlowAvailableToStream) {
|
||||||
let text = ''
|
let text = ''
|
||||||
if (data.text) text = data.text
|
if (data.text) text = data.text
|
||||||
@@ -669,9 +680,9 @@ export const ChatMessage = ({ open, chatflowid, isDialog, previews, setPreviews
|
|||||||
style={{
|
style={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexWrap: 'wrap',
|
flexWrap: 'wrap',
|
||||||
flexDirection: 'row',
|
flexDirection: 'column',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
gap: '4px'
|
gap: '8px'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{message.fileUploads.map((item, index) => {
|
{message.fileUploads.map((item, index) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user