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(im): tenant-wide IM channels overview under the user menu

wizardchene029d31f868f
diff --git a/frontend/src/api/agent/index.ts b/frontend/src/api/agent/index.ts
index bad055d8c..c2cda726f 100644
--- a/frontend/src/api/agent/index.ts
+++ b/frontend/src/api/agent/index.ts
@@ -262,6 +262,28 @@ export function listIMChannels(agentId: string) {
return get<{ data: IMChannel[] }>(`/api/v1/agents/${agentId}/im-channels`);
}
+// Tenant-wide overview row. Credentials are intentionally omitted — use
+// listIMChannels(agentId) when you need to edit a specific channel.
+export interface IMChannelOverview {
+ id: string;
+ tenant_id: number;
+ agent_id: string;
+ agent_name: string; // empty string for built-in agents
+ platform: IMChannel['platform'];
+ name: string;
+ enabled: boolean;
+ mode: IMChannel['mode'];
+ output_mode: IMChannel['output_mode'];
+ session_mode?: IMChannel['session_mode'];
+ bot_identity: string;
+ created_at: string;
+ updated_at: string;
+}
+
+export function listAllIMChannels() {
+ return get<{ data: IMChannelOverview[] }>('/api/v1/im-channels');
+}
+
export function createIMChannel(agentId: string, data: Partial<IMChannel>) {
return post<{ data: IMChannel }>(`/api/v1/agents/${agentId}/im-channels`, data);
}
diff --git a/frontend/src/assets/img/im/dingtalk.svg b/frontend/src/assets/img/im/dingtalk.svg
new file mode 100644
index 000000000..73a26867a
--- /dev/null
+++ b/frontend/src/assets/img/im/dingtalk.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path fill="#1677ff" d="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10s10-4.477 10-10S17.523 2 12 2m4.49 9.04l-.006.014c-.42.898-1.516 2.66-1.516 2.66l-.005-.012l-.32.558h1.543l-2.948 3.919l.67-2.666h-1.215l.422-1.763a17 17 0 0 0-1.223.349s-.646.378-1.862-.729c0 0-.82-.722-.344-.902c.202-.077.981-.175 1.595-.257a80 80 0 0 1 1.338-.172s-2.555.039-3.161-.057c-.606-.095-1.375-1.107-1.539-1.996c0 0-.253-.488.545-.257s4.101.9 4.101.9S8.27 9.312 7.983 8.99c-.286-.32-.841-1.754-.769-2.634c0 0 .031-.22.257-.16c0 0 3.176 1.45 5.347 2.245s4.06 1.199 3.816 2.228c-.02.087-.072.216-.144.37"/></svg>
\ No newline at end of file
diff --git a/frontend/src/assets/img/im/feishu.svg b/frontend/src/assets/img/im/feishu.svg
new file mode 100644
index 000000000..b01ea2592
--- /dev/null
+++ b/frontend/src/assets/img/im/feishu.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 48 48"><g fill="#00d6b9" fill-rule="evenodd" clip-rule="evenodd"><path d="M41.0716 5.99409L3.31071 16.5187L12.3856 25.8126L20.7998 25.9594L30.4827 16.5187C30.2266 15.9943 30.0985 15.5552 30.0985 15.2013C30.0985 14.4074 30.4104 13.7786 30.8947 13.333C31.7241 12.57 32.7222 12.4558 33.8889 12.9905L41.0716 5.99409Z"/><path d="M42.1021 6.72842L31.5775 44.4893L22.2836 35.4144L22.1367 27.0002L31.5115 17.4816C32.0195 17.8454 32.5743 18.0105 33.1759 17.9769C34.0784 17.9264 34.6614 17.3813 34.9349 17.0602C35.2083 16.7392 35.5293 16.2051 35.5025 15.4113C35.4847 14.8821 35.3109 14.3941 34.9812 13.9472L42.1021 6.72842Z"/></g></svg>
diff --git a/frontend/src/assets/img/im/mattermost.svg b/frontend/src/assets/img/im/mattermost.svg
new file mode 100644
index 000000000..d40cac044
--- /dev/null
+++ b/frontend/src/assets/img/im/mattermost.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="6.03em" height="1em" viewBox="0 0 512 85"><path fill="#0058cc" d="m42.642.004l.538.011l-5.753 6.8c-10.65 1.925-19.847 9.197-23.46 19.874c-5.378 15.885 3.635 33.29 20.131 38.874s34.228-2.767 39.605-18.651c3.55-10.487.828-21.636-6.179-29.61l-.312-.349l-.442-8.926c14.507 10.53 21.161 29.638 15.111 47.51c-7.446 21.995-31.312 33.788-53.306 26.343C6.58 74.434-5.215 50.568 2.23 28.574C8.23 10.852 24.89-.247 42.641.004M190.4 28.314q8.331 0 13.017 4.006q4.686 4.005 4.686 12.815v24.03q-2.805.882-6.81 1.683q-4.004.8-9.05.8q-4.085 0-7.49-.72t-5.846-2.403a11.3 11.3 0 0 1-3.767-4.325q-1.32-2.644-1.32-6.489t1.641-6.448a12.66 12.66 0 0 1 4.245-4.165q2.604-1.562 5.808-2.243a30.7 30.7 0 0 1 6.408-.68q2.323 0 5.127.24v-.962q0-1.921-.641-3.124a4.8 4.8 0 0 0-1.762-1.881q-1.123-.682-2.763-.922a25 25 0 0 0-3.646-.24q-4.325 0-9.21 1.682q-1.124-2.084-1.683-3.926q-.56-1.841-.561-4.406q3.525-1.2 7.048-1.76q3.525-.562 6.569-.562m-30.328-12.202q3.297 0 6.334.483l2.95 54.57q-3.296.484-6.247.484a35 35 0 0 1-5.813-.483l-1.563-39.455l-12.67 27.27q-1.214.161-2.517.281q-1.3.12-2.603.12q-1.127.001-2.255-.08a19 19 0 0 1-2.344-.322l-11.8-27.835l-1.215 40.02q-2.777.484-5.381.484q-2.776 0-5.727-.483l2.43-54.57a48.5 48.5 0 0 1 6.681-.484q3.385 0 6.682.483l14.319 29.718l14.751-29.718q2.69-.483 5.988-.483m130.834 12.202q4.325 0 7.689 1.522t5.727 4.166q2.364 2.642 3.566 6.287q1.2 3.645 1.2 7.81q0 1.523-.12 3.005q-.12 1.48-.28 2.363h-26.594q.321 4.805 3.365 6.968t8.01 2.163q2.723 0 5.567-.522a31.6 31.6 0 0 0 5.407-1.48q.882 1.601 1.522 3.844t.72 4.806q-6.247 2.403-14.098 2.403q-5.766 0-9.892-1.602t-6.728-4.446q-2.604-2.842-3.845-6.769q-1.241-3.924-1.24-8.57q-.001-4.565 1.28-8.57q1.28-4.007 3.805-6.97q2.523-2.964 6.248-4.686t8.69-1.722m136.092 0q5.045 0 8.81 1.682q3.764 1.684 6.25 4.606q2.481 2.925 3.684 6.929q1.2 4.005 1.201 8.57q0 4.567-1.201 8.491q-1.203 3.926-3.685 6.848q-2.485 2.925-6.249 4.567q-3.764 1.641-8.81 1.642q-5.048 0-8.77-1.642q-3.726-1.641-6.17-4.567q-2.442-2.922-3.684-6.848t-1.241-8.49q0-4.567 1.241-8.571q1.242-4.005 3.685-6.929q2.442-2.923 6.168-4.606q3.724-1.681 8.77-1.682m41.277 0q3.123 0 6.167.561q3.044.56 6.168 1.682a22 22 0 0 1-.802 4.325q-.64 2.243-1.52 3.926a32 32 0 0 0-4.247-1.402q-2.322-.6-4.885-.601q-2.723 0-4.246.841q-1.522.84-1.521 2.683q0 1.763 1.08 2.484q1.082.721 3.084 1.361l4.566 1.363q2.244.64 4.045 1.561q1.802.922 3.084 2.283q1.282 1.363 2.002 3.364q.722 2.003.722 4.886q0 2.965-1.242 5.527q-1.242 2.565-3.604 4.445q-2.364 1.884-5.728 2.964q-3.364 1.082-7.61 1.082q-1.922 0-3.523-.12a28 28 0 0 1-3.084-.4a36 36 0 0 1-2.924-.681a36 36 0 0 1-3.124-1.042q.16-2.164.76-4.365a27.5 27.5 0 0 1 1.563-4.286q2.644 1.042 5.007 1.562q2.363.521 4.926.521q1.121 0 2.442-.2a9 9 0 0 0 2.444-.72a5.8 5.8 0 0 0 1.882-1.363q.761-.84.76-2.203q0-1.922-1.16-2.764q-1.164-.841-3.244-1.481l-4.967-1.442q-4.486-1.282-7.008-3.805q-2.524-2.523-2.524-7.57q0-6.086 4.365-9.531t11.896-3.445M256.952 17.18v12.095h9.693q.24 1.201.32 2.163t.08 2.003q0 1.12-.08 2.162a22 22 0 0 1-.32 2.323h-9.693v16.261q0 2.483.402 4.005q.4 1.52 1.16 2.404a3.83 3.83 0 0 0 1.883 1.2q1.122.321 2.643.321q1.203 0 2.364-.2t2.042-.36q.56 1.52.8 3.163q.242 1.643.242 2.924q0 .881-.04 1.483q-.04.6-.12 1.16q-3.685.882-7.61.88q-7.29 0-11.134-3.402q-3.846-3.406-3.846-11.095V37.926h-5.206l-.401-1.602l14.98-19.144zm-30.052 0v12.095h9.692q.24 1.201.321 2.163q.078.961.079 2.003q0 1.12-.079 2.162a22 22 0 0 1-.321 2.323H226.9v16.261q0 2.483.401 4.005q.4 1.52 1.16 2.404a3.83 3.83 0 0 0 1.883 1.2q1.123.321 2.643.321q1.202 0 2.364-.2t2.042-.36a15.7 15.7 0 0 1 .802 3.163q.24 1.643.24 2.924q0 .881-.04 1.483q-.04.6-.121 1.16a32.6 32.6 0 0 1-7.609.88q-7.29 0-11.134-3.402q-3.845-3.406-3.845-11.095V37.926h-5.207l-.4-1.602l14.979-19.144zm107.84 11.614q.801 0 1.842.081q1.04.08 1.522.24q.16.801.24 1.842q.081 1.041.08 2.164q0 1.36-.12 2.963a21 21 0 0 1-.44 3.043q-.882-.16-1.962-.16h-1.322q-1.362 0-3.045.28q-1.68.282-3.204 1.484q-1.522 1.2-2.522 3.604q-1.002 2.403-1.002 6.729v19.705q-1.441.239-2.884.319q-1.44.08-2.803.08t-2.764-.08a30 30 0 0 1-2.923-.32V29.276q1.201-.24 2.282-.36q1.082-.12 2.364-.12q1.203 0 2.362.16q1.163.16 2.283.4q.241.401.441 1.162q.2.762.361 1.602t.28 1.683l.2 1.401q1.764-2.483 4.325-4.445q2.565-1.964 6.408-1.964m55.395-.48q7.05 0 10.373 3.886q3.324 3.884 3.324 12.135v26.353q-2.883.48-5.687.48t-5.686-.48v-23.39q0-4.326-1.083-6.647q-1.08-2.325-4.365-2.324q-1.362 0-2.682.4q-1.324.4-2.404 1.482q-1.08 1.08-1.763 3.045c-.454 1.306-.68 3.004-.68 5.085v22.349q-2.885.48-5.688.48t-5.688-.48v-23.39q0-4.326-1.08-6.647q-1.082-2.325-4.366-2.324q-1.36 0-2.724.4q-1.36.4-2.443 1.562q-1.081 1.161-1.721 3.245q-.642 2.081-.642 5.446v21.708q-2.883.48-5.687.48q-2.803 0-5.686-.48V29.275q1.12-.24 2.242-.36t2.484-.12a21 21 0 0 1 2.402.12q1.042.12 2.163.36q.24.401.44 1.162t.361 1.602t.28 1.642t.201 1.361q.64-1.2 1.682-2.403q1.041-1.2 2.483-2.162a13.5 13.5 0 0 1 3.244-1.562q1.802-.6 4.045-.601q9.692 0 12.416 7.37q1.6-2.965 4.526-5.167q2.923-2.203 7.41-2.203m110.33-11.134v12.095h9.692q.24 1.201.321 2.163q.08.961.08 2.003a28 28 0 0 1-.08 2.162a22 22 0 0 1-.32 2.323h-9.692v16.261q0 2.483.4 4.005q.4 1.52 1.161 2.404a3.83 3.83 0 0 0 1.883 1.2q1.122.321 2.643.321q1.2 0 2.364-.2q1.16-.2 2.041-.36q.563 1.52.801 3.163q.242 1.643.24 2.924q.001.881-.04 1.483q-.038.6-.119 1.16q-3.683.882-7.61.88q-7.289 0-11.134-3.402q-3.845-3.406-3.845-11.095V37.926h-5.206l-.401-1.602l14.979-19.144zm-73.467 20.025q-4.406 0-6.368 3.325q-1.965 3.324-1.964 9.572q0 6.248 1.964 9.572q1.962 3.324 6.368 3.324q4.486 0 6.447-3.324q1.963-3.324 1.963-9.572t-1.963-9.572q-1.961-3.325-6.447-3.325M192.963 51.304q-3.924 0-6.208 1.401q-2.283 1.402-2.283 4.526q0 2.083.882 3.204q.881 1.121 2.122 1.641a8.7 8.7 0 0 0 2.643.642q1.404.12 2.443.12q1.203 0 2.403-.2q1.202-.2 2.084-.361V51.704q-.961-.16-2.084-.28q-1.12-.12-2.002-.12M54.976 3.885c.195.067.353.19.467.343l.063.096l.024.038l.02.044c.056.106.103.226.125.375c.04.271.06.882.07 1.53l.003.392l.002.386v.699c-.001.368-.004.633-.004.687v.01l.165 6.222l.244 7.18l.305 12.48v.084c-.003.726-.154 5.933-3.85 9.553c-3.98 3.9-8.868 3.542-12.048 2.466c-3.18-1.077-7.28-3.763-8.074-9.278c-.778-5.41 2.663-9.825 2.793-9.99l.003-.004l7.823-9.728l4.556-5.555l3.91-4.842s1.795-2.404 2.306-2.9q.102-.097.205-.157l.102-.055l.075-.038l.013-.005a.97.97 0 0 1 .702-.033m235.77 33.08q-4.006 0-6.088 2.243t-2.483 6.329h16.18q-.16-3.846-2.123-6.208q-1.962-2.365-5.487-2.365"/></svg>
\ No newline at end of file
diff --git a/frontend/src/assets/img/im/slack.svg b/frontend/src/assets/img/im/slack.svg
new file mode 100644
index 000000000..2eb528db8
--- /dev/null
+++ b/frontend/src/assets/img/im/slack.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 256 256"><path fill="#e01e5a" d="M53.841 161.32c0 14.832-11.987 26.82-26.819 26.82S.203 176.152.203 161.32c0-14.831 11.987-26.818 26.82-26.818H53.84zm13.41 0c0-14.831 11.987-26.818 26.819-26.818s26.819 11.987 26.819 26.819v67.047c0 14.832-11.987 26.82-26.82 26.82c-14.83 0-26.818-11.988-26.818-26.82z"/><path fill="#36c5f0" d="M94.07 53.638c-14.832 0-26.82-11.987-26.82-26.819S79.239 0 94.07 0s26.819 11.987 26.819 26.819v26.82zm0 13.613c14.832 0 26.819 11.987 26.819 26.819s-11.987 26.819-26.82 26.819H26.82C11.987 120.889 0 108.902 0 94.069c0-14.83 11.987-26.818 26.819-26.818z"/><path fill="#2eb67d" d="M201.55 94.07c0-14.832 11.987-26.82 26.818-26.82s26.82 11.988 26.82 26.82s-11.988 26.819-26.82 26.819H201.55zm-13.41 0c0 14.832-11.988 26.819-26.82 26.819c-14.831 0-26.818-11.987-26.818-26.82V26.82C134.502 11.987 146.489 0 161.32 0s26.819 11.987 26.819 26.819z"/><path fill="#ecb22e" d="M161.32 201.55c14.832 0 26.82 11.987 26.82 26.818s-11.988 26.82-26.82 26.82c-14.831 0-26.818-11.988-26.818-26.82V201.55zm0-13.41c-14.831 0-26.818-11.988-26.818-26.82c0-14.831 11.987-26.818 26.819-26.818h67.25c14.832 0 26.82 11.987 26.82 26.819s-11.988 26.819-26.82 26.819z"/></svg>
\ No newline at end of file
diff --git a/frontend/src/assets/img/im/telegram.svg b/frontend/src/assets/img/im/telegram.svg
new file mode 100644
index 000000000..53458c559
--- /dev/null
+++ b/frontend/src/assets/img/im/telegram.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 256 256"><defs><linearGradient id="SVG6DaOZcwt" x1="50%" x2="50%" y1="0%" y2="100%"><stop offset="0%" stop-color="#2aabee"/><stop offset="100%" stop-color="#229ed9"/></linearGradient></defs><path fill="url(#SVG6DaOZcwt)" d="M128 0C94.06 0 61.48 13.494 37.5 37.49A128.04 128.04 0 0 0 0 128c0 33.934 13.5 66.514 37.5 90.51C61.48 242.506 94.06 256 128 256s66.52-13.494 90.5-37.49c24-23.996 37.5-56.576 37.5-90.51s-13.5-66.514-37.5-90.51C194.52 13.494 161.94 0 128 0"/><path fill="#fff" d="M57.94 126.648q55.98-24.384 74.64-32.152c35.56-14.786 42.94-17.354 47.76-17.441c1.06-.017 3.42.245 4.96 1.49c1.28 1.05 1.64 2.47 1.82 3.467c.16.996.38 3.266.2 5.038c-1.92 20.24-10.26 69.356-14.5 92.026c-1.78 9.592-5.32 12.808-8.74 13.122c-7.44.684-13.08-4.912-20.28-9.63c-11.26-7.386-17.62-11.982-28.56-19.188c-12.64-8.328-4.44-12.906 2.76-20.386c1.88-1.958 34.64-31.748 35.26-34.45c.08-.338.16-1.598-.6-2.262c-.74-.666-1.84-.438-2.64-.258c-1.14.256-19.12 12.152-54 35.686c-5.1 3.508-9.72 5.218-13.88 5.128c-4.56-.098-13.36-2.584-19.9-4.708c-8-2.606-14.38-3.984-13.82-8.41c.28-2.304 3.46-4.662 9.52-7.072"/></svg>
\ No newline at end of file
diff --git a/frontend/src/assets/img/im/wechat.svg b/frontend/src/assets/img/im/wechat.svg
new file mode 100644
index 000000000..17a81888d
--- /dev/null
+++ b/frontend/src/assets/img/im/wechat.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path fill="#07c160" d="M15.85 8.14c.39 0 .77.03 1.14.08C16.31 5.25 13.19 3 9.44 3c-4.25 0-7.7 2.88-7.7 6.43c0 2.05 1.15 3.86 2.94 5.04L3.67 16.5l2.76-1.19c.59.21 1.21.38 1.87.47c-.09-.39-.14-.79-.14-1.21c-.01-3.54 3.44-6.43 7.69-6.43M12 5.89a.96.96 0 1 1 0 1.92a.96.96 0 0 1 0-1.92M6.87 7.82a.96.96 0 1 1 0-1.92a.96.96 0 0 1 0 1.92"/><path fill="#07c160" d="M22.26 14.57c0-2.84-2.87-5.14-6.41-5.14s-6.41 2.3-6.41 5.14s2.87 5.14 6.41 5.14c.58 0 1.14-.08 1.67-.2L20.98 21l-1.2-2.4c1.5-.94 2.48-2.38 2.48-4.03m-8.34-.32a.96.96 0 1 1 .96-.96c.01.53-.43.96-.96.96m3.85 0a.96.96 0 1 1 0-1.92a.96.96 0 0 1 0 1.92"/></svg>
\ No newline at end of file
diff --git a/frontend/src/assets/img/im/wecom.svg b/frontend/src/assets/img/im/wecom.svg
new file mode 100644
index 000000000..ab499fb91
--- /dev/null
+++ b/frontend/src/assets/img/im/wecom.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path fill="#07c160" d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12S5.925 1 12 1m3.52 15.49a.35.35 0 0 0-.24.1c-.14.13-.16.34.02.53l.07.07c.44.44.74.99.85 1.57c0 .02.04.23.04.23c.05.19.15.37.29.5c.21.21.51.34.82.34c.3 0 .59-.12.8-.33c.44-.44.44-1.16 0-1.61c-.15-.15-.34-.26-.53-.3l-.15-.03c-.61-.11-1.17-.41-1.62-.86c-.03-.03-.07-.07-.1-.11c-.06-.074-.16-.1-.25-.1M11 4.75c-2.117 0-4.264.77-5.75 2.31C4.111 8.246 3.5 9.72 3.5 11.24c0 1.06.3 2.12.88 3.06c.47.695.993 1.371 1.66 1.89l-.384 1.624a.6.6 0 0 0 .856.673L8.64 17.41c.53.166 1.08.234 1.63.3a8.3 8.3 0 0 0 1.7-.03l.38-.05q.283-.046.564-.112a2.33 2.33 0 0 1-.92-1.605l-.254.037c-.62.067-1.232.03-1.85-.04c-.43-.057-.838-.185-1.25-.31l-1.02.5l.23-.67l-.74-.6c-.513-.401-.917-.934-1.28-1.47c-.4-.65-.61-1.38-.61-2.11c0-1.08.456-2.119 1.26-2.97c1.158-1.198 2.854-1.78 4.5-1.78c1.54 0 3.108.513 4.24 1.58c.365.365.707.75.95 1.21c.177.354.338.722.424 1.107a2.34 2.34 0 0 1 1.811.123c-.075-.716-.33-1.4-.665-2.04c-.329-.62-.776-1.155-1.27-1.65c-1.468-1.38-3.471-2.08-5.47-2.08m9.37 9.77a1.136 1.136 0 0 0-1.1.86l-.03.15a3.1 3.1 0 0 1-.86 1.63c-.04.03-.07.07-.11.1c-.14.13-.14.35 0 .49c.07.06.17.1.26.1h.01c.07 0 .15-.02.26-.13l.07-.07c.44-.44.99-.74 1.57-.85c.023 0 .227-.04.23-.04c.2-.06.37-.16.5-.3c.44-.44.44-1.17 0-1.61c-.21-.21-.5-.33-.8-.33m-4.21-1.07c-.08 0-.16.03-.27.14l-.07.07c-.44.44-.99.74-1.57.85c-.02 0-.23.04-.23.04c-.2.06-.37.16-.5.3c-.44.44-.44 1.17 0 1.61c.21.21.51.34.82.34c.3 0 .59-.12.8-.33c.15-.16.25-.34.29-.53a.4.4 0 0 0 .03-.16c.11-.61.41-1.18.86-1.63c.03-.03.06-.06.1-.09c.146-.115.13-.36 0-.49a.34.34 0 0 0-.26-.12m1.18-1.97c-.3 0-.59.12-.8.33c-.44.44-.44 1.16 0 1.61c.15.15.34.26.53.3c.054.006.144.029.15.03c.61.12 1.17.41 1.62.86c.03.03.07.07.1.11c.08.08.16.1.25.1c.1 0 .16-.04.23-.11c.12-.13.14-.32-.02-.52l-.08-.08c-.44-.44-.74-.99-.85-1.57c0-.02-.04-.23-.04-.23c-.05-.19-.15-.37-.29-.5c-.21-.21-.5-.33-.8-.33"/></svg>
\ No newline at end of file
diff --git a/frontend/src/components/IMChannelsOverviewPanel.vue b/frontend/src/components/IMChannelsOverviewPanel.vue
new file mode 100644
index 000000000..ef18376f3
--- /dev/null
+++ b/frontend/src/components/IMChannelsOverviewPanel.vue
@@ -0,0 +1,393 @@
+<template>
+ <div class="im-submenu" @click.stop>
+ <div class="submenu-header">
+ <div class="titles">
+ <h4 class="title">{{ $t('imOverview.pageTitle') }}</h4>
+ <p class="subtitle">{{ $t('imOverview.subtitle') }}</p>
+ </div>
+ <t-button
+ variant="text"
+ theme="default"
+ size="small"
+ :loading="loading"
+ @click="loadAll"
+ >
+ <template #icon><t-icon name="refresh" /></template>
+ </t-button>
+ </div>
+
+ <div class="submenu-body">
+ <div v-if="loading && channels.length === 0" class="state-placeholder">
+ <t-loading size="small" />
+ </div>
+
+ <div v-else-if="channels.length === 0" class="state-placeholder">
+ <span class="empty-text">{{ $t('imOverview.empty') }}</span>
+ </div>
+
+ <div v-else class="channels-list">
+ <div
+ v-for="ch in channels"
+ :key="ch.id"
+ class="channel-item"
+ :class="{ 'is-disabled': !ch.enabled }"
+ role="button"
+ :tabindex="0"
+ :title="$t('imOverview.gotoAgentEditor')"
+ @click="gotoAgentEditor(ch)"
+ @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">
+ <span
+ v-if="agentMeta(ch.agent_id)?.is_builtin"
+ class="builtin-avatar"
+ :class="agentMeta(ch.agent_id)?.config?.agent_mode === 'smart-reasoning' ? 'agent' : 'normal'"
+ >
+ <t-icon
+ :name="agentMeta(ch.agent_id)?.config?.agent_mode === 'smart-reasoning' ? 'control-platform' : 'chat'"
+ size="12px"
+ />
+ </span>
+ <span
+ v-else-if="agentMeta(ch.agent_id)?.avatar"
+ class="builtin-avatar agent-emoji"
+ >{{ agentMeta(ch.agent_id)!.avatar }}</span>
+ <AgentAvatar
+ v-else
+ :name="ch.agent_name || ch.agent_id"
+ 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>
+ </div>
+ </div>
+
+ <div class="item-actions" @click.stop>
+ <t-switch
+ :value="ch.enabled"
+ size="small"
+ :loading="togglingId === ch.id"
+ @change="handleToggle(ch)"
+ />
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</template>
+
+<script setup lang="ts">
+import { ref, watch } from 'vue';
+import { useRouter } from 'vue-router';
+import { useI18n } from 'vue-i18n';
+import { MessagePlugin } from 'tdesign-vue-next';
+import {
+ listAllIMChannels,
+ listAgents,
+ toggleIMChannel,
+ type IMChannelOverview,
+ type CustomAgent,
+} 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';
+import telegramLogo from '@/assets/img/im/telegram.svg';
+import dingtalkLogo from '@/assets/img/im/dingtalk.svg';
+import mattermostLogo from '@/assets/img/im/mattermost.svg';
+import wechatLogo from '@/assets/img/im/wechat.svg';
+
+const PLATFORM_LOGO: Record<string, string> = {
+ wecom: wecomLogo,
+ feishu: feishuLogo,
+ slack: slackLogo,
+ telegram: telegramLogo,
+ dingtalk: dingtalkLogo,
+ mattermost: mattermostLogo,
+ wechat: wechatLogo,
+};
+
+const props = defineProps<{
+ active: boolean;
+}>();
+
+const emit = defineEmits<{
+ (e: 'close'): void;
+ (e: 'channels-changed', channels: IMChannelOverview[]): void;
+}>();
+
+const { t } = useI18n();
+const router = useRouter();
+
+const channels = ref<IMChannelOverview[]>([]);
+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) => {
+ if (v && !old) loadAll();
+ },
+ { immediate: true },
+);
+
+function platformLogo(p: string): string {
+ return PLATFORM_LOGO[p] || '';
+}
+
+function platformLabel(p: string): string {
+ return t(`agentEditor.im.${p}`);
+}
+
+function agentMeta(agentId: string): CustomAgent | undefined {
+ return agentMap.value.get(agentId);
+}
+
+async function loadAll() {
+ loading.value = true;
+ try {
+ const [chanResp, agentResp] = await Promise.all([
+ listAllIMChannels(),
+ listAgents(),
+ ]);
+ channels.value = chanResp?.data || [];
+ const m = new Map<string, CustomAgent>();
+ (agentResp?.data || []).forEach((a) => m.set(a.id, a));
+ agentMap.value = m;
+ emit('channels-changed', channels.value);
+ } catch (err) {
+ console.error('Failed to load IM overview:', err);
+ MessagePlugin.error(t('imOverview.loadFailed'));
+ } finally {
+ loading.value = false;
+ }
+}
+
+async function handleToggle(ch: IMChannelOverview) {
+ if (togglingId.value) return;
+ togglingId.value = ch.id;
+ try {
+ await toggleIMChannel(ch.id);
+ const resp = await listAllIMChannels();
+ channels.value = resp?.data || [];
+ emit('channels-changed', channels.value);
+ } catch (err: any) {
+ console.error('Failed to toggle IM channel:', err);
+ MessagePlugin.error(err?.message || t('common.operationFailed'));
+ } finally {
+ togglingId.value = '';
+ }
+}
+
+function gotoAgentEditor(ch: IMChannelOverview) {
+ emit('close');
+ router.push({
+ path: '/platform/agents',
+ query: { edit: ch.agent_id, section: 'im' },
+ });
+}
+</script>
+
+<style lang="less" scoped>
+.im-submenu {
+ display: flex;
+ flex-direction: column;
+ 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);
+ overflow: hidden;
+}
+
+.submenu-header {
+ display: flex;
+ align-items: flex-start;
+ justify-content: space-between;
+ gap: 8px;
+ padding: 12px 14px;
+ border-bottom: 1px solid var(--td-component-stroke);
+
+ .titles {
+ min-width: 0;
+ }
+
+ .title {
+ margin: 0 0 2px;
+ font-size: 13px;
+ font-weight: 600;
+ color: var(--td-text-color-primary);
+ line-height: 1.3;
+ }
+
+ .subtitle {
+ margin: 0;
+ font-size: 11px;
+ color: var(--td-text-color-secondary);
+ line-height: 1.4;
+ }
+}
+
+.submenu-body {
+ flex: 1;
+ overflow-y: auto;
+ padding: 6px;
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+}
+
+.state-placeholder {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: 10px;
+ padding: 40px 0;
+ color: var(--td-text-color-placeholder);
+
+ .empty-text {
+ font-size: 12px;
+ }
+}
+
+.channels-list {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+}
+
+.channel-item {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 8px 10px;
+ background: transparent;
+ border-radius: 6px;
+ cursor: pointer;
+ outline: none;
+ transition: background 0.15s;
+
+ &:hover,
+ &:focus-visible {
+ background: var(--td-bg-color-container-hover);
+ }
+
+ &.is-disabled {
+ opacity: 0.55;
+ }
+}
+
+// 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 {
+ flex: 1;
+ min-width: 0;
+ display: flex;
+ flex-direction: column;
+ gap: 3px;
+}
+
+.stack-row {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ min-width: 0;
+}
+
+.row-avatar {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 20px;
+ height: 20px;
+ border-radius: 4px;
+ flex-shrink: 0;
+
+ &.platform-logo {
+ object-fit: contain;
+ background: transparent;
+ padding: 1px;
+ }
+}
+
+.row-label {
+ font-size: 12px;
+ color: var(--td-text-color-primary);
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ min-width: 0;
+ line-height: 1.3;
+}
+
+// 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;
+}
+
+.builtin-avatar {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 20px;
+ height: 20px;
+ border-radius: 4px;
+ flex-shrink: 0;
+
+ &.agent-emoji {
+ font-size: 13px;
+ 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>
diff --git a/frontend/src/components/UserMenu.vue b/frontend/src/components/UserMenu.vue
index fe44eeff4..e0a022e60 100644
--- a/frontend/src/components/UserMenu.vue
+++ b/frontend/src/components/UserMenu.vue
@@ -47,6 +47,25 @@
<t-icon name="secured" class="menu-icon" />
<span>{{ $t('settings.apiInfo') }}</span>
</div>
+ <div
+ ref="imMenuItemRef"
+ class="menu-item menu-item--submenu"
+ :class="{ 'is-open': imSubmenuOpen }"
+ @mouseenter="showIMSubmenu"
+ @mouseleave="scheduleHideIMSubmenu"
+ >
+ <t-icon name="link" class="menu-icon" />
+ <span class="menu-item-label">{{ $t('imOverview.menuTitle') }}</span>
+ <span
+ v-if="hasActiveIMChannels"
+ class="live-indicator"
+ :title="$t('imOverview.liveIndicator')"
+ aria-hidden="true"
+ >
+ <span class="live-indicator-dot"></span>
+ </span>
+ <t-icon name="chevron-right" class="menu-chevron" />
+ </div>
<div class="menu-divider"></div>
<div class="menu-item" @click="handleSettings">
<t-icon name="setting" class="menu-icon" />
@@ -105,6 +124,25 @@
</template>
</div>
</Transition>
+
+ <!-- IM submenu is teleported to body because the sidebar (.aside_box) has
+ overflow:hidden, which would otherwise clip any absolutely-positioned
+ child that reaches past its bounds. -->
+ <Teleport to="body">
+ <div
+ v-if="imSubmenuOpen"
+ class="im-submenu-floating"
+ :style="imSubmenuStyle"
+ @mouseenter="showIMSubmenu"
+ @mouseleave="scheduleHideIMSubmenu"
+ >
+ <IMChannelsOverviewPanel
+ :active="imSubmenuOpen"
+ @close="closeAll"
+ @channels-changed="onChannelsChanged"
+ />
+ </div>
+ </Teleport>
</div>
</template>
@@ -116,6 +154,8 @@ import { useAuthStore } from '@/stores/auth'
import { MessagePlugin } from 'tdesign-vue-next'
import { getCurrentUser, logout as logoutApi } from '@/api/auth'
import { useI18n } from 'vue-i18n'
+import IMChannelsOverviewPanel from '@/components/IMChannelsOverviewPanel.vue'
+import { listAllIMChannels, type IMChannelOverview } from '@/api/agent'
const { t } = useI18n()
@@ -124,7 +164,12 @@ const uiStore = useUIStore()
const authStore = useAuthStore()
const menuRef = ref<HTMLElement>()
+const imMenuItemRef = ref<HTMLElement>()
const menuVisible = ref(false)
+const imSubmenuOpen = ref(false)
+const imSubmenuStyle = ref<Record<string, string>>({})
+const hasActiveIMChannels = ref(false)
+let imSubmenuHideTimer: ReturnType<typeof setTimeout> | null = null
// 用户信息
const userInfo = ref({
@@ -168,6 +213,81 @@ const handleSettings = () => {
router.push('/platform/settings')
}
+// Hover-driven submenu controls. A small hide delay tolerates the pointer
+// slipping off briefly onto the gap between menu item and submenu pane.
+const showIMSubmenu = () => {
+ if (imSubmenuHideTimer) {
+ clearTimeout(imSubmenuHideTimer)
+ imSubmenuHideTimer = null
+ }
+ // Compute panel position based on the menu item's rect — the panel is
+ // teleported to body so we can't rely on CSS `left: 100%`.
+ positionIMSubmenu()
+ imSubmenuOpen.value = true
+}
+
+const scheduleHideIMSubmenu = () => {
+ if (imSubmenuHideTimer) clearTimeout(imSubmenuHideTimer)
+ imSubmenuHideTimer = setTimeout(() => {
+ imSubmenuOpen.value = false
+ imSubmenuHideTimer = null
+ }, 180)
+}
+
+const closeAll = () => {
+ imSubmenuOpen.value = false
+ menuVisible.value = false
+}
+
+// Silent prefetch so the "live" indicator on the IM menu item reflects reality
+// as soon as the user sees the avatar area. Errors are swallowed — the
+// indicator just stays off if the request fails, which is the conservative
+// default. The panel component emits channels-changed after toggle/refresh so
+// we stay in sync without re-polling.
+const refreshIMStatus = async () => {
+ try {
+ const resp = await listAllIMChannels()
+ const data: IMChannelOverview[] = resp?.data || []
+ hasActiveIMChannels.value = data.some((c) => c.enabled)
+ } catch {
+ // Intentionally ignored — indicator just stays off.
+ }
+}
+
+const onChannelsChanged = (channels: IMChannelOverview[]) => {
+ hasActiveIMChannels.value = channels.some((c) => c.enabled)
+}
+
+// Anchor the floating submenu just to the right of the hovered menu item,
+// clamped to the viewport so it stays visible near the screen edge.
+const positionIMSubmenu = () => {
+ const el = imMenuItemRef.value
+ if (!el) return
+ const rect = el.getBoundingClientRect()
+ const PANEL_WIDTH = 300
+ const PANEL_MAX_HEIGHT = 520
+ const GAP = 8
+ const MARGIN = 8
+
+ let left = rect.right + GAP
+ // If the panel would overflow the right edge, flip to the left side.
+ if (left + PANEL_WIDTH + MARGIN > window.innerWidth) {
+ left = Math.max(MARGIN, rect.left - PANEL_WIDTH - GAP)
+ }
+
+ // Align the panel's top with the menu item, then clamp so it doesn't
+ // spill past the bottom of the viewport.
+ let top = rect.top - 4
+ const maxTop = window.innerHeight - Math.min(PANEL_MAX_HEIGHT, window.innerHeight - MARGIN * 2) - MARGIN
+ if (top > maxTop) top = maxTop
+ if (top < MARGIN) top = MARGIN
+
+ imSubmenuStyle.value = {
+ left: `${left}px`,
+ top: `${top}px`,
+ }
+}
+
const CHROME_EXTENSION_URL =
'https://chromewebstore.google.com/detail/jpemjbopikggjlmikmclgbmkhhopjdgd?utm_source=item-share-cb'
@@ -252,14 +372,20 @@ const loadUserInfo = async () => {
// 点击外部关闭菜单
const handleClickOutside = (e: MouseEvent) => {
- if (menuRef.value && !menuRef.value.contains(e.target as Node)) {
- menuVisible.value = false
- }
+ const target = e.target as Node
+ if (menuRef.value && menuRef.value.contains(target)) return
+ // The submenu is teleported to body, so it's not inside menuRef — check it
+ // separately to avoid closing the dropdown when the user clicks the submenu.
+ const floating = document.querySelector('.im-submenu-floating')
+ if (floating && floating.contains(target)) return
+ menuVisible.value = false
+ imSubmenuOpen.value = false
}
onMounted(() => {
document.addEventListener('click', handleClickOutside)
loadUserInfo()
+ refreshIMStatus()
})
onUnmounted(() => {
@@ -411,6 +537,69 @@ onUnmounted(() => {
}
}
+ // 包含右弹子菜单的菜单项
+ &--submenu {
+ position: relative;
+
+ .menu-item-label {
+ flex: 1;
+ }
+
+ .menu-chevron {
+ font-size: 14px;
+ color: var(--td-text-color-placeholder);
+ flex-shrink: 0;
+ transition: transform 0.15s;
+ }
+
+ &.is-open {
+ background: var(--td-bg-color-container-hover);
+
+ .menu-chevron {
+ color: var(--td-text-color-secondary);
+ }
+ }
+
+ // "Live" indicator — shown when at least one IM channel is enabled.
+ // A small green dot with a halo that pulses to signal active connections.
+ .live-indicator {
+ position: relative;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 10px;
+ height: 10px;
+ margin-right: 2px;
+ flex-shrink: 0;
+ }
+
+ .live-indicator-dot {
+ position: relative;
+ width: 6px;
+ height: 6px;
+ border-radius: 50%;
+ background: var(--td-success-color, #07c160);
+
+ // Pulsing halo around the dot. Prefers-reduced-motion disables it.
+ &::after {
+ content: '';
+ position: absolute;
+ inset: -3px;
+ border-radius: 50%;
+ background: var(--td-success-color, #07c160);
+ opacity: 0.45;
+ animation: im-live-pulse 1.6s ease-out infinite;
+ pointer-events: none;
+ }
+ }
+
+ @media (prefers-reduced-motion: reduce) {
+ .live-indicator-dot::after {
+ animation: none;
+ }
+ }
+ }
+
.menu-icon {
font-size: 16px;
color: var(--td-text-color-secondary);
@@ -506,5 +695,35 @@ onUnmounted(() => {
opacity: 1;
transform: translateY(0);
}
+
+// Live indicator halo animation — a soft expanding ring to signal that at
+// least one IM channel is actively connected.
+@keyframes im-live-pulse {
+ 0% {
+ transform: scale(0.9);
+ opacity: 0.45;
+ }
+ 70% {
+ transform: scale(1.8);
+ opacity: 0;
+ }
+ 100% {
+ transform: scale(1.8);
+ opacity: 0;
+ }
+}
+</style>
+
+<style lang="less">
+// Non-scoped: the IM submenu is teleported to <body> so scoped styles
+// from this component won't reach it. The panel component's own CSS is
+// scoped and self-contained; this rule only positions the wrapper.
+.im-submenu-floating {
+ position: fixed;
+ z-index: 1100;
+ // Invisible padding forms a pointer bridge from the menu item to the
+ // panel so hovering across the gap doesn't fire mouseleave-hide.
+ padding-left: 2px;
+}
</style>
diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts
index faa77f807..b708a9ed2 100755
--- a/frontend/src/i18n/locales/en-US.ts
+++ b/frontend/src/i18n/locales/en-US.ts
@@ -3979,4 +3979,29 @@ export default {
syncResultDeleted: '-{n}',
moreActions: 'More',
},
+ imOverview: {
+ menuTitle: 'Connected IMs',
+ pageTitle: 'Connected IMs',
+ subtitle: 'All IM channels connected to agents in this tenant — toggle state or jump to the owning agent',
+ totalCount: '{count} total',
+ empty: 'This tenant has no IM bots configured yet',
+ loadFailed: 'Failed to load IM bots',
+ builtinAgent: 'Built-in agent',
+ liveIndicator: 'IM channels are live',
+ detailsTitle: 'IM Bot Details',
+ gotoAgentEditor: 'Open in agent editor',
+ outputMode: 'Output mode',
+ sessionMode: 'Session mode',
+ updatedAt: 'Updated at',
+ channelId: 'Channel ID',
+ columns: {
+ platform: 'Platform',
+ name: 'Name',
+ agent: 'Agent',
+ mode: 'Mode',
+ enabled: 'Enabled',
+ botIdentity: 'Bot identity',
+ createdAt: 'Created at',
+ },
+ },
}
diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts
index 1200a1ac4..0991c4312 100755
--- a/frontend/src/i18n/locales/ko-KR.ts
+++ b/frontend/src/i18n/locales/ko-KR.ts
@@ -4047,4 +4047,30 @@ export default {
syncResultUpdated: "~{n}",
syncResultDeleted: "-{n}",
},
+ imOverview: {
+ menuTitle: "연결된 IM",
+ pageTitle: "연결된 IM",
+ subtitle: "이 테넌트의 에이전트에 연결된 모든 IM 채널 — 활성화/비활성화 전환 또는 해당 에이전트로 이동",
+ totalCount: "총 {count}개",
+ empty: "이 테넌트에 구성된 IM 봇이 없습니다",
+ loadFailed: "IM 봇 목록을 불러오지 못했습니다",
+ builtinAgent: "내장 에이전트",
+ liveIndicator: "활성화된 IM 채널이 실행 중입니다",
+ liveIndicator: "활성화된 IM 채널이 실행 중입니다",
+ detailsTitle: "IM 봇 상세",
+ gotoAgentEditor: "에이전트 편집기에서 열기",
+ outputMode: "출력 모드",
+ sessionMode: "세션 모드",
+ updatedAt: "업데이트 시각",
+ channelId: "채널 ID",
+ columns: {
+ platform: "플랫폼",
+ name: "이름",
+ agent: "에이전트",
+ mode: "모드",
+ enabled: "활성화",
+ botIdentity: "봇 식별자",
+ createdAt: "생성 시각",
+ },
+ },
};
diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts
index 80ac774dd..380b543f3 100755
--- a/frontend/src/i18n/locales/ru-RU.ts
+++ b/frontend/src/i18n/locales/ru-RU.ts
@@ -3947,4 +3947,29 @@ export default {
syncResultUpdated: '~{n}',
syncResultDeleted: '-{n}',
},
+ imOverview: {
+ menuTitle: 'Подключённые IM',
+ pageTitle: 'Подключённые IM',
+ subtitle: 'Все IM-каналы агентов этого арендатора — переключение состояния или переход к владеющему агенту',
+ totalCount: 'Всего: {count}',
+ empty: 'В этом арендаторе пока не настроены IM-боты',
+ loadFailed: 'Не удалось загрузить список IM-ботов',
+ builtinAgent: 'Встроенный агент',
+ liveIndicator: 'IM-каналы работают',
+ detailsTitle: 'Детали IM-бота',
+ gotoAgentEditor: 'Открыть в редакторе агента',
+ outputMode: 'Режим вывода',
+ sessionMode: 'Режим сессии',
+ updatedAt: 'Обновлено',
+ channelId: 'ID канала',
+ columns: {
+ platform: 'Платформа',
+ name: 'Имя',
+ agent: 'Агент',
+ mode: 'Режим',
+ enabled: 'Включено',
+ botIdentity: 'Идентификатор бота',
+ createdAt: 'Создано',
+ },
+ },
}
diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts
index 7fecf2199..0c76e6e04 100755
--- a/frontend/src/i18n/locales/zh-CN.ts
+++ b/frontend/src/i18n/locales/zh-CN.ts
@@ -3976,4 +3976,29 @@ export default {
syncResultDeleted: "-{n}",
moreActions: "更多",
},
+ imOverview: {
+ menuTitle: "已接入的 IM",
+ pageTitle: "已接入的 IM",
+ subtitle: "当前租户下所有智能体已接入的 IM 渠道,可快速启停或跳转到对应智能体",
+ totalCount: "共 {count} 个",
+ empty: "当前租户还没有配置 IM 机器人",
+ loadFailed: "加载 IM 机器人列表失败",
+ builtinAgent: "内置智能体",
+ liveIndicator: "有已启用的 IM 渠道正在运行",
+ detailsTitle: "IM 机器人详情",
+ gotoAgentEditor: "前往 Agent 编辑",
+ outputMode: "输出模式",
+ sessionMode: "会话模式",
+ updatedAt: "更新时间",
+ channelId: "渠道 ID",
+ columns: {
+ platform: "平台",
+ name: "名称",
+ agent: "所属智能体",
+ mode: "模式",
+ enabled: "启用",
+ botIdentity: "Bot 标识",
+ createdAt: "创建时间",
+ },
+ },
};
diff --git a/frontend/src/views/agent/AgentList.vue b/frontend/src/views/agent/AgentList.vue
index b59da41e4..c0e8a662c 100644
--- a/frontend/src/views/agent/AgentList.vue
+++ b/frontend/src/views/agent/AgentList.vue
@@ -715,6 +715,19 @@ const checkAndOpenEditModal = () => {
}
}
+// Also re-run when the query mutates while this view is already mounted —
+// e.g. the IM overview dialog navigating here via router.push lands on the
+// same route, so onMounted alone never fires and the editor would only open
+// after a manual refresh.
+watch(
+ () => route.query.edit,
+ (v) => {
+ if (v && agents.value.length > 0) {
+ checkAndOpenEditModal()
+ }
+ },
+)
+
// 监听菜单创建智能体事件
const handleOpenAgentEditor = (event: CustomEvent) => {
if (event.detail?.mode === 'create') {
diff --git a/internal/handler/im.go b/internal/handler/im.go
index 5813a6dcb..f36a83e27 100644
--- a/internal/handler/im.go
+++ b/internal/handler/im.go
@@ -134,6 +134,26 @@ func (h *IMHandler) ListIMChannels(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"data": channels})
}
+// ListAllIMChannels lists every IM channel in the current tenant, across
+// agents, for the cross-agent overview page. Credentials are intentionally
+// NOT included in the response — callers that need credentials must use the
+// per-agent endpoint (GET /agents/:id/im-channels).
+func (h *IMHandler) ListAllIMChannels(c *gin.Context) {
+ tenantID, ok := c.Request.Context().Value(types.TenantIDContextKey).(uint64)
+ if !ok {
+ c.JSON(http.StatusUnauthorized, gin.H{"error": "unauthorized"})
+ return
+ }
+
+ channels, err := h.imService.ListChannelsByTenant(tenantID)
+ if err != nil {
+ c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to list channels"})
+ return
+ }
+
+ c.JSON(http.StatusOK, gin.H{"data": channels})
+}
+
// UpdateIMChannel updates an IM channel.
func (h *IMHandler) UpdateIMChannel(c *gin.Context) {
channelID := c.Param("id")
diff --git a/internal/im/service.go b/internal/im/service.go
index 734e2bebd..c94df9dbc 100644
--- a/internal/im/service.go
+++ b/internal/im/service.go
@@ -2058,6 +2058,48 @@ func (s *Service) ListChannelsByAgent(agentID string, tenantID uint64) ([]IMChan
return channels, nil
}
+// ChannelWithAgent augments an IMChannel summary with its owning agent's display name.
+// Credentials are intentionally omitted so this type is safe to return from a
+// tenant-scoped list endpoint; callers that need credentials must use the
+// per-agent endpoint which enforces the same tenant scope anyway.
+type ChannelWithAgent struct {
+ ID string `json:"id"`
+ TenantID uint64 `json:"tenant_id"`
+ AgentID string `json:"agent_id"`
+ AgentName string `json:"agent_name"`
+ Platform string `json:"platform"`
+ Name string `json:"name"`
+ Enabled bool `json:"enabled"`
+ Mode string `json:"mode"`
+ OutputMode string `json:"output_mode"`
+ SessionMode string `json:"session_mode"`
+ BotIdentity string `json:"bot_identity"`
+ CreatedAt time.Time `json:"created_at"`
+ UpdatedAt time.Time `json:"updated_at"`
+}
+
+// ListChannelsByTenant returns all non-deleted IM channels in the given tenant,
+// joined with custom_agents.name. Built-in agent IDs (whose rows may not exist
+// in custom_agents) produce an empty AgentName — the frontend can substitute a
+// localized "builtin agent" label in that case.
+func (s *Service) ListChannelsByTenant(tenantID uint64) ([]ChannelWithAgent, error) {
+ var rows []ChannelWithAgent
+ err := s.db.Table("im_channels AS c").
+ Select(`c.id, c.tenant_id, c.agent_id,
+ COALESCE(a.name, '') AS agent_name,
+ c.platform, c.name, c.enabled, c.mode, c.output_mode,
+ c.session_mode, c.bot_identity, c.created_at, c.updated_at`).
+ Joins(`LEFT JOIN custom_agents AS a
+ ON a.id = c.agent_id AND a.tenant_id = c.tenant_id`).
+ Where("c.tenant_id = ? AND c.deleted_at IS NULL", tenantID).
+ Order("c.created_at DESC").
+ Scan(&rows).Error
+ if err != nil {
+ return nil, err
+ }
+ return rows, nil
+}
+
// CreateChannel creates a new IM channel and optionally starts it.
// Returns a duplicate_bot error if the bot identity is already used by another channel.
func (s *Service) CreateChannel(channel *IMChannel) error {
diff --git a/internal/router/router.go b/internal/router/router.go
index aa15a44c1..cd10ea689 100644
--- a/internal/router/router.go
+++ b/internal/router/router.go
@@ -676,6 +676,7 @@ func RegisterIMChannelRoutes(r *gin.RouterGroup, imHandler *handler.IMHandler) {
// Channel operations by channel ID
channels := r.Group("/im-channels")
{
+ channels.GET("", imHandler.ListAllIMChannels)
channels.PUT("/:id", imHandler.UpdateIMChannel)
channels.DELETE("/:id", imHandler.DeleteIMChannel)
channels.POST("/:id/toggle", imHandler.ToggleIMChannel)