Skip to content

Commit 51b201a

Browse files
committed
lint fix
1 parent b99f355 commit 51b201a

File tree

4 files changed

+54
-54
lines changed

4 files changed

+54
-54
lines changed

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.

src/components/Bot.tsx

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ type IUploads = {
118118
type: string;
119119
name: string;
120120
mime: string;
121-
}[]
121+
}[];
122122

123123
type observerConfigType = (accessor: string | boolean | object | MessageType[]) => void;
124124
export type observersConfigType = Record<'observeUserInput' | 'observeLoading' | 'observeMessages', observerConfigType>;
@@ -297,7 +297,7 @@ export const Bot = (botProps: BotProps & { class?: string }) => {
297297

298298
// drag & drop
299299
const [isDragActive, setIsDragActive] = createSignal(false);
300-
const [uploadedFiles, setUploadedFiles] = createSignal<{ file: File, type: string }[]>([]);
300+
const [uploadedFiles, setUploadedFiles] = createSignal<{ file: File; type: string }[]>([]);
301301

302302
onMount(() => {
303303
if (botProps?.observersConfig) {
@@ -643,54 +643,54 @@ export const Bot = (botProps: BotProps & { class?: string }) => {
643643
};
644644

645645
const handleFileUploads = async (uploads: IUploads) => {
646-
if (!uploadedFiles().length) return uploads
646+
if (!uploadedFiles().length) return uploads;
647647

648648
if (fullFileUpload()) {
649-
const filesWithFullUploadType = uploadedFiles().filter((file) => file.type === 'file:full')
649+
const filesWithFullUploadType = uploadedFiles().filter((file) => file.type === 'file:full');
650650

651-
if (filesWithFullUploadType.length > 0) {
652-
const formData = new FormData()
653-
for (const file of filesWithFullUploadType) {
654-
formData.append('files', file.file)
655-
}
656-
formData.append('chatId', chatId())
651+
if (filesWithFullUploadType.length > 0) {
652+
const formData = new FormData();
653+
for (const file of filesWithFullUploadType) {
654+
formData.append('files', file.file);
655+
}
656+
formData.append('chatId', chatId());
657657

658-
const response = await createAttachmentWithFormData({
659-
chatflowid: props.chatflowid,
660-
apiHost: props.apiHost,
661-
formData: formData,
662-
});
658+
const response = await createAttachmentWithFormData({
659+
chatflowid: props.chatflowid,
660+
apiHost: props.apiHost,
661+
formData: formData,
662+
});
663663

664-
if (!response.data) {
665-
throw new Error('Unable to upload documents');
666-
} else {
667-
const data = response.data as any
668-
for (const extractedFileData of data) {
669-
const content = extractedFileData.content
670-
const fileName = extractedFileData.name
671-
672-
// find matching name in previews and replace data with content
673-
const uploadIndex = uploads.findIndex((upload) => upload.name === fileName)
674-
if (uploadIndex !== -1) {
675-
uploads[uploadIndex] = {
676-
...uploads[uploadIndex],
677-
data: content,
678-
name: fileName,
679-
type: 'file:full'
680-
}
681-
}
664+
if (!response.data) {
665+
throw new Error('Unable to upload documents');
666+
} else {
667+
const data = response.data as any;
668+
for (const extractedFileData of data) {
669+
const content = extractedFileData.content;
670+
const fileName = extractedFileData.name;
671+
672+
// find matching name in previews and replace data with content
673+
const uploadIndex = uploads.findIndex((upload) => upload.name === fileName);
674+
if (uploadIndex !== -1) {
675+
uploads[uploadIndex] = {
676+
...uploads[uploadIndex],
677+
data: content,
678+
name: fileName,
679+
type: 'file:full',
680+
};
682681
}
683682
}
684683
}
684+
}
685685
} else if (uploadsConfig()?.isRAGFileUploadAllowed) {
686-
const filesWithRAGUploadType = uploadedFiles().filter((file) => file.type === 'file:rag')
686+
const filesWithRAGUploadType = uploadedFiles().filter((file) => file.type === 'file:rag');
687687

688688
if (filesWithRAGUploadType.length > 0) {
689-
const formData = new FormData()
689+
const formData = new FormData();
690690
for (const file of filesWithRAGUploadType) {
691-
formData.append('files', file.file)
691+
formData.append('files', file.file);
692692
}
693-
formData.append('chatId', chatId())
693+
formData.append('chatId', chatId());
694694

695695
const response = await upsertVectorStoreWithFormData({
696696
chatflowid: props.chatflowid,
@@ -710,14 +710,14 @@ export const Bot = (botProps: BotProps & { class?: string }) => {
710710
uploads = uploads.map((upload) => {
711711
return {
712712
...upload,
713-
type: 'file:rag'
714-
}
715-
})
713+
type: 'file:rag',
714+
};
715+
});
716716
}
717717
}
718718
}
719-
return uploads
720-
}
719+
return uploads;
720+
};
721721

722722
// Handle form submission
723723
const handleSubmit = async (value: string, action?: IAction | undefined | null) => {
@@ -741,10 +741,10 @@ export const Bot = (botProps: BotProps & { class?: string }) => {
741741
});
742742

743743
try {
744-
uploads = await handleFileUploads(uploads)
744+
uploads = await handleFileUploads(uploads);
745745
} catch (error) {
746-
handleError('Unable to upload documents')
747-
return
746+
handleError('Unable to upload documents');
747+
return;
748748
}
749749

750750
clearPreviews();
@@ -1024,8 +1024,8 @@ export const Bot = (botProps: BotProps & { class?: string }) => {
10241024
setFollowUpPromptsStatus(chatbotConfig.followUpPrompts.status);
10251025
}
10261026
if (chatbotConfig.fullFileUpload) {
1027-
setFullFileUpload(chatbotConfig.fullFileUpload.status)
1028-
}
1027+
setFullFileUpload(chatbotConfig.fullFileUpload.status);
1028+
}
10291029
}
10301030

10311031
// eslint-disable-next-line solid/reactivity
@@ -1090,7 +1090,7 @@ export const Bot = (botProps: BotProps & { class?: string }) => {
10901090
});
10911091
}
10921092
if (fullFileUpload()) {
1093-
return true
1093+
return true;
10941094
}
10951095
if (uploadsConfig() && uploadsConfig()?.isRAGFileUploadAllowed && uploadsConfig()?.fileUploadSizeAndTypes) {
10961096
const fileExt = file.name.split('.').pop();
@@ -1164,7 +1164,7 @@ export const Bot = (botProps: BotProps & { class?: string }) => {
11641164
return true;
11651165
}
11661166
return false;
1167-
}
1167+
};
11681168

