Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
Resources: the type filter applies only while that type is on offer, as the Rooms filters do
Simon Flack6cf7d4e23a98
diff --git a/console/apps/switch-console-desktop/src/renderer/features/library/library-model.test.ts b/console/apps/switch-console-desktop/src/renderer/features/library/library-model.test.tsindex 6e168875d..83d3b3580 100644--- a/console/apps/switch-console-desktop/src/renderer/features/library/library-model.test.ts+++ b/console/apps/switch-console-desktop/src/renderer/features/library/library-model.test.ts@@ -6,6 +6,7 @@ import {filterLibraryItems,libraryPermissions,NO_LIBRARY_FILTER,+ offeredLibraryFilter,parseUrls,typeOptions,visibilityOf,@@ -103,6 +104,13 @@ describe('filterLibraryItems', () => {expect(filterLibraryItems(items, { ...NO_LIBRARY_FILTER, mineOnly: true }, null)).toEqual([]);});+ it('applies a type only while it is offered', () => {+ const picked = { ...NO_LIBRARY_FILTER, type: 'jira' };+ expect(offeredLibraryFilter(picked, [{ value: 'jira' }]).type).toBe('jira');+ expect(offeredLibraryFilter(picked, [{ value: 'github' }]).type).toBeNull();+ expect(offeredLibraryFilter(picked, []).type).toBeNull();+ });+it('offers each type once, by its name', () => {expect(typeOptions(items)).toEqual([{ value: 'github', label: 'GitHub' },diff --git a/console/apps/switch-console-desktop/src/renderer/features/library/library-model.ts b/console/apps/switch-console-desktop/src/renderer/features/library/library-model.tsindex 821708b8d..0e185053b 100644--- a/console/apps/switch-console-desktop/src/renderer/features/library/library-model.ts+++ b/console/apps/switch-console-desktop/src/renderer/features/library/library-model.ts@@ -94,6 +94,15 @@ export type LibraryFilter = {export const NO_LIBRARY_FILTER: LibraryFilter = { mineOnly: false, query: '', type: null };+/** `filter` with its type kept only if `types` still offers it. */+export function offeredLibraryFilter(+ filter: LibraryFilter,+ types: readonly { value: string }[]+): LibraryFilter {+ const offered = filter.type !== null && types.some((each) => each.value === filter.type);+ return { ...filter, type: offered ? filter.type : null };+}+/** The items the filter row lets through, by name. */export function filterLibraryItems(items: readonly LibraryItem[],diff --git a/console/apps/switch-console-desktop/src/renderer/features/library/library-view.tsx b/console/apps/switch-console-desktop/src/renderer/features/library/library-view.tsxindex 064dec0c9..652faa3b2 100644--- a/console/apps/switch-console-desktop/src/renderer/features/library/library-view.tsx+++ b/console/apps/switch-console-desktop/src/renderer/features/library/library-view.tsx@@ -24,6 +24,7 @@ import {KIND_TEXT,libraryPermissions,NO_LIBRARY_FILTER,+ offeredLibraryFilter,typeOptions,} from './library-model';import { libraryItemsKey } from './library-queries';@@ -78,8 +79,10 @@ const LibraryPanel = observer(function LibraryPanel() {const text = KIND_TEXT[kind];const all = items.data ?? [];const types = kind === 'references' ? typeOptions(all) : [];- // A type picked on References means nothing on Documents.- const applied = { ...filter, type: kind === 'references' ? filter.type : null };+ // A type applies only while it is on offer: not on Documents, and not once+ // the last reference of that type is gone (the filter would hide everything+ // with no option showing it is on), as the Rooms filters do.+ const applied = offeredLibraryFilter(filter, types);const shown = filterLibraryItems(all, applied, viewer.id);const filtering = applied.mineOnly || applied.query.trim() !== '' || applied.type !== null;