Spaces:
Runtime error
Runtime error
Update services/resume_service.py
Browse files- services/resume_service.py +9 -13
services/resume_service.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import json
|
| 2 |
-
from typing import Dict
|
| 3 |
from datetime import datetime
|
| 4 |
|
| 5 |
from core.doc_processor import (
|
|
@@ -11,7 +11,6 @@ from core.text_processor import chunk_text
|
|
| 11 |
from core.vector_store import create_or_load_vectorstore, similarity_search
|
| 12 |
from services.llm_service import get_llm, get_unified_resume_prompt
|
| 13 |
from services.db_service import store_candidate_data
|
| 14 |
-
from config.settings import get_settings
|
| 15 |
|
| 16 |
|
| 17 |
async def analyze_resume_document(
|
|
@@ -34,16 +33,14 @@ async def analyze_resume_document(
|
|
| 34 |
|
| 35 |
analysis_result = analyze_resume_with_llm(vector_store, resume_text, job_role, file_modified_date)
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
analysis_result["stored_in_db"] = False
|
| 46 |
-
analysis_result["db_error"] = str(e)
|
| 47 |
|
| 48 |
return analysis_result
|
| 49 |
|
|
@@ -91,7 +88,6 @@ def analyze_resume_with_llm(vectorstore, resume_text: str, job_role: str, file_m
|
|
| 91 |
"region": None,
|
| 92 |
"relevant_experience": None,
|
| 93 |
"experience_summary": "No relevant experience analysis available",
|
| 94 |
-
"file_modified_date": file_modified_date
|
| 95 |
}
|
| 96 |
|
| 97 |
result = {**default_response, **parsed_response}
|
|
|
|
| 1 |
import json
|
| 2 |
+
from typing import Dict
|
| 3 |
from datetime import datetime
|
| 4 |
|
| 5 |
from core.doc_processor import (
|
|
|
|
| 11 |
from core.vector_store import create_or_load_vectorstore, similarity_search
|
| 12 |
from services.llm_service import get_llm, get_unified_resume_prompt
|
| 13 |
from services.db_service import store_candidate_data
|
|
|
|
| 14 |
|
| 15 |
|
| 16 |
async def analyze_resume_document(
|
|
|
|
| 33 |
|
| 34 |
analysis_result = analyze_resume_with_llm(vector_store, resume_text, job_role, file_modified_date)
|
| 35 |
|
| 36 |
+
try:
|
| 37 |
+
db_record = await store_candidate_data(analysis_result)
|
| 38 |
+
analysis_result["id"] = db_record.get("id")
|
| 39 |
+
analysis_result["stored_in_db"] = True
|
| 40 |
+
except Exception as e:
|
| 41 |
+
print(f"Error storing candidate data: {str(e)}")
|
| 42 |
+
analysis_result["stored_in_db"] = False
|
| 43 |
+
analysis_result["db_error"] = str(e)
|
|
|
|
|
|
|
| 44 |
|
| 45 |
return analysis_result
|
| 46 |
|
|
|
|
| 88 |
"region": None,
|
| 89 |
"relevant_experience": None,
|
| 90 |
"experience_summary": "No relevant experience analysis available",
|
|
|
|
| 91 |
}
|
| 92 |
|
| 93 |
result = {**default_response, **parsed_response}
|