fix speech to text dialog credential, fix url changed when clicked settings menu item
This commit is contained in:
parent
e55975ec7f
commit
b884e93ba2
|
|
@ -95,7 +95,6 @@ class ConversationalAgent_Agents implements INode {
|
||||||
{ sessionId: this.sessionId, chatId: options.chatId, input },
|
{ sessionId: this.sessionId, chatId: options.chatId, input },
|
||||||
options.chatHistory
|
options.chatHistory
|
||||||
)
|
)
|
||||||
// injectAgentExecutorNodeData(executor, nodeData, options)
|
|
||||||
|
|
||||||
const loggerHandler = new ConsoleCallbackHandler(options.logger)
|
const loggerHandler = new ConsoleCallbackHandler(options.logger)
|
||||||
const callbacks = await additionalCallbacks(nodeData, options)
|
const callbacks = await additionalCallbacks(nodeData, options)
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,6 @@ class MRKLAgentChat_Agents implements INode {
|
||||||
tools,
|
tools,
|
||||||
verbose: process.env.DEBUG === 'true'
|
verbose: process.env.DEBUG === 'true'
|
||||||
})
|
})
|
||||||
// injectLcAgentExecutorNodeData(executor, nodeData, options)
|
|
||||||
|
|
||||||
const callbacks = await additionalCallbacks(nodeData, options)
|
const callbacks = await additionalCallbacks(nodeData, options)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -272,8 +272,9 @@ const SpeechToTextDialog = ({ show, dialogProps, onCancel }) => {
|
||||||
</div>
|
</div>
|
||||||
{inputParam.type === 'credential' && (
|
{inputParam.type === 'credential' && (
|
||||||
<CredentialInputHandler
|
<CredentialInputHandler
|
||||||
|
key={speechToText[selectedProvider]?.credentialId}
|
||||||
data={
|
data={
|
||||||
speechToText[selectedProvider]
|
speechToText[selectedProvider]?.credentialId
|
||||||
? { credential: speechToText[selectedProvider].credentialId }
|
? { credential: speechToText[selectedProvider].credentialId }
|
||||||
: {}
|
: {}
|
||||||
}
|
}
|
||||||
|
|
@ -321,7 +322,11 @@ const SpeechToTextDialog = ({ show, dialogProps, onCancel }) => {
|
||||||
)}
|
)}
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<StyledButton variant='contained' onClick={onSave}>
|
<StyledButton
|
||||||
|
disabled={selectedProvider !== 'none' && !speechToText[selectedProvider]?.credentialId}
|
||||||
|
variant='contained'
|
||||||
|
onClick={onSave}
|
||||||
|
>
|
||||||
Save
|
Save
|
||||||
</StyledButton>
|
</StyledButton>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ export const AsyncDropdown = ({
|
||||||
})()
|
})()
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [credentialNames])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
import { useState, useEffect } from 'react'
|
import { useState, useEffect, useRef } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
import { useSelector } from 'react-redux'
|
||||||
|
|
||||||
// material-ui
|
// material-ui
|
||||||
import { useTheme } from '@mui/material/styles'
|
import { useTheme } from '@mui/material/styles'
|
||||||
import { Box, List, Paper, Popper, ClickAwayListener } from '@mui/material'
|
import { ListItemButton, ListItemIcon, ListItemText, Typography, Box, List, Paper, Popper, ClickAwayListener } from '@mui/material'
|
||||||
|
import FiberManualRecordIcon from '@mui/icons-material/FiberManualRecord'
|
||||||
|
|
||||||
// third-party
|
// third-party
|
||||||
import PerfectScrollbar from 'react-perfect-scrollbar'
|
import PerfectScrollbar from 'react-perfect-scrollbar'
|
||||||
|
|
@ -11,8 +13,6 @@ import PerfectScrollbar from 'react-perfect-scrollbar'
|
||||||
// project imports
|
// project imports
|
||||||
import MainCard from 'ui-component/cards/MainCard'
|
import MainCard from 'ui-component/cards/MainCard'
|
||||||
import Transitions from 'ui-component/extended/Transitions'
|
import Transitions from 'ui-component/extended/Transitions'
|
||||||
import NavItem from 'layout/MainLayout/Sidebar/MenuList/NavItem'
|
|
||||||
|
|
||||||
import settings from 'menu-items/settings'
|
import settings from 'menu-items/settings'
|
||||||
|
|
||||||
// ==============================|| SETTINGS ||============================== //
|
// ==============================|| SETTINGS ||============================== //
|
||||||
|
|
@ -20,9 +20,26 @@ import settings from 'menu-items/settings'
|
||||||
const Settings = ({ chatflow, isSettingsOpen, anchorEl, onSettingsItemClick, onUploadFile, onClose }) => {
|
const Settings = ({ chatflow, isSettingsOpen, anchorEl, onSettingsItemClick, onUploadFile, onClose }) => {
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
const [settingsMenu, setSettingsMenu] = useState([])
|
const [settingsMenu, setSettingsMenu] = useState([])
|
||||||
|
const customization = useSelector((state) => state.customization)
|
||||||
|
const inputFile = useRef(null)
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
|
|
||||||
|
const handleFileUpload = (e) => {
|
||||||
|
if (!e.target.files) return
|
||||||
|
|
||||||
|
const file = e.target.files[0]
|
||||||
|
|
||||||
|
const reader = new FileReader()
|
||||||
|
reader.onload = (evt) => {
|
||||||
|
if (!evt?.target?.result) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const { result } = evt.target
|
||||||
|
onUploadFile(result)
|
||||||
|
}
|
||||||
|
reader.readAsText(file)
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (chatflow && !chatflow.id) {
|
if (chatflow && !chatflow.id) {
|
||||||
const settingsMenu = settings.children.filter((menu) => menu.id === 'loadChatflow')
|
const settingsMenu = settings.children.filter((menu) => menu.id === 'loadChatflow')
|
||||||
|
|
@ -39,16 +56,40 @@ const Settings = ({ chatflow, isSettingsOpen, anchorEl, onSettingsItemClick, onU
|
||||||
|
|
||||||
// settings list items
|
// settings list items
|
||||||
const items = settingsMenu.map((menu) => {
|
const items = settingsMenu.map((menu) => {
|
||||||
return (
|
const Icon = menu.icon
|
||||||
<NavItem
|
const itemIcon = menu?.icon ? (
|
||||||
key={menu.id}
|
<Icon stroke={1.5} size='1.3rem' />
|
||||||
item={menu}
|
) : (
|
||||||
level={1}
|
<FiberManualRecordIcon
|
||||||
navType='SETTINGS'
|
sx={{
|
||||||
onClick={(id) => onSettingsItemClick(id)}
|
width: customization.isOpen.findIndex((id) => id === menu?.id) > -1 ? 8 : 6,
|
||||||
onUploadFile={onUploadFile}
|
height: customization.isOpen.findIndex((id) => id === menu?.id) > -1 ? 8 : 6
|
||||||
|
}}
|
||||||
|
fontSize={level > 0 ? 'inherit' : 'medium'}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
return (
|
||||||
|
<ListItemButton
|
||||||
|
key={menu.id}
|
||||||
|
sx={{
|
||||||
|
borderRadius: `${customization.borderRadius}px`,
|
||||||
|
mb: 0.5,
|
||||||
|
alignItems: 'flex-start',
|
||||||
|
py: 1.25,
|
||||||
|
pl: `24px`
|
||||||
|
}}
|
||||||
|
onClick={() => {
|
||||||
|
if (menu.id === 'loadChatflow' && inputFile) {
|
||||||
|
inputFile?.current.click()
|
||||||
|
} else {
|
||||||
|
onSettingsItemClick(menu.id)
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ListItemIcon sx={{ my: 'auto', minWidth: !menu?.icon ? 18 : 36 }}>{itemIcon}</ListItemIcon>
|
||||||
|
<ListItemText primary={<Typography color='inherit'>{menu.title}</Typography>} />
|
||||||
|
</ListItemButton>
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -82,6 +123,14 @@ const Settings = ({ chatflow, isSettingsOpen, anchorEl, onSettingsItemClick, onU
|
||||||
<List>{items}</List>
|
<List>{items}</List>
|
||||||
</Box>
|
</Box>
|
||||||
</PerfectScrollbar>
|
</PerfectScrollbar>
|
||||||
|
<input
|
||||||
|
type='file'
|
||||||
|
hidden
|
||||||
|
accept='.json'
|
||||||
|
ref={inputFile}
|
||||||
|
style={{ display: 'none' }}
|
||||||
|
onChange={(e) => handleFileUpload(e)}
|
||||||
|
/>
|
||||||
</MainCard>
|
</MainCard>
|
||||||
</ClickAwayListener>
|
</ClickAwayListener>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue