Compare commits

...

3 Commits

Author SHA1 Message Date
41b3a250a7 Clean invalid vacancies from clickhouse query
All checks were successful
release / docker (push) Successful in 35s
2025-11-09 15:35:34 +03:00
96d8621d49 Remove blocking call in bot method 2025-11-09 15:30:32 +03:00
b23502ee6a Improve quality for classification 2025-11-09 15:28:51 +03:00
3 changed files with 10 additions and 7 deletions

View File

@ -1,5 +1,6 @@
import io import io
import os import os
import asyncio
import traceback import traceback
from asgiref.sync import sync_to_async from asgiref.sync import sync_to_async
@ -66,7 +67,7 @@ async def next_vacancy(update: Update, context: ContextTypes.DEFAULT_TYPE):
await context.bot.send_message(chat_id=update.effective_chat.id, text=message) await context.bot.send_message(chat_id=update.effective_chat.id, text=message)
return return
vacancy = get_next_vacancy(customer_cv) vacancy = await asyncio.to_thread(get_next_vacancy, customer_cv)
if not vacancy: if not vacancy:
message = "Вакансии закончились, возвращайтесь позже!" message = "Вакансии закончились, возвращайтесь позже!"
await context.bot.send_message(chat_id=update.effective_chat.id, text=message) await context.bot.send_message(chat_id=update.effective_chat.id, text=message)

View File

@ -24,7 +24,8 @@ WHERE timestamp >= %(timestamp)s
'заниматься', 'формат', 'занятость', 'вилка', 'должност', 'контакт' 'заниматься', 'формат', 'занятость', 'вилка', 'должност', 'контакт'
]) >= 5 ]) >= 5
AND arrayCount(x -> position(lower(message), x) > 0, [ AND arrayCount(x -> position(lower(message), x) > 0, [
'о себе', 'обо мне', 'умею', '#ищу', '#резюме', 'университет', 'колледж' 'о себе', 'обо мне', 'умею', '#ищу', '#резюме', 'университет', 'колледж',
'не будет опубликовано'
]) = 0 ]) = 0
ORDER BY timestamp ASC ORDER BY timestamp ASC
""" """
@ -42,7 +43,7 @@ class Command(BaseCommand):
min_salary_rub: int | None min_salary_rub: int | None
max_salary_rub: int | None max_salary_rub: int | None
openai_client = ChatOpenAI(model_name="gpt-5-mini", reasoning_effort="minimal", temperature=0, seed=42, top_p=1) openai_client = ChatOpenAI(model_name="gpt-5-mini", temperature=0, seed=42, top_p=1)
structured_llm = openai_client.with_structured_output(Structure) structured_llm = openai_client.with_structured_output(Structure)
last_timestamp = timezone.now() - timedelta(days=30) last_timestamp = timezone.now() - timedelta(days=30)
@ -59,6 +60,7 @@ class Command(BaseCommand):
Ты HR-классификатор. Ниже приведён список допустимых профессий. Ты HR-классификатор. Ниже приведён список допустимых профессий.
Твоя задача выбрать наиболее подходящую по смыслу. Твоя задача выбрать наиболее подходящую по смыслу.
Качество классификации - самое важное. Качество классификации - самое важное.
Если не уверен, то лучше укажи "Другое", ошибки недопустимы.
Игнорируй орфографические и стилистические различия. Игнорируй орфографические и стилистические различия.
Вакансия: Вакансия:
{row[3]} {row[3]}

View File

@ -1,12 +1,12 @@
from vacancies.main.models import Vacancy from vacancies.main.models import Vacancy
from django.db.models import Q
def get_next_vacancy(customer_cv): def get_next_vacancy(customer_cv):
vacancy = Vacancy.objects.exclude( vacancy = Vacancy.objects.filter(
id__in=customer_cv.customer.recommended_vacancies.values_list("vacancy_id", flat=True), ~Q(id__in=customer_cv.customer.recommended_vacancies.values_list("vacancy_id", flat=True)),
).filter( Q(min_salary_rub__isnull=True) | Q(min_salary_rub__gt=customer_cv.min_salary_rub),
job_title__title__in=customer_cv.job_titles.values_list("title", flat=True), job_title__title__in=customer_cv.job_titles.values_list("title", flat=True),
min_salary_rub__gt=customer_cv.min_salary_rub,
).first() ).first()
if vacancy: if vacancy:
customer_cv.customer.recommended_vacancies.create(vacancy=vacancy) customer_cv.customer.recommended_vacancies.create(vacancy=vacancy)