mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-09-10 22:20:25 +00:00
feat(task): replace built-in task adaptors with a sandboxed JS plugin system (#7076)
This commit is contained in:
@@ -121,6 +121,8 @@ func formatUserLogs(logs []*Log, startIdx int) {
|
||||
if otherMap != nil {
|
||||
// Remove admin-only debug fields.
|
||||
delete(otherMap, "admin_info")
|
||||
// Remove diagnostics reserved for root.
|
||||
delete(otherMap, "root_info")
|
||||
// Remove operation-audit details (operator/route info), admin-only.
|
||||
delete(otherMap, "audit_info")
|
||||
// delete(otherMap, "reject_reason")
|
||||
@@ -131,6 +133,19 @@ func formatUserLogs(logs []*Log, startIdx int) {
|
||||
assignDisplayLogIds(logs, startIdx)
|
||||
}
|
||||
|
||||
// FormatAdminLogs removes root-only diagnostics while retaining operational
|
||||
// admin_info. Root callers must not pass their results through this formatter.
|
||||
func FormatAdminLogs(logs []*Log) {
|
||||
for i := range logs {
|
||||
otherMap, _ := common.StrToMap(logs[i].Other)
|
||||
if otherMap == nil {
|
||||
continue
|
||||
}
|
||||
delete(otherMap, "root_info")
|
||||
logs[i].Other = common.MapToJsonStr(otherMap)
|
||||
}
|
||||
}
|
||||
|
||||
func GetLogByTokenId(tokenId int) (logs []*Log, err error) {
|
||||
order := "id desc"
|
||||
if common.UsingLogDatabase(common.DatabaseTypeClickHouse) {
|
||||
|
||||
Reference in New Issue
Block a user