Skip to content

Commit

Permalink
👽 feat: update similarid, similartext due to model API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
synoti21 committed Oct 6, 2023
1 parent e7540d8 commit 0f9ed40
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions util/model_server_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ async function getSinglePersonalizedProblems(userId, problemNum){
async function getSimilarProbWithId(probId){
let problem_arr = []
try{
const response = await axios.get(`${process.env.BASE_URL}/api/endpoint1` , {
const response = await axios.get(`${process.env.BASE_URL}/baekjun/similar_id` , {
timeout: 3000,
params:{
problem_id: probId,
type: 'int'
}
});
problem_arr = JSON.parse(response["data"])["problems"];
if (Array.isArray(response.data['problems'])) {
problem_arr = response.data['problems'];
}
}catch(error){
logger.error(error.message)
}
Expand All @@ -42,14 +43,15 @@ async function getSimilarProbWithId(probId){
async function getSimilarProbWithContext(probContext){
let problem_arr= []
try{
const response = await axios.get(`${process.env.BASE_URL}/api/endpoint2` , {
const response = await axios.get(`${process.env.BASE_URL}/baekjun/similar_text` , {
timeout: 3000,
params:{
problem_text: probContext,
type: 'str'
}
});
problem_arr = JSON.parse(response["data"])["problems"];
if (Array.isArray(response.data['problems'])) {
problem_arr = response.data['problems'];
}
}catch(error){
logger.error(error.message)
}
Expand Down

0 comments on commit 0f9ed40

Please sign in to comment.