Update the component of the agent API with parameters. (#4131)

### What problem does this PR solve?

Update the  component of the agent API with parameters.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
- [x] New Feature (non-breaking change which adds functionality)
- [x] Refactoring

---------

Co-authored-by: liuhua <10215101452@stu.ecun.edu.cn>
Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
Co-authored-by: writinwaters <93570324+writinwaters@users.noreply.github.com>
This commit is contained in:
liuhua
2024-12-20 17:34:16 +08:00
committed by GitHub
parent a0dc9e1bdf
commit 35580af875
8 changed files with 152 additions and 185 deletions

View File

@ -283,7 +283,10 @@ def construct_error_response(e):
def token_required(func):
@wraps(func)
def decorated_function(*args, **kwargs):
authorization_list=flask_request.headers.get('Authorization').split()
authorization_str=flask_request.headers.get('Authorization')
if not authorization_str:
return get_json_result(data=False,message="`Authorization` can't be empty")
authorization_list=authorization_str.split()
if len(authorization_list) < 2:
return get_json_result(data=False,message="Please check your authorization format.")
token = authorization_list[1]