精简事件管理里的事件

This commit is contained in:
xintaofei
2026-03-31 12:05:51 +08:00
parent edc12a0e39
commit 007b52c183
13 changed files with 11 additions and 215 deletions

View File

@@ -9,24 +9,12 @@ import { Switch } from "@/components/ui/switch"
import { getChatEventFilter, setChatEventFilter } from "@/lib/api"
const ALL_EVENT_TYPES = [
{
id: "session_started",
labelKey: "sessionStarted",
descKey: "sessionStartedDesc",
},
{
id: "turn_complete",
labelKey: "turnComplete",
descKey: "turnCompleteDesc",
},
{ id: "error", labelKey: "error", descKey: "errorDesc" },
{
id: "status_disconnected",
labelKey: "statusDisconnected",
descKey: "statusDisconnectedDesc",
},
{ id: "git_push", labelKey: "gitPush", descKey: "gitPushDesc" },
{ id: "git_commit", labelKey: "gitCommit", descKey: "gitCommitDesc" },
] as const
const ALL_IDS = ALL_EVENT_TYPES.map((e) => e.id)
@@ -51,8 +39,6 @@ export function ChannelEventsTab() {
.finally(() => setLoading(false))
}, [])
const allEnabled = enabledEvents.size === ALL_EVENT_TYPES.length
const handleToggle = useCallback(
async (eventId: string, checked: boolean) => {
setSaving(true)
@@ -86,9 +72,7 @@ export function ChannelEventsTab() {
return (
<div className="space-y-4">
{allEnabled && (
<p className="text-xs text-muted-foreground">{t("allEnabled")}</p>
)}
<p className="text-xs text-muted-foreground">{t("description")}</p>
<section className="space-y-1">
{ALL_EVENT_TYPES.map((evt) => (