From 4324a8bb4f5b50221b58bc646c8dc0d342b0dc8a Mon Sep 17 00:00:00 2001
From: Sean Hatfield <seanhatfield5@gmail.com>
Date: Wed, 29 May 2024 02:01:29 -0700
Subject: [PATCH] [FEAT] Github repo loader bug fix (#1558)

* fix project names with special characters for github repo data connector

* linting
---
 collector/utils/extensions/GithubRepo/RepoLoader/index.js | 6 +++++-
 frontend/src/hooks/useGetProvidersModels.js               | 7 ++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/collector/utils/extensions/GithubRepo/RepoLoader/index.js b/collector/utils/extensions/GithubRepo/RepoLoader/index.js
index dbe26fa29..c842f621b 100644
--- a/collector/utils/extensions/GithubRepo/RepoLoader/index.js
+++ b/collector/utils/extensions/GithubRepo/RepoLoader/index.js
@@ -14,7 +14,11 @@ class RepoLoader {
   #validGithubUrl() {
     const UrlPattern = require("url-pattern");
     const pattern = new UrlPattern(
-      "https\\://github.com/(:author)/(:project(*))"
+      "https\\://github.com/(:author)/(:project(*))",
+      {
+        // fixes project names with special characters (.github)
+        segmentValueCharset: "a-zA-Z0-9-._~%/+",
+      }
     );
     const match = pattern.match(this.repo);
     if (!match) return false;
diff --git a/frontend/src/hooks/useGetProvidersModels.js b/frontend/src/hooks/useGetProvidersModels.js
index d61d4c36d..e0a276993 100644
--- a/frontend/src/hooks/useGetProvidersModels.js
+++ b/frontend/src/hooks/useGetProvidersModels.js
@@ -10,7 +10,12 @@ export const DISABLED_PROVIDERS = [
 ];
 const PROVIDER_DEFAULT_MODELS = {
   openai: [],
-  gemini: ["gemini-pro","gemini-1.0-pro", "gemini-1.5-pro-latest", "gemini-1.5-flash-latest"],
+  gemini: [
+    "gemini-pro",
+    "gemini-1.0-pro",
+    "gemini-1.5-pro-latest",
+    "gemini-1.5-flash-latest",
+  ],
   anthropic: [
     "claude-instant-1.2",
     "claude-2.0",
-- 
GitLab