feat(frontend): add session source filter to sidebar (#1560)

IM-channel sessions were mixed in with the user's own chats. The sidebar
now defaults to web sessions; tenants with a configured IM channel get a
source switcher in the "对话" header to reach a specific platform.

- getSessionsList: optional `source` query param
- getMessageList: token-guarded loads (racing source switches / route
  changes can't append stale rows) + per-source pagination reset
- SourceSwitcherDropdown: scope dropdown mirroring KBSwitcherDropdown,
  scales to many platforms, reuses platform logos, closes on select
- empty state when a source has no sessions
- pure logic in sessionSourceFilter.ts with unit tests; zh/en/ko/ru i18n
This commit is contained in:
nullkey
2026-06-10 16:42:31 +08:00
committed by lyingbug
parent 232280d959
commit ac84dacc00
9 changed files with 398 additions and 8 deletions
+6 -2
View File
@@ -6,8 +6,12 @@ export async function createSessions(data = {}) {
return post("/api/v1/sessions", data);
}
export async function getSessionsList(page: number, page_size: number) {
return get(`/api/v1/sessions?page=${page}&page_size=${page_size}`);
export async function getSessionsList(page: number, page_size: number, source?: string) {
const params = new URLSearchParams({ page: String(page), page_size: String(page_size) });
if (source) {
params.set("source", source);
}
return get(`/api/v1/sessions?${params.toString()}`);
}
export async function pinSession(session_id: string) {