mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
refactor: update log
This commit is contained in:
@@ -253,6 +253,7 @@ async def delete(session: SessionDep, id: int = Path(description=f"{PLACEHOLDER_
|
||||
|
||||
@router.delete("", summary=f"{PLACEHOLDER_PREFIX}user_batchdel_api", description=f"{PLACEHOLDER_PREFIX}user_batchdel_api")
|
||||
@require_permissions(permission=SqlbotPermission(role=['admin']))
|
||||
@system_log(LogConfig(operation_type=OperationType.DELETE,module=OperationModules.USER,resource_id_expr="id_list"))
|
||||
async def batch_del(session: SessionDep, id_list: list[int]):
|
||||
for id in id_list:
|
||||
await single_delete(session, id)
|
||||
|
||||
@@ -22,6 +22,9 @@ class OperationModules(str, Enum):
|
||||
PARAMS_SETTING = "params_setting" # 参数配置
|
||||
API_KEY = "api_key" # api key
|
||||
LOG_SETTING = "log_setting" # api key
|
||||
SETTING = "setting" # 设置
|
||||
SYSTEM_MANAGEMENT = "system_management" # 系统管理
|
||||
OPT_LOG = "opt_log" # 操作日志
|
||||
|
||||
class OperationStatus(str, Enum):
|
||||
SUCCESS = "success"
|
||||
@@ -38,6 +41,8 @@ class OperationType(str, Enum):
|
||||
IMPORT = "import"
|
||||
ADD = "add"
|
||||
CREATE_OR_UPDATE = "create_or_update"
|
||||
ANALYSIS = "analysis"
|
||||
PREDICTION = "prediction"
|
||||
|
||||
|
||||
class SystemLog(SQLModel, table=True):
|
||||
|
||||
@@ -432,6 +432,9 @@ class SystemLogger:
|
||||
|
||||
with Session(engine) as session:
|
||||
session.add(log)
|
||||
session.query(SystemLog).filter(SystemLog.resource_id == str(resource_id)).update({
|
||||
SystemLog.resource_name: str(resource_name)
|
||||
}, synchronize_session='fetch')
|
||||
session.commit()
|
||||
session.refresh(log)
|
||||
return log
|
||||
|
||||
@@ -171,9 +171,12 @@
|
||||
"add": "Add",
|
||||
"create_or_update": "Change",
|
||||
"api_key": "API Key",
|
||||
"params_setting": "Parameters Setting",
|
||||
"params_setting": "Parameter Configuration",
|
||||
"rules": "Permission Rules",
|
||||
"log_setting": "Login Authentication"
|
||||
"log_setting": "Login Authentication",
|
||||
"setting": "Settings",
|
||||
"system_management": "System Management",
|
||||
"opt_log": "Operation Log"
|
||||
},
|
||||
"i18n_table_not_exist": "Table not exist"
|
||||
}
|
||||
@@ -173,7 +173,10 @@
|
||||
"api_key": "API 키",
|
||||
"params_setting": "매개변수 설정",
|
||||
"rules": "권한 규칙",
|
||||
"log_setting": "로그인 인증"
|
||||
"log_setting": "로그인 인증",
|
||||
"setting": "설정",
|
||||
"system_management": "시스템 관리",
|
||||
"opt_log": "작업 로그"
|
||||
},
|
||||
"i18n_table_not_exist": "현재 테이블이 존재하지 않습니다"
|
||||
}
|
||||
@@ -171,9 +171,13 @@
|
||||
"add": "添加",
|
||||
"create_or_update": "变更",
|
||||
"api_key": "API Key",
|
||||
"params_setting": "参数设置",
|
||||
"params_setting": "参数配置",
|
||||
"rules": "权限规则",
|
||||
"log_setting": "登录认证"
|
||||
"log_setting": "登录认证",
|
||||
"setting": "设置",
|
||||
"system_management": "系统管理",
|
||||
"opt_log": "操作日志"
|
||||
|
||||
},
|
||||
"i18n_table_not_exist": "当前表不存在"
|
||||
}
|
||||
@@ -189,7 +189,9 @@ export class ChatInfo extends Chat {
|
||||
ds_type: string,
|
||||
datasource_name: string,
|
||||
datasource_exists: boolean,
|
||||
records: Array<ChatRecord>
|
||||
records: Array<ChatRecord>,
|
||||
recommended_question?: string | undefined,
|
||||
recommended_generate?: boolean | undefined
|
||||
)
|
||||
constructor(
|
||||
param1?: number | Chat,
|
||||
|
||||
@@ -26,7 +26,7 @@ const emits = defineEmits(['clickQuestion', 'stop', 'loadingOver'])
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
const questions = ref('[]')
|
||||
const questions = ref<string | undefined>('[]')
|
||||
|
||||
const computedQuestions = computed<string>(() => {
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user