diff --git a/frontend/src/api/agent/index.ts b/frontend/src/api/agent/index.ts index 457e1316f..35b8ea595 100644 --- a/frontend/src/api/agent/index.ts +++ b/frontend/src/api/agent/index.ts @@ -1,3 +1,4 @@ +import type { ConfigSchema } from '@/components/schema-form/schema' import { get, post, put, del } from "../../utils/request"; // 智能体配置 @@ -347,6 +348,35 @@ export interface IMChannelOverview { updated_at: string; } +// IMPlatformInfo describes one IM platform (internal/im.PlatformInfo): its +// connection modes, console links and the credential form. +export interface IMPlatformInfo { + id: string + name: string + names?: Record + order: number + /** Supported connection modes, default first. */ + modes: Array + mode_labels?: Record + mode_hint_key?: string + supports_thread: boolean + links?: Array<{ url: string; title: string; title_key?: string }> + config_schema?: ConfigSchema +} + +/** + * One channel for the editor, credentials included: plain fields as stored, + * set secrets as "***". Send them back unchanged to keep the stored secret. + */ +export function getIMChannel(id: string) { + return get<{ data: IMChannel }>(`/api/v1/im-channels/${id}`); +} + +/** The IM platforms this deployment has adapters for, in display order. */ +export function listIMPlatforms() { + return get<{ data: IMPlatformInfo[] }>('/api/v1/im-channels/platforms'); +} + export function listAllIMChannels() { return get<{ data: IMChannelOverview[] }>('/api/v1/im-channels'); } diff --git a/frontend/src/components/IMChannelPanel.vue b/frontend/src/components/IMChannelPanel.vue index 7fbc468a0..c564c2878 100644 --- a/frontend/src/components/IMChannelPanel.vue +++ b/frontend/src/components/IMChannelPanel.vue @@ -119,7 +119,7 @@
- + {{ item.label }}
@@ -146,28 +146,19 @@
-
+

{{ $t('agentEditor.im.sectionAccess') }}

- -
-

- {{ formData.platform === 'mattermost' ? $t('agentEditor.im.mattermostModeHint') : - formData.platform === 'yunzhijia' ? $t('agentEditor.im.yunzhijiaModeHint') : - $t('agentEditor.im.modeHint') }} -

+

{{ modeHint }}

@@ -249,292 +240,19 @@

{{ $t('agentEditor.im.sectionCredentials') }}

- - + - - - - - - - - - - - - - - - - - - - - + +