Skip to content

Fix/new changes#62

Merged
Sunilshah-7 merged 8 commits into
chaoss:mainfrom
Pippiblip:fix/new_changes
Jul 22, 2026
Merged

Fix/new changes#62
Sunilshah-7 merged 8 commits into
chaoss:mainfrom
Pippiblip:fix/new_changes

Conversation

@Pippiblip

Copy link
Copy Markdown

No description provided.

Pippiblip added 3 commits July 16, 2026 20:59
Problem:
The frontend only accepted URLs containing the literal string
'github.com':
  if (projectUrl.includes('github.com') === false) { reject }

This rejected every GitLab, Codeberg, and Bitbucket URL outright,
including self-hosted instances like:
  https://gitlab.windenergy.dtu.dk/pyconturb/pyconturb

Requests were blocked client-side before ever reaching the backend,
even though repository_provider.py already supports GitHub, GitLab
(including self-hosted, via _detect_engine()), Codeberg, and Bitbucket.

Fix:
Replace the single-host substring check with a structural check: any
URL with a valid scheme/host and an /owner/repo-shaped path is
accepted client-side. Real host support is left to the backend, which
already has detection logic and returns UnsupportedHostError for
genuinely unsupported hosts.

  const url = new URL(projectUrl);
  isValidRepoUrl = /^\/[^/]+\/[^/]+/.test(url.pathname);

Signed-off-by: Pippiblip <peterpie575@users.noreply.github.com>
Problem:
embedding_similarity_scores() rescaled cosine similarities using each
project's own min/max score:

  sims = (sims - sims.min()) / (sims.max() - sims.min() + 1e-8)

This guaranteed the single highest-scoring label for ANY project
landed near 1.0, and the lowest near 0.0, regardless of whether real
semantic relevance existed. Projects with no genuine SDG relevance
(gibberish/generic READMEs) still produced high-looking confidence
scores, since the rescale was relative to that project's own 17
scores rather than to any absolute notion of 'strong match'.

Solution
Replaced the per-query rescale with a fixed-bound clip:

  sims = np.clip((sims - COSINE_LOW) / (COSINE_HIGH - COSINE_LOW), 0, 1)

COSINE_LOW/COSINE_HIGH are constants derived from raw cosine
similarity distributions across a labeled sample of known-positive
and known-negative projects, rather than computed per-request

2.added an error page for when the len(sdg_prediction) = 0, i.e the project does not satisfy any SDGs

Signed-off-by: Pippiblip <peterpie575@users.noreply.github.com>
1.checked the current configurations on 60 projects and achieved an accuracy score of 80%testcases had 30 non dpg projects and 30 projects from the DPGA
2. shifted to groq for cheaper inferencing

Signed-off-by: Pippiblip <peterpie575@users.noreply.github.com>
@Sunilshah-7

Copy link
Copy Markdown
Collaborator

Description of this PR:

  1. Fix client-side URL validation that rejected all non-GitHub repo URLs (GitLab, Codeberg, Bitbucket, self-hosted forges) even though the backend already supported them
  2. Replace per-request min-max normalization of cosine similarity scores with fixed empirical bounds (COSINE_LOW=0.27, COSINE_HIGH=0.34), so confidence scores reflect real semantic relevance instead of always inflating the top label toward ~1.0 regardless of actual match quality
  3. Add a "no SDG match" empty state (NoSdgPage component) for projects that don't clear the relevance threshold on any goal
  4. Switch summarization from Hugging Face's router (DeepSeek-V3.2) to Groq (llama-3.1-8b-instant) for cheaper inference, and tighten the summarization prompt to stop speculative "used across many industries" domain claims
  5. User-supplied project description now takes priority over the repo's own README description when building classifier input
  6. Validated against 60 test projects (30 non-DPG negatives, 30 real DPGA-registry positives) — 80% ground-truth accuracy

Signed-off-by: Sunil Shah <sunilshah2416@gmail.com>
…folder

Signed-off-by: Sunil Shah <sunilshah2416@gmail.com>
…e inside each folder

Signed-off-by: Sunil Shah <sunilshah2416@gmail.com>
Signed-off-by: Sunil Shah <sunilshah2416@gmail.com>
Signed-off-by: Sunil Shah <sunilshah2416@gmail.com>
@Sunilshah-7
Sunilshah-7 merged commit 68a59ee into chaoss:main Jul 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants