Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
Easy Quest - Smart Recruitment Tool with AI - Backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
22_23 - J 36
Easy Quest - Smart Recruitment Tool with AI - Backend
Commits
ec100f17
Commit
ec100f17
authored
May 13, 2023
by
H.M.C. Nadunithara Wijerathne
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'it1924312' into 'master'
video conference See merge request
!9
parents
caae35d8
19d12043
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
101 additions
and
21 deletions
+101
-21
NodeServer/src/config/contants.ts
NodeServer/src/config/contants.ts
+2
-0
NodeServer/src/routes/application.ts
NodeServer/src/routes/application.ts
+30
-2
NodeServer/src/routes/auth.ts
NodeServer/src/routes/auth.ts
+26
-1
NodeServer/src/routes/jobs.ts
NodeServer/src/routes/jobs.ts
+21
-2
PythonServer/nlt.py
PythonServer/nlt.py
+3
-0
PythonServer/routes/voice.py
PythonServer/routes/voice.py
+19
-16
No files found.
NodeServer/src/config/contants.ts
View file @
ec100f17
...
...
@@ -14,3 +14,5 @@ export const DEFAULT_CONTROLS = {
},
};
export
const
UTILITY_SERVER
=
"
http://127.0.0.1:8000
"
;
export
const
API_KEY
=
'
5b9267df-e7bc-4fb8-906d-5bacf5fb62e5
'
;
export
const
SECRETE_KEY
=
'
72764420a20cdaa4313f21cf8ae6df86a7c25a9b6813e23359c0f58b0a619c7a
'
NodeServer/src/routes/application.ts
View file @
ec100f17
...
...
@@ -53,7 +53,7 @@ router.post(
applicationId
:
_application
.
id
,
});
}
catch
(
error
)
{
return
res
.
json
({
success
:
false
,
error
}
);
return
res
.
status
(
400
).
send
(
error
);
}
}
);
...
...
@@ -67,7 +67,7 @@ router.put(
{
applicationId
:
string
;
update
:
Partial
<
ApplicationType
>
;
candidateId
:
string
;
candidateId
?
:
string
;
}
>
,
res
...
...
@@ -97,6 +97,34 @@ router.put(
}
);
router
.
put
(
"
/update/action
"
,
authMiddleware
,
async
(
req
:
TypedRequest
<
{},
{
applicationId
:
string
;
update
:
Partial
<
ApplicationType
>
;
}
>
,
res
)
=>
{
let
update
=
req
.
body
.
update
;
Application
.
findByIdAndUpdate
(
req
.
body
.
applicationId
,
{
$set
:
update
,
})
.
then
((
_application
)
=>
{
res
.
json
({
success
:
true
,
application
:
{
...
_application
,
...
update
},
});
})
.
catch
((
err
)
=>
res
.
send
(
err
));
}
);
router
.
put
(
"
/update/voice-verification
"
,
async
(
...
...
NodeServer/src/routes/auth.ts
View file @
ec100f17
...
...
@@ -23,7 +23,12 @@ import {
processAttempt
,
updatePasswordFromProcessedData
,
}
from
"
../utilities/keystroke
"
;
import
{
DEFAULT_CONTROLS
,
JWT_SECRET
}
from
"
../config/contants
"
;
import
{
API_KEY
,
DEFAULT_CONTROLS
,
JWT_SECRET
,
SECRETE_KEY
,
}
from
"
../config/contants
"
;
import
{
authMiddleware
}
from
"
../middlewares/auth
"
;
const
router
=
Router
();
...
...
@@ -255,4 +260,24 @@ router.post(
}
);
router
.
get
(
"
/conference/key
"
,
authMiddleware
,
async
(
req
,
res
)
=>
{
try
{
const
payload
=
{
apikey
:
API_KEY
,
permissions
:
[
`allow_join`
],
// `ask_join` || `allow_mod`
version
:
2
,
roles
:
[
"
CRAWLER
"
],
};
const
token
=
await
jwt
.
sign
(
payload
,
SECRETE_KEY
,
{
expiresIn
:
"
5h
"
,
algorithm
:
"
HS256
"
,
});
return
res
.
json
({
token
});
}
catch
(
error
)
{
return
res
.
status
(
400
).
send
(
error
);
}
});
module
.
exports
=
router
;
NodeServer/src/routes/jobs.ts
View file @
ec100f17
...
...
@@ -3,7 +3,7 @@ import {
JobType
,
TypedRequest
,
USER_TYPE
,
}
from
"
../config/types
"
;
}
from
"
../config/types
"
;
import
{
authMiddleware
,
organizationMiddleware
,
...
...
@@ -26,7 +26,7 @@ router.get(
jobs
=
await
Jobs
.
find
()
.
populate
({
path
:
"
applications
"
,
select
:
[
"
candidate
"
,
"
status
"
],
select
:
[
"
candidate
"
,
"
status
"
,
"
interview
"
],
})
.
populate
({
path
:
"
organization
"
});
}
else
{
...
...
@@ -102,4 +102,23 @@ router.delete(
}
);
router
.
get
(
"
/search
"
,
authMiddleware
,
(
req
:
TypedRequest
<
{
key
:
string
},
null
>
,
res
)
=>
{
console
.
log
(
req
.
query
.
key
)
const
pipeline
=
[
{
$search
:
{
index
:
"
searchJobs
"
,
text
:
{
query
:
req
.
query
.
key
,
path
:
{
"
wildcard
"
:
"
*
"
},
fuzzy
:
{},
},
},
}
];
Jobs
.
aggregate
(
pipeline
).
then
((
data
)
=>
res
.
status
(
200
).
json
({
data
})).
catch
(()
=>
{
res
.
status
(
200
).
json
({
data
:[]
})
});
})
module
.
exports
=
router
;
PythonServer/nlt.py
0 → 100644
View file @
ec100f17
import
nltk
nltk
.
download
(
'stopwords'
)
\ No newline at end of file
PythonServer/routes/voice.py
View file @
ec100f17
...
...
@@ -45,26 +45,29 @@ def enroll(payload:EnrollVoice):
@
router
.
post
(
"/verify"
)
async
def
verify
(
payload
:
VerifyVoice
):
video_filename
=
'videos/interviews/'
+
payload
.
application_id
+
'.mp4'
urllib
.
request
.
urlretrieve
(
payload
.
video_url
,
video_filename
)
try
:
video_filename
=
'videos/interviews/'
+
payload
.
application_id
+
'.mp4'
urllib
.
request
.
urlretrieve
(
payload
.
video_url
,
video_filename
)
# Download video and save audio
video
=
moviepy
.
editor
.
VideoFileClip
(
video_filename
)
audio
=
video
.
audio
audio_filename
=
'voices/interviews/'
+
payload
.
application_id
+
'.wav'
audio
.
write_audiofile
(
audio_filename
,
codec
=
'pcm_s16le'
,
bitrate
=
'50k'
)
# Download video and save audio
video
=
moviepy
.
editor
.
VideoFileClip
(
video_filename
)
audio
=
video
.
audio
audio_filename
=
'voices/interviews/'
+
payload
.
application_id
+
'.wav'
audio
.
write_audiofile
(
audio_filename
,
codec
=
'pcm_s16le'
,
bitrate
=
'50k'
)
model
=
load_model
(
MODEL_FILE
)
test_result
=
get_embedding
(
model
,
audio_filename
,
MAX_SEC
)
test_embs
=
np
.
array
(
test_result
.
tolist
())
enroll_embs
=
np
.
load
(
"voices/auth/embed/"
+
payload
.
user_id
+
".npy"
)
distance
=
euclidean
(
test_embs
,
enroll_embs
)
url
=
"http://localhost:5000/applications/update/voice-verification"
payload
=
{
'update'
:
round
(
1
-
distance
,
5
),
'applicationId'
:
payload
.
application_id
}
model
=
load_model
(
MODEL_FILE
)
test_result
=
get_embedding
(
model
,
audio_filename
,
MAX_SEC
)
test_embs
=
np
.
array
(
test_result
.
tolist
())
enroll_embs
=
np
.
load
(
"voices/auth/embed/"
+
payload
.
user_id
+
".npy"
)
distance
=
euclidean
(
test_embs
,
enroll_embs
)
url
=
"http://localhost:5000/applications/update/voice-verification"
payload
=
{
'update'
:
round
(
1
-
distance
,
5
),
'applicationId'
:
payload
.
application_id
}
await
SingletonAiohttp
.
put_url
(
url
,
payload
)
await
SingletonAiohttp
.
put_url
(
url
,
payload
)
return
'success'
return
'success'
except
:
return
'failed'
@
router
.
post
(
"/analyse"
)
def
analys
(
payload
:
AnalyseVoice
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment