Skip to content

Commit

Permalink
🐛 fix: fix search web-browsing display bug (lobehub#6653)
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx authored Mar 3, 2025
1 parent 53f20f5 commit f472643
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/store/tool/slices/builtin/selectors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ describe('builtinToolSelectors', () => {
]);
});

it('should hide tool when not need visible with hidden', () => {
const state = {
...initialState,
builtinTools: [
{ identifier: 'tool-1', hidden: true, manifest: { meta: { title: 'Tool 1' } } },
{ identifier: DalleManifest.identifier, manifest: { meta: { title: 'Dalle' } } },
],
} as ToolStoreState;
const result = builtinToolSelectors.metaList(false)(state);
expect(result).toEqual([]);
});

it('should return an empty list if no builtin tools are available', () => {
const state: ToolStoreState = {
...initialState,
Expand Down
5 changes: 4 additions & 1 deletion src/store/tool/slices/builtin/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ const metaList =
(showDalle?: boolean) =>
(s: ToolStoreState): LobeToolMeta[] =>
s.builtinTools
.filter((item) => (!showDalle ? item.identifier !== DalleManifest.identifier : !item.hidden))
.filter(
(item) =>
!item.hidden && (!showDalle ? item.identifier !== DalleManifest.identifier : true),
)
.map((t) => ({
author: 'LobeHub',
identifier: t.identifier,
Expand Down

0 comments on commit f472643

Please sign in to comment.