Skip to content

Commit

Permalink
Merge pull request #51 from jamakase/feature/backend-api
Browse files Browse the repository at this point in the history
update celery in docker-compose
  • Loading branch information
anntish authored Sep 12, 2024
2 parents 28f5fca + 68240d5 commit 7a68154
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ services:
command: redis-server --requirepass ${REDIS_PASSWORD}

celery_worker:
image: cr.yandex/crpc50gkvq2bp251sfgb/backend
image: cr.yandex/crpc50vq2bp251sfgb/backend
build:
context: ./services/backend
dockerfile: Dockerfile
command: celery -A celery_worker.celery worker --loglevel=info
dockerfile: Dockerfile-celery
entrypoint: watchmedo auto-restart --directory=./ --pattern=*.py --recursive -- celery -A celery_worker.celery worker --loglevel=info
volumes:
- ./services/backend:/app
environment:
Expand All @@ -100,7 +100,7 @@ services:
depends_on:
- db
- redis
- backend_app
- ml

ml:
restart: unless-stopped
Expand Down
4 changes: 3 additions & 1 deletion services/backend/services/rag_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def on_success(self, retval, task_id, args, kwargs):
message = MessageService.from_task_id(task_id).model

MessageService.save_message(
SaveMessageOptions(text=retval['result'], task_id=task_id, conversation_id=message.conversation_id, role=Role.SYSTEM, file_id = retval['file_id'])
SaveMessageOptions(text=retval['output']['result'], task_id=task_id, conversation_id=message.conversation_id, role=Role.SYSTEM, file_id = retval['file_id'])
)

super().on_success(retval, task_id, args, kwargs)
Expand Down Expand Up @@ -92,9 +92,11 @@ def run_question_task(question: str):
def run_file_question_task(file_id, file_path, question: str) -> dict:
try:
result = {
"output":{
"result": f'Ответ на вопрос с файлом: {question}',
"file_id": file_id,
"file_path": file_path
}
}

json.dumps(result)
Expand Down

0 comments on commit 7a68154

Please sign in to comment.