Problem:
Upstream channels can reject monitor probes based on client fingerprint
(e.g. "only Claude Code clients allowed"). The monitor had no way to
customize the outgoing request to bypass such restrictions.
Solution:
Introduce reusable request templates that carry extra_headers plus an
optional body override; monitors reference a template and receive a
snapshot copy on apply. Template edits do NOT auto-propagate — users
must click "apply to associated monitors" to refresh snapshots, so a
bad template edit cannot instantly break all production monitors.
Data model (migration 112):
- channel_monitor_request_templates: id, name, provider, description,
extra_headers jsonb, body_override_mode ('off'|'merge'|'replace'),
body_override jsonb. Unique (provider, name).
- channel_monitors: +template_id (FK, ON DELETE SET NULL), +extra_headers,
+body_override_mode, +body_override (the three runtime snapshot fields).
Checker (channel_monitor_checker.go):
- callProvider + runCheckForModel accept a CheckOptions carrying the
snapshot fields. mergeHeaders applies user headers on top of adapter
defaults (forbidden list: Host / Content-Length / Transfer-Encoding /
Connection / Content-Encoding).
- buildRequestBody:
off -> adapter default body
merge -> shallow-merge over default; per-provider deny list
(model/messages/contents) protects the challenge contract
replace -> user body verbatim
- Replace mode skips challenge validation; instead HTTP 2xx + non-empty
extracted response text = operational, empty = failed.
- 4 new unit tests cover all three modes + replace/empty-response case.
Admin API:
- /admin/channel-monitor-templates CRUD + /:id/apply (overwrite snapshot
on all template_id=id monitors, returns affected count).
- channel_monitor request/response DTOs gain the 4 new fields.
Frontend:
- channelMonitorTemplate.ts API client.
- MonitorAdvancedRequestConfig.vue shared component for headers textarea
+ body mode radio + body JSON editor; used by both template and monitor
forms.
- MonitorTemplateManagerDialog.vue: provider tabs, list/create/edit/
delete/apply, live "associated monitors" count per row.
- MonitorFiltersBar: new 模板管理 button next to 新增监控.
- MonitorFormDialog: collapsible 高级 section with template dropdown
(filtered by form.provider, clears on provider change) + embedded
AdvancedRequestConfig. Picking a template copies its fields into the
form (snapshot semantics mirrored on the client).
- i18n zh/en entries for all new copy.
chore: bump version to 0.1.114.32
110 lines
4.0 KiB
Go
110 lines
4.0 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package predicate
|
|
|
|
import (
|
|
"entgo.io/ent/dialect/sql"
|
|
)
|
|
|
|
// APIKey is the predicate function for apikey builders.
|
|
type APIKey func(*sql.Selector)
|
|
|
|
// Account is the predicate function for account builders.
|
|
type Account func(*sql.Selector)
|
|
|
|
// AccountGroup is the predicate function for accountgroup builders.
|
|
type AccountGroup func(*sql.Selector)
|
|
|
|
// Announcement is the predicate function for announcement builders.
|
|
type Announcement func(*sql.Selector)
|
|
|
|
// AnnouncementRead is the predicate function for announcementread builders.
|
|
type AnnouncementRead func(*sql.Selector)
|
|
|
|
// AuthIdentity is the predicate function for authidentity builders.
|
|
type AuthIdentity func(*sql.Selector)
|
|
|
|
// AuthIdentityChannel is the predicate function for authidentitychannel builders.
|
|
type AuthIdentityChannel func(*sql.Selector)
|
|
|
|
// ChannelMonitor is the predicate function for channelmonitor builders.
|
|
type ChannelMonitor func(*sql.Selector)
|
|
|
|
// ChannelMonitorDailyRollup is the predicate function for channelmonitordailyrollup builders.
|
|
type ChannelMonitorDailyRollup func(*sql.Selector)
|
|
|
|
// ChannelMonitorHistory is the predicate function for channelmonitorhistory builders.
|
|
type ChannelMonitorHistory func(*sql.Selector)
|
|
|
|
// ChannelMonitorRequestTemplate is the predicate function for channelmonitorrequesttemplate builders.
|
|
type ChannelMonitorRequestTemplate func(*sql.Selector)
|
|
|
|
// ErrorPassthroughRule is the predicate function for errorpassthroughrule builders.
|
|
type ErrorPassthroughRule func(*sql.Selector)
|
|
|
|
// Group is the predicate function for group builders.
|
|
type Group func(*sql.Selector)
|
|
|
|
// IdempotencyRecord is the predicate function for idempotencyrecord builders.
|
|
type IdempotencyRecord func(*sql.Selector)
|
|
|
|
// IdentityAdoptionDecision is the predicate function for identityadoptiondecision builders.
|
|
type IdentityAdoptionDecision func(*sql.Selector)
|
|
|
|
// PaymentAuditLog is the predicate function for paymentauditlog builders.
|
|
type PaymentAuditLog func(*sql.Selector)
|
|
|
|
// PaymentOrder is the predicate function for paymentorder builders.
|
|
type PaymentOrder func(*sql.Selector)
|
|
|
|
// PaymentProviderInstance is the predicate function for paymentproviderinstance builders.
|
|
type PaymentProviderInstance func(*sql.Selector)
|
|
|
|
// PendingAuthSession is the predicate function for pendingauthsession builders.
|
|
type PendingAuthSession func(*sql.Selector)
|
|
|
|
// PromoCode is the predicate function for promocode builders.
|
|
type PromoCode func(*sql.Selector)
|
|
|
|
// PromoCodeUsage is the predicate function for promocodeusage builders.
|
|
type PromoCodeUsage func(*sql.Selector)
|
|
|
|
// Proxy is the predicate function for proxy builders.
|
|
type Proxy func(*sql.Selector)
|
|
|
|
// RedeemCode is the predicate function for redeemcode builders.
|
|
type RedeemCode func(*sql.Selector)
|
|
|
|
// SecuritySecret is the predicate function for securitysecret builders.
|
|
type SecuritySecret func(*sql.Selector)
|
|
|
|
// Setting is the predicate function for setting builders.
|
|
type Setting func(*sql.Selector)
|
|
|
|
// SubscriptionPlan is the predicate function for subscriptionplan builders.
|
|
type SubscriptionPlan func(*sql.Selector)
|
|
|
|
// TLSFingerprintProfile is the predicate function for tlsfingerprintprofile builders.
|
|
type TLSFingerprintProfile func(*sql.Selector)
|
|
|
|
// UsageCleanupTask is the predicate function for usagecleanuptask builders.
|
|
type UsageCleanupTask func(*sql.Selector)
|
|
|
|
// UsageLog is the predicate function for usagelog builders.
|
|
type UsageLog func(*sql.Selector)
|
|
|
|
// User is the predicate function for user builders.
|
|
type User func(*sql.Selector)
|
|
|
|
// UserAllowedGroup is the predicate function for userallowedgroup builders.
|
|
type UserAllowedGroup func(*sql.Selector)
|
|
|
|
// UserAttributeDefinition is the predicate function for userattributedefinition builders.
|
|
type UserAttributeDefinition func(*sql.Selector)
|
|
|
|
// UserAttributeValue is the predicate function for userattributevalue builders.
|
|
type UserAttributeValue func(*sql.Selector)
|
|
|
|
// UserSubscription is the predicate function for usersubscription builders.
|
|
type UserSubscription func(*sql.Selector)
|