From d10bd67d33f9154137aa2091ea3f86175b63bb0c Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Wed, 29 Jan 2025 18:53:49 -0800 Subject: [PATCH] ui chat ui fixes (#8105) --- ui/litellm-dashboard/src/components/chat_ui.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ui/litellm-dashboard/src/components/chat_ui.tsx b/ui/litellm-dashboard/src/components/chat_ui.tsx index 1d5db13523..db4499f9ff 100644 --- a/ui/litellm-dashboard/src/components/chat_ui.tsx +++ b/ui/litellm-dashboard/src/components/chat_ui.tsx @@ -190,17 +190,19 @@ const ChatUI: React.FC = ({ return; } - + // Create message object without model field for API call const newUserMessage = { role: "user", content: inputMessage }; - - const updatedChatHistory = [...chatHistory, newUserMessage]; - - setChatHistory(updatedChatHistory); + + // Create chat history for API call - strip out model field + const apiChatHistory = [...chatHistory.map(({ role, content }) => ({ role, content })), newUserMessage]; + + // Update UI with full message object (including model field for display) + setChatHistory([...chatHistory, newUserMessage]); try { if (selectedModel) { await generateModelResponse( - updatedChatHistory, + apiChatHistory, (chunk, model) => updateUI("assistant", chunk, model), selectedModel, effectiveApiKey