Skip to content

CanvasAnvil is an open source AI diagram maker and flowchart generator - an infinite-canvas diagram editor and self-hosted drawio alternative that writes editable .drawio files. Text to diagram, then fix nodes, layout and labels in place. Also AI presentations, interior design CAD/BOM, posters and infographics.

flow_user_bubble_fix

codingFeng101219c04fc9e0e
diff --git a/src/workspaces/flow/next/components/chat-message-display.tsx b/src/workspaces/flow/next/components/chat-message-display.tsx
index dcd5428..3be24f1 100644
--- a/src/workspaces/flow/next/components/chat-message-display.tsx
+++ b/src/workspaces/flow/next/components/chat-message-display.tsx
@@ -1098,39 +1098,87 @@ export function ChatMessageDisplay({
sectionIndex,
) => {
// Regular text section
- return (
+ return message.role ===
+ "user" ? (
+ <div
+ key={`${message.id}-textsection-${partIndex}-${sectionIndex}`}
+ className="whitespace-pre-wrap break-words"
+ >
+ {section.content}
+ </div>
+ ) : (
<div
key={`${message.id}-textsection-${partIndex}-${sectionIndex}`}
className="prose prose-sm max-w-none break-words [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 dark:prose-invert"
>
<ReactMarkdown
components={{
- code({ inline, className, children, ...props }: any) {
- if (inline) {
+ code({
+ inline,
+ className,
+ children,
+ ...props
+ }: any) {
+ if (
+ inline
+ ) {
return (
- <code className={className} {...props}>
- {children}
+ <code
+ className={
+ className
+ }
+ {...props}
+ >
+ {
+ children
+ }
</code>
)
}
- const match = /language-(\w+)/.exec(String(className || ""))
- const lang = String(match?.[1] || "xml").toLowerCase()
- const codeText = String(children || "").replace(/\n$/, "")
- const normalizedLang: "xml" | "json" =
- lang === "json" ? "json" : "xml"
+ const match =
+ /language-(\w+)/.exec(
+ String(
+ className ||
+ "",
+ ),
+ )
+ const lang =
+ String(
+ match?.[1] ||
+ "xml",
+ ).toLowerCase()
+ const codeText =
+ String(
+ children ||
+ "",
+ ).replace(
+ /\n$/,
+ "",
+ )
+ const normalizedLang:
+ | "xml"
+ | "json" =
+ lang ===
+ "json"
+ ? "json"
+ : "xml"
return (
<CodeBlock
- code={codeText}
- language={normalizedLang}
- onApply={applyCodeToDiagram}
+ code={
+ codeText
+ }
+ language={
+ normalizedLang
+ }
+ onApply={
+ applyCodeToDiagram
+ }
/>
)
},
}}
>
- {
- section.content
- }
+ {section.content}
</ReactMarkdown>
</div>
)
diff --git a/src/workspaces/flow/next/components/chat-panel.tsx b/src/workspaces/flow/next/components/chat-panel.tsx
index 6c0c931..2a94881 100644
--- a/src/workspaces/flow/next/components/chat-panel.tsx
+++ b/src/workspaces/flow/next/components/chat-panel.tsx
@@ -1166,7 +1166,7 @@ Please fix the XML issues. Ensure you are editing exact lines from the current X
</header>
{/* Messages */}
- <main className="flex-1 w-full overflow-hidden">
+ <main className="flex-1 w-full overflow-hidden min-h-0">
<ChatMessageDisplay
messages={messages}
setInput={setInput}