forked from dyad-sh/dyad
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChatInputControls.tsx
More file actions
40 lines (37 loc) · 1.26 KB
/
Copy pathChatInputControls.tsx
File metadata and controls
40 lines (37 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { ContextFilesPicker } from "./ContextFilesPicker";
import { ModelPicker } from "./ModelPicker";
import { ProModeSelector } from "./ProModeSelector";
import { ChatModeSelector } from "./ChatModeSelector";
import { McpToolsPicker } from "@/components/McpToolsPicker";
import { useSettings } from "@/hooks/useSettings";
import { useMcp } from "@/hooks/useMcp";
export function ChatInputControls({
showContextFilesPicker = false,
}: {
showContextFilesPicker?: boolean;
}) {
const { settings } = useSettings();
const { servers } = useMcp();
const enabledMcpServersCount = servers.filter((s) => s.enabled).length;
// Show MCP tools picker when:
// 1. Mode is "agent" (backwards compatibility) OR
// 2. Mode is "build" AND there are enabled MCP servers
const showMcpToolsPicker =
settings?.selectedChatMode === "agent" ||
(settings?.selectedChatMode === "build" && enabledMcpServersCount > 0);
return (
<div className="flex items-center">
<ChatModeSelector />
{showMcpToolsPicker && (
<>
<div className="w-1.5"></div>
<McpToolsPicker />
</>
)}
<div className="w-1.5"></div>
<ModelPicker />
<ProModeSelector />
{showContextFilesPicker && <ContextFilesPicker />}
</div>
);
}