diff --git a/src/components/ChatInterface.tsx b/src/components/ChatInterface.tsx index 74b7af5..2117db1 100644 --- a/src/components/ChatInterface.tsx +++ b/src/components/ChatInterface.tsx @@ -16,7 +16,12 @@ export function ChatInterface() { getAgentLoopState, } = useConversation(); - const { provider: currentProvider } = useInference(); + const { + models, + selectedModel, + selectModel, + isAuthenticated + } = useInference(); const [isLoading, setIsLoading] = useState(false); const messagesEndRef = useRef(null); @@ -29,7 +34,7 @@ export function ChatInterface() { }, [activeConversation?.messages]); const handleSendMessage = async (content: string) => { - if (!activeConversationId || !currentProvider?.isAuthenticated) { + if (!activeConversationId || !isAuthenticated) { return; } @@ -65,7 +70,7 @@ export function ChatInterface() { } // Show auth prompt if not authenticated - if (!currentProvider?.isAuthenticated) { + if (!isAuthenticated) { return (
@@ -80,13 +85,28 @@ export function ChatInterface() { {/* Chat Header */}
-
+

{activeConversation.title}

-

- Model: {currentProvider.selectedModel?.name || 'None selected'} -

+
+ + Model: + + +
{isGenerating && ( diff --git a/src/components/ConversationApp.tsx b/src/components/ConversationApp.tsx index 0463e89..7e93758 100644 --- a/src/components/ConversationApp.tsx +++ b/src/components/ConversationApp.tsx @@ -11,7 +11,7 @@ export function ConversationApp() { return ( -
+
{/* Left Sidebar - Conversations */}
diff --git a/src/components/MCPTest.tsx b/src/components/MCPTest.tsx index aa905a8..a04d943 100644 --- a/src/components/MCPTest.tsx +++ b/src/components/MCPTest.tsx @@ -32,8 +32,17 @@ export function MCPTest() { return; } + const trimmedName = newServerName.trim(); + + // Check for duplicate server names + const existingServer = connections.find(conn => conn.name === trimmedName); + if (existingServer) { + alert(`A server with the name "${trimmedName}" already exists. Please choose a different name.`); + return; + } + const config: MCPServerConfig = { - name: newServerName.trim(), + name: trimmedName, url: newServerUrl.trim(), transport: 'auto', authType: 'none', @@ -48,7 +57,7 @@ export function MCPTest() { console.error('Failed to add server:', error); alert(`Failed to add server: ${error instanceof Error ? error.message : 'Unknown error'}`); } - }, [newServerName, newServerUrl, addMcpServer]); + }, [newServerName, newServerUrl, addMcpServer, connections]); const handleAddServerWithOAuth = useCallback(async () => { if (!newServerName.trim() || !newServerUrl.trim()) { @@ -56,8 +65,17 @@ export function MCPTest() { return; } + const trimmedName = newServerName.trim(); + + // Check for duplicate server names + const existingServer = connections.find(conn => conn.name === trimmedName); + if (existingServer) { + alert(`A server with the name "${trimmedName}" already exists. Please choose a different name.`); + return; + } + const config: MCPServerConfig = { - name: newServerName.trim(), + name: trimmedName, url: newServerUrl.trim(), transport: 'auto', authType: 'oauth', @@ -72,7 +90,7 @@ export function MCPTest() { console.error('Failed to add server with OAuth:', error); alert(`Failed to add server with OAuth: ${error instanceof Error ? error.message : 'Unknown error'}`); } - }, [newServerName, newServerUrl, addMcpServer]); + }, [newServerName, newServerUrl, addMcpServer, connections]); const handleRemoveServer = useCallback((connectionId: string) => { if (confirm('Are you sure you want to remove this server?')) { @@ -151,6 +169,36 @@ export function MCPTest() { Add MCP Server + {/* Quick Add Examples */} +
+

+ Quick Add Examples +

+
+ + +
+

+ Click to auto-fill common server configurations +

+
+