diff --git a/ui/litellm-dashboard/src/components/chat/ChatPage.tsx b/ui/litellm-dashboard/src/components/chat/ChatPage.tsx index 169c17d29d9..fc9c4dd3448 100644 --- a/ui/litellm-dashboard/src/components/chat/ChatPage.tsx +++ b/ui/litellm-dashboard/src/components/chat/ChatPage.tsx @@ -139,10 +139,12 @@ const ChatPage: React.FC = ({ accessToken, userRole, userId, user abortControllerRef.current = new AbortController(); const history = [ - ...(activeConversation?.messages ?? []).map((m) => ({ - role: m.role as "user" | "assistant", - content: m.content, - })), + ...(activeConversation?.messages ?? []) + .filter((m) => m.role === "user" || m.role === "assistant") + .map((m) => ({ + role: m.role as "user" | "assistant", + content: m.content, + })), { role: "user" as const, content: trimmed }, ]; @@ -170,7 +172,7 @@ const ChatPage: React.FC = ({ accessToken, userRole, userId, user } catch (err: unknown) { if (err instanceof Error && err.name === "AbortError") { updateLastAssistantMessage(convId!, { - content: (activeConversation?.messages.at(-1)?.content ?? "") + " [stopped]", + content: accumulatedContent + " [stopped]", }); } else { updateLastAssistantMessage(convId!, { @@ -601,11 +603,12 @@ const ChatPage: React.FC = ({ accessToken, userRole, userId, user {isStreaming ? ( ) : (