Closed Valdanitooooo closed 1 month ago
Thank you for your PR. Would you please use English to write the source code comment?
Thank you for your PR. Would you please use English to write the source code comment?
Of course, I will
Thank you for your PR. Would you please use English to write the source code comment?
Of course, I will
Thanks a lot. Could you move this PR to branch 'api'. It's more convinient for us to move forward.
move this PR to branch 'api'
👌
@KevinHuSh Done.
What problem does this PR solve?
discuss:https://github.com/infiniflow/ragflow/issues/1102
Completed
Refactored http_token_auth
@http_token_auth.verify_token def verify_token(token: str) -> Union[AuthUser, None]: try: objs = APIToken.query(token=token) if objs: api_token = objs[0] user = AuthUser(api_token.tenant_id, api_token.token) return user except Exception as e: server_error_response(e) return None
resources api
@manager.auth_required(http_token_auth) def get_all_datasets(query_data): ....
from ragflow.ragflow import RAGFLow ragflow = RAGFLow('', 'http://127.0.0.1:9380')
ragflow.get_all_datasets()
class UpdateDatasetReq(Schema): kb_id = fields.String(required=True) name = fields.String(validate=validators.Length(min=1, max=128)) description = fields.String(allow_none=True) permission = fields.String(validate=validators.OneOf(['me', 'team'])) embd_id = fields.String(validate=validators.Length(min=1, max=128)) language = fields.String(validate=validators.OneOf(['Chinese', 'English'])) parser_id = fields.String(validate=validators.OneOf([parser_type.value for parser_type in ParserType])) parser_config = fields.Dict() avatar = fields.String()
def http_basic_auth_required(func): @wraps(func) def decorated_view(*args, **kwargs): if 'Authorization' in flask_request.headers:
If the request header contains a token, skip username and password verification