11691169
const handleDrag = (e: DragEvent) => {
11701170
if (uploadsConfig()?.isImageUploadAllowed || isFileUploadAllowed()) {

src/components/inputs/textInput/components/FilePreview.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ export const FilePreview = (props: CardWithDeleteOverlayProps) => {
1414
const onMouseEnter = () => {
1515
if (props.disabled) return;
1616
setIsHovered(true);
17-
}
17+
};
1818

1919
const onMouseLeave = () => {
2020
if (props.disabled) return;
2121
setIsHovered(false);
22-
}
22+
};
2323

2424
return (
2525
<div onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave} class="relative inline-block">
@@ -43,7 +43,7 @@ export const FilePreview = (props: CardWithDeleteOverlayProps) => {
4343
)}
4444
{props.disabled && (
4545
<div class="absolute inset-0 bg-[rgba(0,0,0,0.4)] flex items-center justify-center z-10 rounded-md">
46-
<div class="spinner border-4 border-gray-200 border-t-4 border-t-white rounded-full w-6 h-6 animate-spin"></div>
46+
<div class="spinner border-4 border-gray-200 border-t-4 border-t-white rounded-full w-6 h-6 animate-spin" />
4747
</div>
4848
)}
4949
</div>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export const TextInput = (props: Props) => {
158158
/>
159159
</>
160160
) : null}
161-
{(props.uploadsConfig?.isRAGFileUploadAllowed || props.isFullFileUpload) ? (
161+
{props.uploadsConfig?.isRAGFileUploadAllowed || props.isFullFileUpload ? (
162162
<>
163163
<AttachmentUploadButton
164164
buttonColor={props.sendButtonColor}

0 commit comments

Comments
 (0)