mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
ui chat ui fixes (#8105)
This commit is contained in:
parent
31e967cbbd
commit
d10bd67d33
1 changed files with 8 additions and 6 deletions
|
@ -190,17 +190,19 @@ const ChatUI: React.FC<ChatUIProps> = ({
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
// Create message object without model field for API call
|
||||
const newUserMessage = { role: "user", content: inputMessage };
|
||||
|
||||
const updatedChatHistory = [...chatHistory, newUserMessage];
|
||||
// Create chat history for API call - strip out model field
|
||||
const apiChatHistory = [...chatHistory.map(({ role, content }) => ({ role, content })), newUserMessage];
|
||||
|
||||
setChatHistory(updatedChatHistory);
|
||||
// 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue