Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

feat(frontend): enhance IMChannelsOverviewPanel layout and functionality

wizardchenc07ab6988cf0
diff --git a/frontend/src/components/IMChannelsOverviewPanel.vue b/frontend/src/components/IMChannelsOverviewPanel.vue
index 30fcd10a8..57d38a836 100644
--- a/frontend/src/components/IMChannelsOverviewPanel.vue
+++ b/frontend/src/components/IMChannelsOverviewPanel.vue
@@ -3,7 +3,9 @@
<div class="submenu-header">
<div class="titles">
<h4 class="title">{{ $t('imOverview.pageTitle') }}</h4>
- <p class="subtitle">{{ $t('imOverview.subtitle') }}</p>
+ <p class="subtitle" :title="$t('imOverview.subtitle')">
+ {{ $t('imOverview.subtitle') }}
+ </p>
</div>
<t-button
variant="text"
@@ -38,11 +40,22 @@
@keydown.enter="gotoAgentEditor(ch)"
@keydown.space.prevent="gotoAgentEditor(ch)"
>
- <!-- Stacked rows: agent on top, IM channel below. Same avatar size
- and typography → both read as co-equal identities of the row. -->
- <div class="stack">
- <div class="stack-row">
- <span class="row-avatar">
+ <div class="item-main">
+ <div class="channel-primary">
+ <span class="platform-avatar">
+ <img
+ v-if="hasPlatformLogo(ch.platform)"
+ :src="platformLogo(ch.platform)"
+ :alt="platformLabel(ch.platform)"
+ />
+ <t-icon v-else name="link" size="14px" />
+ </span>
+ <span class="channel-name" :title="channelDisplayName(ch)">
+ {{ channelDisplayName(ch) }}
+ </span>
+ </div>
+ <div class="channel-secondary">
+ <span class="agent-avatar-sm">
<span
v-if="agentMeta(ch.agent_id)?.is_builtin"
class="builtin-avatar"
@@ -50,7 +63,7 @@
>
<t-icon
:name="agentMeta(ch.agent_id)?.config?.agent_mode === 'smart-reasoning' ? 'control-platform' : 'chat'"
- size="12px"
+ size="10px"
/>
</span>
<span
@@ -59,22 +72,12 @@
>{{ agentMeta(ch.agent_id)!.avatar }}</span>
<AgentAvatar
v-else
- :name="ch.agent_name || ch.agent_id"
+ :name="agentDisplayName(ch)"
size="small"
/>
</span>
- <span class="row-label" :title="ch.agent_name || agentMeta(ch.agent_id)?.name || ''">
- {{ ch.agent_name || agentMeta(ch.agent_id)?.name || $t('imOverview.builtinAgent') }}
- </span>
- </div>
- <div class="stack-row">
- <img
- class="row-avatar platform-logo"
- :src="platformLogo(ch.platform)"
- :alt="platformLabel(ch.platform)"
- />
- <span class="row-label" :title="ch.name || platformLabel(ch.platform)">
- {{ ch.name || platformLabel(ch.platform) }}
+ <span class="agent-name" :title="agentDisplayName(ch)">
+ {{ agentDisplayName(ch) }}
</span>
</div>
</div>
@@ -109,8 +112,6 @@ import {
} from '@/api/agent';
import AgentAvatar from '@/components/AgentAvatar.vue';
-// Platform logos sourced from iconify (simple-icons / logos / tdesign / remix icon).
-// Bundled as static assets so they share the app's caching story.
import wecomLogo from '@/assets/img/im/wecom.svg';
import feishuLogo from '@/assets/img/im/feishu.svg';
import slackLogo from '@/assets/img/im/slack.svg';
@@ -147,8 +148,6 @@ const agentMap = ref<Map<string, CustomAgent>>(new Map());
const loading = ref(false);
const togglingId = ref<string>('');
-// Parent tells us when the submenu is active (hover/click-open). Reload only
-// when transitioning into active so we don't refetch on every re-render.
watch(
() => props.active,
(v, old) => {
@@ -157,6 +156,10 @@ watch(
{ immediate: true },
);
+function hasPlatformLogo(p: string): boolean {
+ return Boolean(PLATFORM_LOGO[p]);
+}
+
function platformLogo(p: string): string {
return PLATFORM_LOGO[p] || '';
}
@@ -165,10 +168,18 @@ function platformLabel(p: string): string {
return t(`agentEditor.im.${p}`);
}
+function channelDisplayName(ch: IMChannelOverview): string {
+ return ch.name || platformLabel(ch.platform);
+}
+
function agentMeta(agentId: string): CustomAgent | undefined {
return agentMap.value.get(agentId);
}
+function agentDisplayName(ch: IMChannelOverview): string {
+ return ch.agent_name || agentMeta(ch.agent_id)?.name || t('imOverview.builtinAgent');
+}
+
async function loadAll() {
loading.value = true;
try {
@@ -190,18 +201,21 @@ async function loadAll() {
}
async function handleToggle(ch: IMChannelOverview) {
- if (togglingId.value) return;
+ if (togglingId.value === ch.id) return;
togglingId.value = ch.id;
+ const prev = ch.enabled;
+ ch.enabled = !prev;
try {
await toggleIMChannel(ch.id);
const resp = await listAllIMChannels();
channels.value = resp?.data || [];
emit('channels-changed', channels.value);
} catch (err: any) {
+ ch.enabled = prev;
console.error('Failed to toggle IM channel:', err);
MessagePlugin.error(err?.message || t('common.operationFailed'));
} finally {
- togglingId.value = '';
+ if (togglingId.value === ch.id) togglingId.value = '';
}
}
@@ -221,9 +235,9 @@ function gotoAgentEditor(ch: IMChannelOverview) {
width: 300px;
max-height: 520px;
background: var(--td-bg-color-container);
- border-radius: 8px;
- box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14);
- border: 1px solid var(--td-component-stroke);
+ border-radius: 10px;
+ box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
+ border: 0.5px solid var(--td-component-stroke);
overflow: hidden;
}
@@ -232,36 +246,38 @@ function gotoAgentEditor(ch: IMChannelOverview) {
align-items: flex-start;
justify-content: space-between;
gap: 8px;
- padding: 12px 14px;
- border-bottom: 1px solid var(--td-component-stroke);
+ padding: 10px 12px 8px;
+ border-bottom: 0.5px solid var(--td-component-stroke);
.titles {
min-width: 0;
}
.title {
- margin: 0 0 2px;
- font-size: 13px;
+ margin: 0 0 4px;
+ font-size: 12px;
font-weight: 600;
- color: var(--td-text-color-primary);
+ color: var(--td-text-color-secondary);
line-height: 1.3;
}
.subtitle {
margin: 0;
font-size: 11px;
- color: var(--td-text-color-secondary);
- line-height: 1.4;
+ color: var(--td-text-color-placeholder);
+ line-height: 1.45;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 2;
+ line-clamp: 2;
+ overflow: hidden;
}
}
.submenu-body {
flex: 1;
overflow-y: auto;
- padding: 6px;
- display: flex;
- flex-direction: column;
- gap: 4px;
+ padding: 4px;
}
.state-placeholder {
@@ -281,116 +297,146 @@ function gotoAgentEditor(ch: IMChannelOverview) {
.channels-list {
display: flex;
flex-direction: column;
- gap: 2px;
}
.channel-item {
display: flex;
- align-items: center;
+ align-items: flex-start;
gap: 8px;
- padding: 8px 10px;
- background: transparent;
+ padding: 8px;
border-radius: 6px;
cursor: pointer;
outline: none;
transition: background 0.15s;
+ & + & {
+ border-top: 0.5px solid var(--td-component-stroke);
+ }
+
&:hover,
&:focus-visible {
- background: var(--td-bg-color-container-hover);
+ background: var(--td-bg-color-secondarycontainer);
}
- &.is-disabled {
- opacity: 0.55;
+ &.is-disabled .item-main {
+ opacity: 0.6;
}
}
-// Stacked rows: agent on top, channel below. Both lines share identical
-// typography and avatar size so neither dominates — they read as two facets
-// of the same row rather than a headline + caption.
-.stack {
+.item-main {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
- gap: 3px;
+ gap: 4px;
}
-.stack-row {
+.channel-primary {
display: flex;
align-items: center;
gap: 8px;
min-width: 0;
}
-.row-avatar {
+.platform-avatar {
display: inline-flex;
align-items: center;
justify-content: center;
- width: 20px;
- height: 20px;
- border-radius: 4px;
+ width: 24px;
+ height: 24px;
+ border-radius: 6px;
flex-shrink: 0;
+ background: var(--td-bg-color-secondarycontainer);
- &.platform-logo {
+ img {
+ width: 18px;
+ height: 18px;
object-fit: contain;
- background: transparent;
- padding: 1px;
+ }
+
+ .t-icon {
+ color: var(--td-text-color-placeholder);
}
}
-.row-label {
- font-size: 12px;
+.channel-name {
+ font-size: 13px;
+ font-weight: 500;
color: var(--td-text-color-primary);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
min-width: 0;
- line-height: 1.3;
+ line-height: 1.35;
+}
+
+.channel-secondary {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ min-width: 0;
+ padding-left: 32px;
+}
+
+.agent-avatar-sm {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 16px;
+ height: 16px;
+ flex-shrink: 0;
+
+ :deep(.agent-avatar),
+ :deep(.agent-avatar-small) {
+ width: 16px;
+ height: 16px;
+ }
+
+ :deep(.agent-avatar-letter) {
+ font-size: 9px !important;
+ }
+}
+
+.agent-name {
+ font-size: 11px;
+ color: var(--td-text-color-placeholder);
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ min-width: 0;
+ line-height: 1.35;
}
-// Switch stays right-anchored, separated from the stack by the natural row gap.
.item-actions {
- margin-left: 8px;
flex-shrink: 0;
display: inline-flex;
align-items: center;
+ padding-top: 2px;
}
.builtin-avatar {
display: flex;
align-items: center;
justify-content: center;
- width: 20px;
- height: 20px;
+ width: 16px;
+ height: 16px;
border-radius: 4px;
flex-shrink: 0;
&.agent-emoji {
- font-size: 13px;
+ font-size: 11px;
line-height: 1;
background: var(--td-bg-color-container-hover);
}
+
&.normal {
background: linear-gradient(135deg, rgba(7, 192, 95, 0.15) 0%, rgba(7, 192, 95, 0.08) 100%);
color: var(--td-brand-color-active);
}
+
&.agent {
background: linear-gradient(135deg, rgba(124, 77, 255, 0.15) 0%, rgba(124, 77, 255, 0.08) 100%);
color: var(--td-brand-color);
}
}
-
-// Size the generated AgentAvatar (hash-based gradient + letter) to match the
-// builtin-avatar and platform-logo so all three rows align perfectly.
-.stack-row {
- :deep(.agent-avatar),
- :deep(.agent-avatar-small) {
- width: 20px;
- height: 20px;
- }
- :deep(.agent-avatar-letter) {
- font-size: 10px !important;
- }
-}
</style>