fix: ghost session cleanup, new chat switching, and markdown overflow handling (#287)
This commit is contained in:
committed by
GitHub
Unverified
parent
89028756e1
commit
76df84e68c
@@ -346,9 +346,9 @@ function MessageBubble({
|
||||
)}
|
||||
>
|
||||
{isUser ? (
|
||||
<p className="whitespace-pre-wrap break-words text-sm">{text}</p>
|
||||
<p className="whitespace-pre-wrap break-words break-all text-sm">{text}</p>
|
||||
) : (
|
||||
<div className="prose prose-sm dark:prose-invert max-w-none">
|
||||
<div className="prose prose-sm dark:prose-invert max-w-none break-words break-all">
|
||||
<ReactMarkdown
|
||||
remarkPlugins={[remarkGfm]}
|
||||
components={{
|
||||
@@ -357,7 +357,7 @@ function MessageBubble({
|
||||
const isInline = !match && !className;
|
||||
if (isInline) {
|
||||
return (
|
||||
<code className="bg-background/50 px-1.5 py-0.5 rounded text-sm font-mono" {...props}>
|
||||
<code className="bg-background/50 px-1.5 py-0.5 rounded text-sm font-mono break-words break-all" {...props}>
|
||||
{children}
|
||||
</code>
|
||||
);
|
||||
@@ -372,7 +372,7 @@ function MessageBubble({
|
||||
},
|
||||
a({ href, children }) {
|
||||
return (
|
||||
<a href={href} target="_blank" rel="noopener noreferrer" className="text-primary hover:underline">
|
||||
<a href={href} target="_blank" rel="noopener noreferrer" className="text-primary hover:underline break-words break-all">
|
||||
{children}
|
||||
</a>
|
||||
);
|
||||
|
||||
@@ -35,6 +35,8 @@ export function Chat() {
|
||||
const abortRun = useChatStore((s) => s.abortRun);
|
||||
const clearError = useChatStore((s) => s.clearError);
|
||||
|
||||
const cleanupEmptySession = useChatStore((s) => s.cleanupEmptySession);
|
||||
|
||||
const messagesEndRef = useRef<HTMLDivElement>(null);
|
||||
const [streamingTimestamp, setStreamingTimestamp] = useState<number>(0);
|
||||
|
||||
@@ -54,8 +56,11 @@ export function Chat() {
|
||||
})();
|
||||
return () => {
|
||||
cancelled = true;
|
||||
// If the user navigates away without sending any messages, remove the
|
||||
// empty session so it doesn't linger as a ghost entry in the sidebar.
|
||||
cleanupEmptySession();
|
||||
};
|
||||
}, [isGatewayRunning, loadHistory, loadSessions]);
|
||||
}, [isGatewayRunning, loadHistory, loadSessions, cleanupEmptySession]);
|
||||
|
||||
// Auto-scroll on new messages, streaming, or activity changes
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user