feat(web): 渠道配置表单排版+引导——核心必填(token)+高级折叠+业务策略独立区
agent-118 排版引导: - 核心必填区: 高亮 Callout(各平台'只需填X'头条)+Token必填badge(红底)+自动获取旁注, 不再藏段落 - 高级选项折叠(Miuix arrow折叠): base_url/平台特定字段/额外 config(连接配置), 收起默认 - 各平台引导头条: kook'只需填bot_token其余自动获取'/telegram/qq(mode接入方式)/weixin/webhook 我补(主人原则: 连接配置 vs 业务策略分开): - 黑白名单(allow/deny groups/users)+限流(groupMsgPerMin/msgPerMin/maxMessages) 从'高级选项'抽离成独立'业务策略'折叠区(不参与端到端连接) - openConfig 重置 polOpen; 业务策略默认收起 - 拆 channelFields.ts(PlatformField/PLATFORM_FIELDS/PLATFORM_GUIDE) → Channels.tsx 454行<500红线合规 前端 build 绿; 敏感字段password掩码/不回显
This commit is contained in:
1 parent
65091f6497
commit
5398486fdf
2 files changed
+186
-126
No files matched your search
@@ -0,0 +1,70 @@
|
||||
/** Channel config field metadata + per-platform guidance (design/16 §4.4-4.6).
|
||||
* Separated from Channels.tsx so the module stays under the 500-line bound and a
|
||||
* platform only needs a new entry here. */
|
||||
|
||||
/** One curated config input; `key` is the adapter Config json tag the backend decodes. */
|
||||
export interface PlatformField {
|
||||
key: string;
|
||||
label: string;
|
||||
placeholder?: string;
|
||||
/** Masked [type=password] input (token / verify / encrypt / secret). */
|
||||
secret?: boolean;
|
||||
}
|
||||
|
||||
/** Platform-specific config fields only (the COMMON fields are rendered separately).
|
||||
* Keys are the adapter Config json tags verbatim. */
|
||||
export const PLATFORM_FIELDS: Record<string, PlatformField[]> = {
|
||||
kook: [], // KOOK is "token 即用、其余自动获取"—advanced values go in the extra JSON.
|
||||
"qq-obv11": [
|
||||
{ key: "mode", label: "mode(client/server)", placeholder: "server" },
|
||||
{ key: "listen_addr", label: "listen_addr(server 监听)", placeholder: "0.0.0.0:6700" },
|
||||
{ key: "remote_url", label: "remote_url(client 连接)", placeholder: "ws://…" },
|
||||
{ key: "access_token", label: "access_token(OneBot 访问 token)", secret: true },
|
||||
{ key: "self_id", label: "self_id(机器人 QQ 号)", placeholder: "123456789" },
|
||||
],
|
||||
telegram: [{ key: "webhook_url", label: "webhook_url(公网回调地址)", placeholder: "https://…" }],
|
||||
"weixin-ilink": [
|
||||
{ key: "cdn_base_url", label: "cdn_base_url(媒体 CDN)", placeholder: "https://…" },
|
||||
{ key: "bot_id", label: "bot_id(ilink_bot_id)", placeholder: "wx…" },
|
||||
{ key: "owner_id", label: "owner_id(绑定主人 uid)", placeholder: "wx…" },
|
||||
{ key: "cursor", label: "cursor(get_updates_buf)", placeholder: "…" },
|
||||
],
|
||||
webhook: [
|
||||
{ key: "endpointPath", label: "endpointPath(挂载路由)", placeholder: "/webhook" },
|
||||
{ key: "channelId", label: "channelId(渠道 id)", placeholder: "…" },
|
||||
{ key: "channelName", label: "channelName(渠道名)", placeholder: "…" },
|
||||
{ key: "secret", label: "secret(HMAC 签名密钥)", secret: true },
|
||||
{ key: "signatureHeader", label: "signatureHeader(签名头)", placeholder: "X-Webhook-Signature" },
|
||||
],
|
||||
};
|
||||
|
||||
/** Core-required guidance per platform: headline `guide` + auto-fetch `hint`. */
|
||||
export interface PlatformGuide {
|
||||
guide: string;
|
||||
hint?: string;
|
||||
tokenRequired?: boolean;
|
||||
}
|
||||
|
||||
export const PLATFORM_GUIDE: Record<string, PlatformGuide> = {
|
||||
kook: {
|
||||
guide: "只需填 bot_token(必填),其余自动获取",
|
||||
hint: "base_url 留空即用官方地址;receive_mode 默认 ws、webhook_path 默认 /webhook/kook,均无需填写;连接后渠道列表自动显示该 bot 身份。如需 webhook(receive_mode=webhook)或 webhook_verify_token / webhook_encrypt_key,在「高级选项 → 额外 config」里以 JSON 设置。",
|
||||
},
|
||||
"qq-obv11": {
|
||||
guide: "填 token(必填)并选择接入方式(mode:client / server)",
|
||||
hint: "mode=server 填 listen_addr(本地监听端口);mode=client 填 remote_url(连接上游)。mode / listen_addr / remote_url / access_token 在「高级选项」里配置。",
|
||||
},
|
||||
telegram: {
|
||||
guide: "只需填 bot_token(必填),其余自动获取",
|
||||
hint: "webhook_url(公网回调,可选)在「高级选项」里配置;留空则走长轮询。",
|
||||
},
|
||||
"weixin-ilink": {
|
||||
guide: "填 bot_token(必填)与 bot_id / owner_id",
|
||||
hint: "bot_id / owner_id / cdn_base_url / cursor 在「高级选项」里配置;媒体 CDN 可留空自动。",
|
||||
},
|
||||
webhook: {
|
||||
guide: "填 endpointPath 与 secret(必填)",
|
||||
hint: "endpointPath / secret / channelId / signatureHeader 在「高级选项」里配置,用于接收平台回调。",
|
||||
tokenRequired: false,
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user