Kevin Hu
commited on
Commit
·
25ae405
1
Parent(s):
0129457
Compatible with former API keys. (#4055)
Browse files### What problem does this PR solve?
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
- api/apps/system_app.py +8 -2
api/apps/system_app.py
CHANGED
@@ -256,8 +256,14 @@ def token_list():
|
|
256 |
if not tenants:
|
257 |
return get_data_error_result(message="Tenant not found!")
|
258 |
|
259 |
-
|
260 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
except Exception as e:
|
262 |
return server_error_response(e)
|
263 |
|
|
|
256 |
if not tenants:
|
257 |
return get_data_error_result(message="Tenant not found!")
|
258 |
|
259 |
+
tenant_id = tenants[0].tenant_id
|
260 |
+
objs = APITokenService.query(tenant_id=tenant_id)
|
261 |
+
objs = [o.to_dict() for o in objs]
|
262 |
+
for o in objs:
|
263 |
+
if not o["beta"]:
|
264 |
+
o["beta"] = generate_confirmation_token(generate_confirmation_token(tenants[0].tenant_id)).replace("ragflow-", "")[:32]
|
265 |
+
APITokenService.filter_update([APIToken.tenant_id == tenant_id, APIToken.token == o["token"]], o)
|
266 |
+
return get_json_result(data=objs)
|
267 |
except Exception as e:
|
268 |
return server_error_response(e)
|
269 |
|