mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 12:32:30 +08:00
Feat: version 0.21.1 (#10718)
### What problem does this PR solve? Update version, and remove '_canvas' suffix in agent_category. ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "ragflow-cli"
|
name = "ragflow-cli"
|
||||||
version = "0.21.0"
|
version = "0.21.1"
|
||||||
description = "Admin Service's client of [RAGFlow](https://github.com/infiniflow/ragflow). The Admin Service provides user management and system monitoring. "
|
description = "Admin Service's client of [RAGFlow](https://github.com/infiniflow/ragflow). The Admin Service provides user management and system monitoring. "
|
||||||
authors = [{ name = "Lynn", email = "lynn_inf@hotmail.com" }]
|
authors = [{ name = "Lynn", email = "lynn_inf@hotmail.com" }]
|
||||||
license = { text = "Apache License, Version 2.0" }
|
license = { text = "Apache License, Version 2.0" }
|
||||||
|
|||||||
@ -1,24 +0,0 @@
|
|||||||
[project]
|
|
||||||
name = "ragflow-cli"
|
|
||||||
version = "0.21.0.dev2"
|
|
||||||
description = "Admin Service's client of [RAGFlow](https://github.com/infiniflow/ragflow). The Admin Service provides user management and system monitoring. "
|
|
||||||
authors = [{ name = "Lynn", email = "lynn_inf@hotmail.com" }]
|
|
||||||
license = { text = "Apache License, Version 2.0" }
|
|
||||||
readme = "README.md"
|
|
||||||
requires-python = ">=3.10,<3.13"
|
|
||||||
dependencies = [
|
|
||||||
"requests>=2.30.0,<3.0.0",
|
|
||||||
"beartype>=0.18.5,<0.19.0",
|
|
||||||
"pycryptodomex>=3.10.0",
|
|
||||||
"lark>=1.1.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[dependency-groups]
|
|
||||||
test = [
|
|
||||||
"pytest>=8.3.5",
|
|
||||||
"requests>=2.32.3",
|
|
||||||
"requests-toolbelt>=1.0.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[project.scripts]
|
|
||||||
ragflow-cli = "ragflow_cli.admin_client:main"
|
|
||||||
@ -32,6 +32,7 @@ from api.utils.crypt import decrypt
|
|||||||
from api.utils import (
|
from api.utils import (
|
||||||
current_timestamp,
|
current_timestamp,
|
||||||
datetime_format,
|
datetime_format,
|
||||||
|
get_format_time,
|
||||||
get_uuid,
|
get_uuid,
|
||||||
)
|
)
|
||||||
from api.utils.api_utils import (
|
from api.utils.api_utils import (
|
||||||
@ -131,6 +132,7 @@ def login_admin(email: str, password: str):
|
|||||||
login_user(user)
|
login_user(user)
|
||||||
user.update_time = (current_timestamp(),)
|
user.update_time = (current_timestamp(),)
|
||||||
user.update_date = (datetime_format(datetime.now()),)
|
user.update_date = (datetime_format(datetime.now()),)
|
||||||
|
user.last_login_time = get_format_time()
|
||||||
user.save()
|
user.save()
|
||||||
msg = "Welcome back!"
|
msg = "Welcome back!"
|
||||||
return construct_response(data=resp, auth=user.get_id(), message=msg)
|
return construct_response(data=resp, auth=user.get_id(), message=msg)
|
||||||
|
|||||||
@ -32,18 +32,24 @@ admin_bp = Blueprint('admin', __name__, url_prefix='/api/v1/admin')
|
|||||||
def login():
|
def login():
|
||||||
if not request.json:
|
if not request.json:
|
||||||
return error_response('Authorize admin failed.' ,400)
|
return error_response('Authorize admin failed.' ,400)
|
||||||
email = request.json.get("email", "")
|
try:
|
||||||
password = request.json.get("password", "")
|
email = request.json.get("email", "")
|
||||||
return login_admin(email, password)
|
password = request.json.get("password", "")
|
||||||
|
return login_admin(email, password)
|
||||||
|
except Exception as e:
|
||||||
|
return error_response(str(e), 500)
|
||||||
|
|
||||||
|
|
||||||
@admin_bp.route('/logout', methods=['GET'])
|
@admin_bp.route('/logout', methods=['GET'])
|
||||||
@login_required
|
@login_required
|
||||||
def logout():
|
def logout():
|
||||||
current_user.access_token = f"INVALID_{secrets.token_hex(16)}"
|
try:
|
||||||
current_user.save()
|
current_user.access_token = f"INVALID_{secrets.token_hex(16)}"
|
||||||
logout_user()
|
current_user.save()
|
||||||
return success_response(True)
|
logout_user()
|
||||||
|
return success_response(True)
|
||||||
|
except Exception as e:
|
||||||
|
return error_response(str(e), 500)
|
||||||
|
|
||||||
|
|
||||||
@admin_bp.route('/auth', methods=['GET'])
|
@admin_bp.route('/auth', methods=['GET'])
|
||||||
|
|||||||
@ -36,8 +36,13 @@ class UserMgr:
|
|||||||
users = UserService.get_all_users()
|
users = UserService.get_all_users()
|
||||||
result = []
|
result = []
|
||||||
for user in users:
|
for user in users:
|
||||||
result.append({'email': user.email, 'nickname': user.nickname, 'create_date': user.create_date,
|
result.append({
|
||||||
'is_active': user.is_active})
|
'email': user.email,
|
||||||
|
'nickname': user.nickname,
|
||||||
|
'create_date': user.create_date,
|
||||||
|
'is_active': user.is_active,
|
||||||
|
'is_superuser': user.is_superuser,
|
||||||
|
})
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -50,7 +55,6 @@ class UserMgr:
|
|||||||
'email': user.email,
|
'email': user.email,
|
||||||
'language': user.language,
|
'language': user.language,
|
||||||
'last_login_time': user.last_login_time,
|
'last_login_time': user.last_login_time,
|
||||||
'is_authenticated': user.is_authenticated,
|
|
||||||
'is_active': user.is_active,
|
'is_active': user.is_active,
|
||||||
'is_anonymous': user.is_anonymous,
|
'is_anonymous': user.is_anonymous,
|
||||||
'login_channel': user.login_channel,
|
'login_channel': user.login_channel,
|
||||||
@ -166,7 +170,7 @@ class UserServiceMgr:
|
|||||||
return [{
|
return [{
|
||||||
'title': r['title'],
|
'title': r['title'],
|
||||||
'permission': r['permission'],
|
'permission': r['permission'],
|
||||||
'canvas_category': r['canvas_category'].split('-')[0]
|
'canvas_category': r['canvas_category'].split('_')[0]
|
||||||
} for r in res]
|
} for r in res]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -348,7 +348,7 @@ Listing all agents of user: lynn_inf@hotmail.com
|
|||||||
+-----------------+-------------+------------+-----------------+
|
+-----------------+-------------+------------+-----------------+
|
||||||
| canvas_category | canvas_type | permission | title |
|
| canvas_category | canvas_type | permission | title |
|
||||||
+-----------------+-------------+------------+-----------------+
|
+-----------------+-------------+------------+-----------------+
|
||||||
| agent_canvas | None | team | research_helper |
|
| agent | None | team | research_helper |
|
||||||
+-----------------+-------------+------------+-----------------+
|
+-----------------+-------------+------------+-----------------+
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user