diff --git a/NorahUniversity/settings.py b/NorahUniversity/settings.py index 32eedda..ccb1a6a 100644 --- a/NorahUniversity/settings.py +++ b/NorahUniversity/settings.py @@ -320,7 +320,7 @@ Q_CLUSTER = { "name": "KAAUH_CLUSTER", "workers": 2, "recycle": 500, - "timeout": 120, + "timeout": 360, "max_attempts": 1, "compress": True, "save_limit": 250, diff --git a/recruitment/forms.py b/recruitment/forms.py index 565476d..db7989b 100644 --- a/recruitment/forms.py +++ b/recruitment/forms.py @@ -2220,7 +2220,10 @@ Job: {job.title} if interview.location_type == 'Remote': initial_message += f"Pease join using meeting link {interview.join_url} \n\n" else: - initial_message += "This is an onsite schedule. Please arrive 10 minutes early.\n\n" + initial_message += f""" +Location: {interview.physical_address} +Room No: {interview.room_number} +This is an onsite schedule. Please arrive 10 minutes early.\n\n""" diff --git a/recruitment/services/ollama_service.py b/recruitment/services/ollama_service.py new file mode 100644 index 0000000..62f1f2b --- /dev/null +++ b/recruitment/services/ollama_service.py @@ -0,0 +1,44 @@ +import ollama +import re +# def clean_json_response(raw_string): +# """ +# Removes Markdown code blocks and extra whitespace from AI responses. +# """ +# # Use regex to find content between ```json and ``` or just ``` +# match = re.search(r'```(?:json)?\s*([\s\S]*?)\s*```', raw_string) +# if match: +# return match.group(1).strip() +# return raw_string.strip() + +import json +import re + +def robust_json_parser(raw_output): + # 1. Strip Markdown blocks + clean = re.sub(r'```(?:json)?|```', '', raw_output).strip() + + # 2. Fix trailing commas before closing braces/brackets + clean = re.sub(r',\s*([\]}])', r'\1', clean) + + try: + return json.loads(clean) + except json.JSONDecodeError: + # 3. Last resort: try to find the first '{' and last '}' + start_idx = clean.find('{') + end_idx = clean.rfind('}') + if start_idx != -1 and end_idx != -1: + try: + return json.loads(clean[start_idx:end_idx+1]) + except: + pass + raise + +def get_model_reponse(prompt): + response=ollama.chat( + model='alibayram/smollm3:latest', + messages=[{'role': 'user', 'content': prompt}], + stream=False # Set to True for real-time streaming + ) + # print(response['message']['content']) + response=robust_json_parser(response['message']['content']) + return response diff --git a/recruitment/views.py b/recruitment/views.py index 51b8cff..0221b4a 100644 --- a/recruitment/views.py +++ b/recruitment/views.py @@ -337,7 +337,7 @@ def create_job(request): logger.error(f"Error creating job: {e}") messages.error(request, f"Error creating job: {e}") else: - messages.error(request, f"Please correct the errors below.{form.errors}") + messages.error(request, f"Please correct the errors below.") else: form = JobPostingForm() return render(request, "jobs/create_job.html", {"form": form}) @@ -4795,6 +4795,8 @@ def interview_list(request): "search_query": search_query, "interviews": page_obj, "jobs": jobs, + "interview_type":interview_type, + } return render(request, "interviews/interview_list.html", context) diff --git a/templates/includes/search_form.html b/templates/includes/search_form.html index cc2656e..9ecb020 100644 --- a/templates/includes/search_form.html +++ b/templates/includes/search_form.html @@ -1,18 +1,16 @@ {% load i18n %} -
+ diff --git a/templates/interviews/interview_detail.html b/templates/interviews/interview_detail.html index 741a42a..0fc3317 100644 --- a/templates/interviews/interview_detail.html +++ b/templates/interviews/interview_detail.html @@ -774,18 +774,18 @@@@ -796,7 +796,7 @@
diff --git a/templates/interviews/interview_list.html b/templates/interviews/interview_list.html index 7837ef9..1b54cec 100644 --- a/templates/interviews/interview_list.html +++ b/templates/interviews/interview_list.html @@ -174,51 +174,70 @@