fix: address code review feedback - improve notifyType logic and typing

Agent-Logs-Url: https://github.com/whyour/qinglong/sessions/4c9f0ab1-8b0e-4b94-b295-39c90ed942c2

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-04-25 06:50:47 +00:00 committed by GitHub
parent 79964f149c
commit 0d33d2321a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 15 deletions

View File

@ -393,12 +393,13 @@ export default class SystemService {
}
let notifyType: string | undefined;
if (notificationInfo?.type) {
notifyType = typeString || (notificationInfo.type as string);
} else {
try {
const notifConfig = await this.getDb({ type: AuthDataType.notification });
notifyType = notifConfig.info?.type as string | undefined;
} catch (e) {}
if (notificationInfo?.type) {
notifyType = typeString || (notificationInfo.type as string);
}
const isSuccess = await this.notificationService.notify(

View File

@ -3,15 +3,24 @@ import React from 'react';
import { Table, Tag } from 'antd';
import dayjs from 'dayjs';
enum NotifyStatus {
'成功',
'失败',
interface NotifyLogItem {
id?: number;
timestamp?: number;
title?: string;
content?: string;
status?: number;
notifyType?: string;
}
enum NotifyStatusColor {
'success',
'error',
}
const NotifyStatusLabel: Record<number, string> = {
0: '成功',
1: '失败',
};
const NotifyStatusColor: Record<number, string> = {
0: 'success',
1: 'error',
};
const columns = [
{
@ -56,13 +65,14 @@ const columns = [
dataIndex: 'status',
key: 'status',
width: 90,
render: (text: string, record: any) => {
render: (text: string, record: NotifyLogItem) => {
const statusKey = record.status ?? 1;
return (
<Tag
color={NotifyStatusColor[record.status]}
color={NotifyStatusColor[statusKey]}
style={{ marginRight: 0 }}
>
{intl.get(NotifyStatus[record.status])}
{intl.get(NotifyStatusLabel[statusKey])}
</Tag>
);
},
@ -73,7 +83,7 @@ const NotifyLog = ({
data,
height,
}: {
data: Array<object>;
data: Array<NotifyLogItem>;
height: number;
}) => {
return (