Skip to content

Commit

Permalink
Fix: properly trim websites with space
Browse files Browse the repository at this point in the history
Signed-off-by: Daishan Peng <[email protected]>
  • Loading branch information
StrongMonkey committed Nov 11, 2024
1 parent 1ca8f3b commit adda37f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ui/admin/app/components/knowledge/AddSourceModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ const AddSourceModal: FC<AddSourceModalProps> = ({

const handleAddWebsite = async () => {
if (newWebsite) {
let trimmedWebsite = newWebsite.trim();

Check failure on line 59 in ui/admin/app/components/knowledge/AddSourceModal.tsx

View workflow job for this annotation

GitHub Actions / lint

'trimmedWebsite' is never reassigned. Use 'const' instead
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: {
Expand Down

0 comments on commit adda37f

Please sign in to comment.