Skip to content

Commit

Permalink
fix: scoring route
Browse files Browse the repository at this point in the history
  • Loading branch information
Chkhikvadze committed Feb 4, 2024
1 parent e2b4f86 commit ccdfbe7
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions validators/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,17 +153,21 @@ def __init__(self, *a, **kw):
self.weight_setter: WeightSetter | None = None

async def organic_scoring(request: web.Request):
# Check access key
# access_key = request.headers.get("access-key")
# if access_key != EXPECTED_ACCESS_KEY:
# raise web.Response(status_code=401, detail="Invalid access key")
body = await request.json()
messages = body['messages']
available_uids = await validator_app.weight_setter.get_available_uids()
try:
# Check access key
access_key = request.headers.get("access-key")
if access_key != EXPECTED_ACCESS_KEY:
raise web.Response(status_code=401, detail="Invalid access key")
body = await request.json()
messages = body['messages']
available_uids = await validator_app.weight_setter.get_available_uids()

responses = await text_vali.organic_scoring(metagraph, available_uids, messages)
responses = await text_vali.organic_scoring(metagraph, available_uids, messages)

return web.json_response(responses)
return web.json_response(responses)
except Exception as e:
bt.logging.error(f'Organic scoring error: ${e}')
await web.Response(status_code=400, detail="{e}")

validator_app = ValidatorApplication()
validator_app.add_routes([web.post('/text-validator/', process_text_validator)])
Expand Down

0 comments on commit ccdfbe7

Please sign in to comment.