Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions packages/ui/src/views/chatflows/ShareChatbot.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { StyledButton } from '@/ui-component/button/StyledButton'
import { TooltipWithParser } from '@/ui-component/tooltip/TooltipWithParser'

// Icons
import { IconX, IconCopy, IconArrowUpRightCircle } from '@tabler/icons-react'
import { IconX, IconCopy, IconExternalLink } from '@tabler/icons-react'

// API
import chatflowsApi from '@/api/chatflows'
Expand Down Expand Up @@ -95,6 +95,8 @@ const ShareChatbot = ({ isSessionMemory, isAgentCanvas }) => {
chatbotConfig?.textInput?.sendButtonColor ?? defaultConfig.textInput.sendButtonColor
)

const [customCSS, setCustomCSS] = useState(chatbotConfig?.customCSS ?? '')

const [colorAnchorEl, setColorAnchorEl] = useState(null)
const [selectedColorConfig, setSelectedColorConfig] = useState('')
const [sketchPickerColor, setSketchPickerColor] = useState('')
Expand Down Expand Up @@ -137,6 +139,8 @@ const ShareChatbot = ({ isSessionMemory, isAgentCanvas }) => {
if (textInputPlaceholder) obj.textInput.placeholder = textInputPlaceholder
if (textInputSendButtonColor) obj.textInput.sendButtonColor = textInputSendButtonColor

if (customCSS) obj.customCSS = customCSS

if (isSessionMemory) obj.overrideConfig.generateNewSession = generateNewSession

if (renderHTML) {
Expand Down Expand Up @@ -395,7 +399,7 @@ const ShareChatbot = ({ isSessionMemory, isAgentCanvas }) => {
<Typography
sx={{
p: 1,
borderRadius: 10,
borderRadius: 2,
backgroundColor: theme.palette.primary.light,
width: 'max-content',
height: 'max-content'
Expand All @@ -418,7 +422,7 @@ const ShareChatbot = ({ isSessionMemory, isAgentCanvas }) => {
<IconCopy />
</IconButton>
<IconButton title='Open New Tab' color='primary' onClick={() => window.open(`${baseURL}/chatbot/${chatflowid}`, '_blank')}>
<IconArrowUpRightCircle />
<IconExternalLink />
</IconButton>
<div style={{ flex: 1 }} />
<div style={{ display: 'flex', alignItems: 'center' }}>
Expand Down Expand Up @@ -490,6 +494,24 @@ const ShareChatbot = ({ isSessionMemory, isAgentCanvas }) => {
{textField(textInputPlaceholder, 'textInputPlaceholder', 'TextInput Placeholder', 'string', `Type question..`)}
{colorField(textInputSendButtonColor, 'textInputSendButtonColor', 'TextIntput Send Button Color')}

{/*Custom CSS*/}
<Typography variant='h4' sx={{ mb: 1, mt: 2 }}>
Custom CSS
</Typography>
<Box sx={{ pt: 2, pb: 2 }}>
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start' }}>
<Typography sx={{ mb: 1 }}>Use !important to override default styles</Typography>
<OutlinedInput
fullWidth
multiline
rows={4}
placeholder='Enter your custom CSS here'
value={customCSS}
onChange={(e) => setCustomCSS(e.target.value)}
/>
</div>
</Box>

<>
<Typography variant='h4' sx={{ mb: 1, mt: 2 }}>
Render HTML
Expand Down