Fix bot cv uploading
All checks were successful
release / docker (push) Successful in 42s

This commit is contained in:
estromenko 2025-11-08 16:32:20 +03:00
parent 195c779088
commit 750683fb5c

View File

@ -1,4 +1,5 @@
import io
import asyncio
import os
import traceback
@ -126,14 +127,19 @@ async def handle_document(update: Update, context: ContextTypes.DEFAULT_TYPE):
customer_cv, _ = await CustomerCV.objects.aupdate_or_create(customer=customer, defaults=dict(
content=resume,
))
features = batch_extract_features(customer_cv.content)[0]
def upload_vectors():
features = batch_extract_features([customer_cv.content])[0]
add_vectors(
"cvs",
customer_cv.id,
embed_features(features.model_dump())[0],
features.model_dump(),
{'content': customer_cv.content, 'features_json': features.model_dump()},
embed_features(features.model_dump()),
)
await asyncio.to_thread(upload_vectors)
await context.bot.editMessageText("Отлично! Запомнил Ваше резюме.", update.effective_chat.id, message.id)