generated from ubiquity-os/plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from sshivaditya2019/issuematch
Fix: Allow Issue Matching across org/repos
- Loading branch information
Showing
7 changed files
with
78 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ cypress/screenshots | |
script.ts | ||
.wrangler | ||
test-dashboard.md | ||
auth.users.json |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
CREATE OR REPLACE FUNCTION find_similar_issues_to_match(current_id VARCHAR, query_embedding vector(1024), threshold float8, top_k INT) | ||
RETURNS TABLE(issue_id VARCHAR, issue_plaintext TEXT, similarity float8) AS $$ | ||
DECLARE | ||
current_quantized vector(1024); | ||
current_repo TEXT; | ||
current_org TEXT; | ||
BEGIN | ||
-- Ensure the query_embedding is in the correct format | ||
current_quantized := query_embedding; | ||
|
||
-- Extract the current issue's repo and org from the payload | ||
SELECT | ||
payload->'repository'->>'name'::text, | ||
payload->'repository'->'owner'->>'login'::text | ||
INTO current_repo, current_org | ||
FROM issues | ||
WHERE id = current_id; | ||
|
||
RETURN QUERY | ||
SELECT id AS issue_id, | ||
plaintext AS issue_plaintext, | ||
((0.8 * (1 - cosine_distance(current_quantized, embedding))) + 0.2 * (1 / (1 + l2_distance(current_quantized, embedding)))) as similarity | ||
FROM issues | ||
WHERE id <> current_id | ||
AND ((0.8 * (1 - cosine_distance(current_quantized, embedding))) + 0.2 * (1 / (1 + l2_distance(current_quantized, embedding)))) > threshold | ||
ORDER BY similarity DESC | ||
LIMIT top_k; | ||
END; | ||
$$ LANGUAGE plpgsql; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters