Skip to content

Commit f494e42

Browse files
author
linyuan.yang
committed
channel label
1 parent f81308f commit f494e42

7 files changed

Lines changed: 13 additions & 7 deletions

File tree

packages/admin/src/views/ChannelsView.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ const { isMobile } = useResponsive()
1515
1616
interface PluginInfo {
1717
type: string
18-
configSchema?: Record<string, { label: string; type: string; required?: boolean; description?: string; default?: string | boolean | number; options?: Array<{ label: string; value: string }> }>
18+
label: string
19+
configSchema: Record<string, { label: string; type: string; required?: boolean; description?: string; default?: string | boolean | number; options?: Array<{ label: string; value: string }> }>
1920
}
2021
2122
interface ChannelSessionRow {
@@ -412,7 +413,7 @@ async function refresh() {
412413
</td>
413414
<td>{{ c.name }}</td>
414415
<td style="font-family:monospace;font-size:11px;color:#9b9b9b">{{ id }}</td>
415-
<td>{{ c.type }}</td>
416+
<td>{{ plugins.find(p => p.type === c.type)?.label || c.type }}</td>
416417
<td>{{ agentOptions.find(a => a.id === c.agent)?.label || c.agent || '-' }}</td>
417418
<td>{{ c.saver ? (saverOptions.find(s => s.id === c.saver)?.label || c.saver) : '-' }}</td>
418419
<td>{{ Array.isArray(c.memories) && c.memories.length ? c.memories.map(id => memoryOptions.find(m => m.id === id)?.label || id).join(', ') : '-' }}</td>
@@ -534,7 +535,7 @@ async function refresh() {
534535
</div>
535536
<div class="mobile-card-fields">
536537
<span class="mobile-card-label">{{ t('common.type') }}</span>
537-
<span class="mobile-card-value">{{ c.type }}</span>
538+
<span class="mobile-card-value">{{ plugins.find(p => p.type === c.type)?.label || c.type }}</span>
538539
<span class="mobile-card-label">{{ t('common.agent') }}</span>
539540
<span class="mobile-card-value">{{ agentOptions.find(a => a.id === c.agent)?.label || c.agent || '-' }}</span>
540541
<span class="mobile-card-label">{{ t('common.storage') }}</span>
@@ -613,7 +614,7 @@ async function refresh() {
613614
<div class="form-group">
614615
<label>{{ t('channels.channel_type') }} *</label>
615616
<select v-model="form.type" @change="form.config = {}" :disabled="!!editingId">
616-
<option v-for="p in plugins" :key="p.type" :value="p.type">{{ p.type }}</option>
617+
<option v-for="p in plugins" :key="p.type" :value="p.type">{{ p.label }}</option>
617618
</select>
618619
</div>
619620
<template v-for="(field, key) in currentSchema" :key="key">

packages/channel.base/src/ChannelPlugin.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ export interface ConfigField {
7272

7373
export interface ChannelPlugin {
7474
type: string;
75-
configSchema?: Record<string, ConfigField>;
75+
label: string;
76+
configSchema: Record<string, ConfigField>;
7677
/** Get a QR code for the given config key. Returns url and display type. */
7778
getQRCode?(key: string, params?: any): Promise<{ url: string; type: 'image' | 'link' }>;
7879
/** Long-poll until QR scan completes for the given config key. Returns credentials object, or null if expired. */

packages/channel.lark/src/plugin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ function buildLarkExtraInfo(userInfo: LarkUserInfo | undefined, chatId?: string,
1717
}
1818
export const larkPlugin: ChannelPlugin = {
1919
type: "lark",
20+
label: "飞书",
2021

2122
configSchema: {
2223
appId: { label: 'App ID', type: ConfigFieldType.String, required: true, description: 'Lark app ID' },

packages/channel.slack/src/plugin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ function buildSlackExtraInfo(userInfo: any): string {
1515
}
1616
export const slackPlugin: ChannelPlugin = {
1717
type: "slack",
18+
label: "Slack",
1819

1920
configSchema: {
2021
botToken: { label: 'Bot Token', type: ConfigFieldType.Password, required: true, description: 'Slack bot token (xoxb-...)' },

packages/channel.wechat/src/plugin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function toQRCodeResult(raw: string): { url: string; type: 'image' | 'link' } {
2929

3030
export const wechatPlugin: ChannelPlugin = {
3131
type: "wechat",
32+
label: "微信",
3233

3334
configSchema: {
3435
qrLogin: { label: "扫码登录", type: ConfigFieldType.QRCode, description: "扫码登录后自动填入凭证" },

packages/channel.wecom/src/plugin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function buildWecomExtraInfo(userId: string): string {
1313
}
1414
export const wecomPlugin: ChannelPlugin = {
1515
type: "wecom",
16+
label: "企业微信",
1617

1718
configSchema: {
1819
botId: { label: 'Bot ID', type: ConfigFieldType.String, required: true, description: 'WeCom bot ID' },

packages/sbot/src/Channel/ChannelManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ export class ChannelManager {
177177
return this.plugins.get(type);
178178
}
179179

180-
getPluginList(): Array<{ type: string; configSchema?: Record<string, any> }> {
181-
return [...this.plugins.values()].map(p => ({ type: p.type, configSchema: p.configSchema }));
180+
getPluginList(): Array<{ type: string; label: string; configSchema: Record<string, any> }> {
181+
return [...this.plugins.values()].map(p => ({ type: p.type, label: p.label, configSchema: p.configSchema }));
182182
}
183183

184184
async dispose(): Promise<void> {

0 commit comments

Comments
 (0)