Skip to content

Commit

Permalink
CV2-3827 fix sync endpoint to be compatible with old endpoint (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
DGaffney authored Oct 23, 2023
1 parent 5a3fa64 commit e3f2bd3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/main/controller/presto_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ class PrestoResource(Resource):
@api.doc('Receive a presto callback for a given `model_type`')
def post(self, action, model_type):
data = request.args or request.json
print(data)
app.logger.info(f"PrestoResource {action}")
if action == "add_item":
result = similarity.callback_add_item(dict(**data.get("body"), **data.get("response", {})), model_type)
if data.get("body", {}).get("requires_callback"):
if data.get("body", {}).get("raw", {}).get("requires_callback"):
Webhook.return_webhook(app.config['CHECK_API_HOST'], action, model_type, result)
r = redis.Redis(
host=app.config['REDIS_HOST'],
Expand Down
3 changes: 2 additions & 1 deletion app/main/lib/similarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def model_response_package(item, command):
"command": command,
"threshold": item.get("threshold", 0.0),
"per_model_threshold": item.get("per_model_threshold", {}),
"match_across_content_types": item.get("match_across_current_type", False)
"match_across_content_types": item.get("match_across_current_type", False),
"requires_callback": item.get("requires_callback", False)
}
app.logger.info(f"[Alegre Similarity] [Item {item}, Command {command}] Response package looks like {response_package}")
return response_package
Expand Down

0 comments on commit e3f2bd3

Please sign in to comment.