mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Fix: add avatar for UI (#11080)
### What problem does this PR solve? Add avatar for admin UI. ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -632,7 +632,9 @@ class AdminCLI(Cmd):
|
|||||||
response = self.session.get(url)
|
response = self.session.get(url)
|
||||||
res_json = response.json()
|
res_json = response.json()
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
self._print_table_simple(res_json['data'])
|
table_data = res_json['data']
|
||||||
|
table_data.pop('avatar')
|
||||||
|
self._print_table_simple(table_data)
|
||||||
else:
|
else:
|
||||||
print(f"Fail to get user {user_name}, code: {res_json['code']}, message: {res_json['message']}")
|
print(f"Fail to get user {user_name}, code: {res_json['code']}, message: {res_json['message']}")
|
||||||
|
|
||||||
@ -705,7 +707,10 @@ class AdminCLI(Cmd):
|
|||||||
response = self.session.get(url)
|
response = self.session.get(url)
|
||||||
res_json = response.json()
|
res_json = response.json()
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
self._print_table_simple(res_json['data'])
|
table_data = res_json['data']
|
||||||
|
for t in table_data:
|
||||||
|
t.pop('avatar')
|
||||||
|
self._print_table_simple(table_data)
|
||||||
else:
|
else:
|
||||||
print(f"Fail to get all datasets of {user_name}, code: {res_json['code']}, message: {res_json['message']}")
|
print(f"Fail to get all datasets of {user_name}, code: {res_json['code']}, message: {res_json['message']}")
|
||||||
|
|
||||||
@ -717,7 +722,10 @@ class AdminCLI(Cmd):
|
|||||||
response = self.session.get(url)
|
response = self.session.get(url)
|
||||||
res_json = response.json()
|
res_json = response.json()
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
self._print_table_simple(res_json['data'])
|
table_data = res_json['data']
|
||||||
|
for t in table_data:
|
||||||
|
t.pop('avatar')
|
||||||
|
self._print_table_simple(table_data)
|
||||||
else:
|
else:
|
||||||
print(f"Fail to get all agents of {user_name}, code: {res_json['code']}, message: {res_json['message']}")
|
print(f"Fail to get all agents of {user_name}, code: {res_json['code']}, message: {res_json['message']}")
|
||||||
|
|
||||||
|
|||||||
@ -52,6 +52,7 @@ class UserMgr:
|
|||||||
result = []
|
result = []
|
||||||
for user in users:
|
for user in users:
|
||||||
result.append({
|
result.append({
|
||||||
|
'avatar': user.avatar,
|
||||||
'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,
|
||||||
@ -170,7 +171,8 @@ 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],
|
||||||
|
'avatar': r['avatar']
|
||||||
} for r in res]
|
} for r in res]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -67,6 +67,7 @@ class UserCanvasService(CommonService):
|
|||||||
# will get all permitted agents, be cautious
|
# will get all permitted agents, be cautious
|
||||||
fields = [
|
fields = [
|
||||||
cls.model.id,
|
cls.model.id,
|
||||||
|
cls.model.avatar,
|
||||||
cls.model.title,
|
cls.model.title,
|
||||||
cls.model.permission,
|
cls.model.permission,
|
||||||
cls.model.canvas_type,
|
cls.model.canvas_type,
|
||||||
|
|||||||
@ -201,6 +201,7 @@ class KnowledgebaseService(CommonService):
|
|||||||
# will get all permitted kb, be cautious.
|
# will get all permitted kb, be cautious.
|
||||||
fields = [
|
fields = [
|
||||||
cls.model.name,
|
cls.model.name,
|
||||||
|
cls.model.avatar,
|
||||||
cls.model.language,
|
cls.model.language,
|
||||||
cls.model.permission,
|
cls.model.permission,
|
||||||
cls.model.doc_num,
|
cls.model.doc_num,
|
||||||
|
|||||||
@ -146,7 +146,10 @@ def get_redis_info():
|
|||||||
def check_ragflow_server_alive():
|
def check_ragflow_server_alive():
|
||||||
start_time = timer()
|
start_time = timer()
|
||||||
try:
|
try:
|
||||||
response = requests.get(f'http://{settings.HOST_IP}:{settings.HOST_PORT}/v1/system/ping')
|
url = f'http://{settings.HOST_IP}:{settings.HOST_PORT}/v1/system/ping'
|
||||||
|
if '0.0.0.0' in url:
|
||||||
|
url.replace('0.0.0.0', '127.0.0.1')
|
||||||
|
response = requests.get(url)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
return {"status": "alive", "message": f"Confirm elapsed: {(timer() - start_time) * 1000.0:.1f} ms."}
|
return {"status": "alive", "message": f"Confirm elapsed: {(timer() - start_time) * 1000.0:.1f} ms."}
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user