Skip to content

Commit

Permalink
add ai model url in env
Browse files Browse the repository at this point in the history
  • Loading branch information
kailashchoudhary11 committed Jul 5, 2024
1 parent a4ff6f0 commit f5aa630
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 4 additions & 1 deletion handlers/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func validateIssue(githubClient *github.Client, repo models.Repository, currentI
}

func compareIssues(issueOne *models.Issue, issueTwo *models.Issue, isDuplicate chan int) {
fmt.Println("Comparing the issues")
payload := fmt.Sprintf(`{"issue1_title": "%v", "issue1_body": "", "issue2_title": "%v", "issue2_body": "" }`, issueOne.Title, issueTwo.Title)
jsonBody := []byte(payload)

Expand All @@ -89,7 +90,9 @@ func compareIssues(issueOne *models.Issue, issueTwo *models.Issue, isDuplicate c
Similarity float32 `json:"similarity"`
}{}

requestURL := "http://localhost:5000/compare_issues"
AIModelURL := os.Getenv("AI_MODEL_URL")

requestURL := fmt.Sprintf("%vcompare_issues", AIModelURL)
res, err := http.Post(requestURL, "application/json", bodyReader)
if err != nil {
fmt.Println("Error in making compare issues request", err)
Expand Down
5 changes: 1 addition & 4 deletions python-service/duplicacy_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@
@app.route('/compare_issues', methods=['POST'])
def compare_issues():
data = request.json
print("The data is", data)
issue1_title = data.get('issue1_title')
issue1_body = data.get('issue1_body')
issue2_title = data.get('issue2_title')
issue2_body = data.get('issue2_body')

if not issue1_title or not issue1_body or not issue2_title or not issue2_body:
return jsonify({"error": "Invalid input"}), 400

issue1_text = issue1_title + " " + issue1_body
issue2_text = issue2_title + " " + issue2_body

Expand All @@ -26,4 +24,3 @@ def compare_issues():

if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)

0 comments on commit f5aa630

Please sign in to comment.