remove tool count (#2158)
This commit is contained in:
@@ -7,7 +7,6 @@ import type { View } from '../App';
|
|||||||
import { settingsV2Enabled } from '../flags';
|
import { settingsV2Enabled } from '../flags';
|
||||||
import { BottomMenuModeSelection } from './BottomMenuModeSelection';
|
import { BottomMenuModeSelection } from './BottomMenuModeSelection';
|
||||||
import ModelsBottomBar from './settings_v2/models/bottom_bar/ModelsBottomBar';
|
import ModelsBottomBar from './settings_v2/models/bottom_bar/ModelsBottomBar';
|
||||||
import ToolCount from './ToolCount';
|
|
||||||
|
|
||||||
export default function BottomMenu({
|
export default function BottomMenu({
|
||||||
hasMessages,
|
hasMessages,
|
||||||
@@ -79,8 +78,6 @@ export default function BottomMenu({
|
|||||||
|
|
||||||
{/* Right-side section with ToolCount and Model Selector together */}
|
{/* Right-side section with ToolCount and Model Selector together */}
|
||||||
<div className="flex items-center mr-4 space-x-1">
|
<div className="flex items-center mr-4 space-x-1">
|
||||||
{/* Tool count */}
|
|
||||||
<ToolCount />
|
|
||||||
{/* Model Selector Dropdown */}
|
{/* Model Selector Dropdown */}
|
||||||
{settingsV2Enabled ? (
|
{settingsV2Enabled ? (
|
||||||
<ModelsBottomBar dropdownRef={dropdownRef} setView={setView} />
|
<ModelsBottomBar dropdownRef={dropdownRef} setView={setView} />
|
||||||
|
|||||||
@@ -1,62 +0,0 @@
|
|||||||
import { useState, useEffect } from 'react';
|
|
||||||
import { getTools } from '../api';
|
|
||||||
import { ExclamationTriangleIcon } from '@radix-ui/react-icons';
|
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from './ui/popover';
|
|
||||||
|
|
||||||
const SUGGESTED_MAX_TOOLS = 24;
|
|
||||||
|
|
||||||
export default function ToolCount() {
|
|
||||||
const [toolCount, setToolCount] = useState(null);
|
|
||||||
const [error, setError] = useState(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const fetchTools = async () => {
|
|
||||||
try {
|
|
||||||
const response = await getTools();
|
|
||||||
if (response.error) {
|
|
||||||
console.error('failed to get tool count');
|
|
||||||
setError(true);
|
|
||||||
} else {
|
|
||||||
setToolCount(response.data.length);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching tools:', err);
|
|
||||||
setError(true);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
fetchTools();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
return <div></div>;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (toolCount === null) {
|
|
||||||
return <div>...</div>;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (toolCount > SUGGESTED_MAX_TOOLS) {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<Popover>
|
|
||||||
<PopoverTrigger asChild>
|
|
||||||
<button className="flex items-center justify-center p-0 border-0 bg-transparent cursor-pointer">
|
|
||||||
<ExclamationTriangleIcon color="orange" />
|
|
||||||
</button>
|
|
||||||
</PopoverTrigger>
|
|
||||||
<PopoverContent className="p-3 bg-orangit ge-500 " side="top">
|
|
||||||
<div className="space-y-2">
|
|
||||||
<p className="text-xs text-gray-300">
|
|
||||||
Too many tools can degrade goose's performance. Consider turning unused extensions
|
|
||||||
off. Tool count: {toolCount} (recommend: {SUGGESTED_MAX_TOOLS})
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</PopoverContent>
|
|
||||||
</Popover>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return <div></div>;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user