diff --git a/ui/admin/app/components/knowledge/AddSourceModal.tsx b/ui/admin/app/components/knowledge/AddSourceModal.tsx index 4832701d1..74d0a4d3e 100644 --- a/ui/admin/app/components/knowledge/AddSourceModal.tsx +++ b/ui/admin/app/components/knowledge/AddSourceModal.tsx @@ -56,11 +56,12 @@ const AddSourceModal: FC<AddSourceModalProps> = ({ const handleAddWebsite = async () => { if (newWebsite) { + const trimmedWebsite = newWebsite.trim(); const formattedWebsite = - newWebsite.startsWith("http://") || - newWebsite.startsWith("https://") - ? newWebsite.trim() - : `https://${newWebsite.trim()}`; + trimmedWebsite.startsWith("http://") || + trimmedWebsite.startsWith("https://") + ? trimmedWebsite + : `https://${trimmedWebsite}`; const res = await KnowledgeService.createKnowledgeSource(agentId, { websiteCrawlingConfig: {