Skip to content

Commit 5dd0a28

Browse files
committed
Merge branch 'main' into feature/AgentFlowV2
# Conflicts: # dist/components/Bot.d.ts.map # dist/web.js # dist/web.umd.js # src/components/Bot.tsx
2 parents b7bc51a + c904dcf commit 5dd0a28

8 files changed

Lines changed: 19 additions & 8 deletions

File tree

dist/components/Bot.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/components/inputs/textInput/components/TextInput.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ type TextInputProps = {
2020
autoFocus?: boolean;
2121
sendMessageSound?: boolean;
2222
sendSoundLocation?: string;
23+
fullFileUploadAllowedTypes?: string;
2324
enableInputHistory?: boolean;
2425
maxHistorySize?: number;
2526
};

dist/components/inputs/textInput/components/TextInput.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/web.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/web.umd.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Bot.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ export const Bot = (botProps: BotProps & { class?: string }) => {
514514
// drag & drop
515515
const [isDragActive, setIsDragActive] = createSignal(false);
516516
const [uploadedFiles, setUploadedFiles] = createSignal<{ file: File; type: string }[]>([]);
517+
const [fullFileUploadAllowedTypes, setFullFileUploadAllowedTypes] = createSignal('*');
517518

518519
createMemo(() => {
519520
const customerId = (props.chatflowConfig?.vars as any)?.customerId;
@@ -772,14 +773,18 @@ export const Bot = (botProps: BotProps & { class?: string }) => {
772773
}
773774

774775
if (data.followUpPrompts) {
776+
let followUpPrompts = data.followUpPrompts;
777+
if (typeof followUpPrompts === 'string') {
778+
followUpPrompts = JSON.parse(followUpPrompts);
779+
}
775780
setMessages((prevMessages) => {
776781
const allMessages = [...cloneDeep(prevMessages)];
777782
if (allMessages[allMessages.length - 1].type === 'userMessage') return allMessages;
778-
allMessages[allMessages.length - 1].followUpPrompts = data.followUpPrompts;
783+
allMessages[allMessages.length - 1].followUpPrompts = followUpPrompts;
779784
addChatMessage(allMessages);
780785
return allMessages;
781786
});
782-
setFollowUpPrompts(JSON.parse(data.followUpPrompts));
787+
setFollowUpPrompts(followUpPrompts);
783788
}
784789
};
785790

@@ -1396,6 +1401,9 @@ export const Bot = (botProps: BotProps & { class?: string }) => {
13961401
}
13971402
if (chatbotConfig.fullFileUpload) {
13981403
setFullFileUpload(chatbotConfig.fullFileUpload.status);
1404+
if (chatbotConfig.fullFileUpload?.allowedUploadFileTypes) {
1405+
setFullFileUploadAllowedTypes(chatbotConfig.fullFileUpload?.allowedUploadFileTypes);
1406+
}
13991407
}
14001408
}
14011409

@@ -1986,6 +1994,7 @@ export const Bot = (botProps: BotProps & { class?: string }) => {
19861994
onSubmit={handleSubmit}
19871995
uploadsConfig={uploadsConfig()}
19881996
isFullFileUpload={fullFileUpload()}
1997+
fullFileUploadAllowedTypes={fullFileUploadAllowedTypes()}
19891998
setPreviews={setPreviews}
19901999
onMicrophoneClicked={onMicrophoneClicked}
19912000
handleFileChange={handleFileChange}

src/components/bubbles/BotBubble.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ export const BotBubble = (props: Props) => {
335335
<Avatar initialAvatarSrc={props.avatarSrc} />
336336
</Show>
337337
<div class="flex flex-col justify-start">
338-
{props.message.agentFlowExecutedData &&
338+
{props.showAgentMessages && props.message.agentFlowExecutedData &&
339339
Array.isArray(props.message.agentFlowExecutedData) &&
340340
props.message.agentFlowExecutedData.length > 0 && (
341341
<div>

src/components/inputs/textInput/components/TextInput.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type TextInputProps = {
2828
autoFocus?: boolean;
2929
sendMessageSound?: boolean;
3030
sendSoundLocation?: string;
31+
fullFileUploadAllowedTypes?: string;
3132
enableInputHistory?: boolean;
3233
maxHistorySize?: number;
3334
};
@@ -128,7 +129,7 @@ export const TextInput = (props: TextInputProps) => {
128129
};
129130

130131
const getFileType = () => {
131-
if (props.isFullFileUpload) return '*';
132+
if (props.isFullFileUpload) return props.fullFileUploadAllowedTypes === '' ? '*' : props.fullFileUploadAllowedTypes;
132133
if (props.uploadsConfig?.fileUploadSizeAndTypes?.length) {
133134
const allowedFileTypes = props.uploadsConfig?.fileUploadSizeAndTypes.map((allowed) => allowed.fileTypes).join(',');
134135
if (allowedFileTypes.includes('*')) return '*';

0 commit comments

Comments
 (0)