Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(ui): prevent chat bubble overflow on long file paths and chips
frank8ai67f085195abb
diff --git a/src/components/AttachmentPreview.tsx b/src/components/AttachmentPreview.tsxindex a47336a2c1..d73e5bafdf 100644--- a/src/components/AttachmentPreview.tsx+++ b/src/components/AttachmentPreview.tsx@@ -373,13 +373,13 @@ function MessageFolderFile({ folderPath, name, bytes, message }: {}) {const save = useLocalFileSave(folderPath, name, message, name);return (- <li className="flex min-w-0 flex-wrap items-center gap-x-1.5">+ <li className="flex min-w-0 max-w-full flex-wrap items-center gap-x-1.5"><buttontype="button"onClick={() => void save.save()}disabled={save.state === "saving"}aria-label={t("attach.saveAria", { name })}- className="inline-flex min-h-8 min-w-0 items-center gap-1 break-all text-start text-accent underline decoration-accent/40 hover:decoration-accent disabled:cursor-wait"+ className="inline-flex min-h-8 min-w-0 max-w-full items-center gap-1 break-all text-start text-accent underline decoration-accent/40 hover:decoration-accent disabled:cursor-wait">{save.state === "saving" ? (<LoaderCircle size={12} className="shrink-0 animate-spin" aria-hidden="true" />@@ -390,7 +390,7 @@ function MessageFolderFile({ folderPath, name, bytes, message }: {)}{name}</button>- <span className="text-ink-secondary">{folderFileSize(bytes)}</span>+ <span className="shrink-0 text-ink-secondary">{folderFileSize(bytes)}</span>{save.state === "failed" && <span role="alert" className="text-danger">{save.reason}</span>}</li>);@@ -439,7 +439,7 @@ export function OutsideWorkspaceFile({ filePath, standalone = false }: { filePattype="button"onClick={() => void show()}title={filePath}- className={standalone ? "ui-button touch:min-h-10" : "inline-flex items-center gap-1 text-accent underline decoration-accent/40 hover:decoration-accent"}+ className={standalone ? "ui-button touch:min-h-10" : "inline-flex max-w-full min-w-0 items-center gap-1 text-accent underline decoration-accent/40 hover:decoration-accent"}><FolderOpen size={standalone ? 14 : 12} className="shrink-0" aria-hidden="true" />{t("attach.showInFolder")}@@ -905,7 +905,7 @@ export function AttachedFileChip({ file, message, linked = false, compact = falsreturn (<divtitle={save.state === "saved" && save.savedTo ? t("attach.savedTo", { path: save.savedTo }) : file.name}- className={cn("max-w-[280px] overflow-hidden rounded-lg border border-hairline/40 bg-inset/70 text-[12px] text-ink-secondary", className)}+ className={cn("w-full max-w-full sm:max-w-[280px] overflow-hidden rounded-lg border border-hairline/40 bg-inset/70 text-[12px] text-ink-secondary", className)}><div className="flex items-center pe-1"><button@@ -952,7 +952,7 @@ export function AttachedFileChip({ file, message, linked = false, compact = fals);}-const FILE_CHIP = "inline-flex h-7 max-w-[16rem] items-center rounded-full bg-ink/[0.06] text-[13px] leading-none text-ink-secondary";+const FILE_CHIP = "inline-flex h-7 max-w-full sm:max-w-[16rem] items-center rounded-full bg-ink/[0.06] text-[13px] leading-none text-ink-secondary";function CompactFileChip({ file, message, linked, save, preview, className }: {file: TranscriptFileAttachment & { shownPath?: string };@@ -982,7 +982,7 @@ function CompactFileChip({ file, message, linked, save, preview, className }: {<buttontype="button"{...chipNameAction(preview, save, file.name, save.retryable)}- className="inline-flex h-7 min-w-0 items-center gap-1.5 rounded-full ps-2.5 pe-2 transition-colors hover:bg-ink/[0.06] hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus disabled:cursor-wait"+ className="inline-flex h-7 min-w-0 max-w-full items-center gap-1.5 rounded-full ps-2.5 pe-2 transition-colors hover:bg-ink/[0.06] hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus disabled:cursor-wait"><FileText size={14} className="shrink-0" aria-hidden="true" />{name}diff --git a/src/components/ChatMarkdown.test.ts b/src/components/ChatMarkdown.test.tsindex cdb2f146c3..52919f4a29 100644--- a/src/components/ChatMarkdown.test.ts+++ b/src/components/ChatMarkdown.test.ts@@ -840,7 +840,19 @@ describe("ChatMarkdown attachments", () => {expect(html).toContain('title="Preview page: 100%41 report.html"');});- it("names a delivered copy by its literal file name, without decoding it", () => {+ it("constrains long file paths to max-w-full and applies break-all to prevent bubble overflow", () => {+ const longPath = "C:\\Users\\frank\\Documents\\Playground\\ObsidianVault\\Projects\\autofabric\\research\\paper\\formal_verification_receipt.json";+ const html = renderToStaticMarkup(createElement(ChatMarkdown, {+ text: "已保存到 `" + longPath + "`",+ message: { threadId: "thread-1", messageId: "message-1" },+ }));+ expect(html).toContain("max-w-full");+ expect(html).toContain("min-w-0");+ expect(html).toContain("break-all");+ expect(html).toContain("shrink-0");+ });++ it("names a delivered copy by its literal file name, without decoding it", () => {const html = renderToStaticMarkup(createElement(ChatMarkdown, {text: "[Report](/old/100%41.html)", message: { threadId: "thread-1", messageId: "message-1" },delivered: { "100%41.html": "/store/delivered-100.html" },diff --git a/src/components/ChatMarkdown.tsx b/src/components/ChatMarkdown.tsxindex 051f9d06b1..8cdb6899be 100644--- a/src/components/ChatMarkdown.tsx+++ b/src/components/ChatMarkdown.tsx@@ -371,7 +371,7 @@ function LocalFileLink({ filePath, shownPath, shownName, name, source, children,const revealOnClick = fileOutsideWorkspace === true && canRevealHostPath(shownPath) && revealHere;const [revealProblem, setRevealProblem] = useState("");if (!message) {- return <span title={t("chat.file.legacy")} className="break-words text-ink-secondary">{children}</span>;+ return <span title={t("chat.file.legacy")} className="max-w-full min-w-0 break-all [overflow-wrap:anywhere] text-ink-secondary">{children}</span>;}// Only the desktop app probes; elsewhere the hook stays null and the link must stay usable.const probing = revealHere && canRevealHostPath(filePath) && fileOutsideWorkspace === null;@@ -399,7 +399,7 @@ function LocalFileLink({ filePath, shownPath, shownName, name, source, children,const pathTitle = preview.opens ? preview.label : revealOnClick ? t("attach.showInFolder") : t("chat.file.saveCopy");return (- <span dir="ltr" className="inline-flex flex-wrap items-center gap-x-1.5 [unicode-bidi:isolate]" {...revealMenu.targetProps(source)}>+ <span dir="ltr" className="inline-flex max-w-full min-w-0 flex-wrap items-center gap-x-1.5 [unicode-bidi:isolate]" {...revealMenu.targetProps(source)}>{revealMenu.menu}{preview.opens? <SaveIconButton name={shownName} save={save} retryable={save.retryable} />@@ -409,9 +409,9 @@ function LocalFileLink({ filePath, shownPath, shownName, name, source, children,onClick={(event) => void pathAction(event)}disabled={!preview.opens && (save.state === "saving" || probing)}title={pathTitle}- className="inline-flex items-center gap-1 break-words text-start text-accent underline decoration-accent/40 hover:decoration-accent disabled:cursor-wait"+ className="inline-flex max-w-full min-w-0 items-center gap-1 break-all [overflow-wrap:anywhere] text-start text-accent underline decoration-accent/40 hover:decoration-accent disabled:cursor-wait">- {children}+ <span className="min-w-0 flex-1 break-all [overflow-wrap:anywhere]">{children}</span>{preview.opens ? (<Eye size={12} className="shrink-0" aria-hidden="true" />) : probing ? (@@ -439,7 +439,7 @@ function LocalFileLink({ filePath, shownPath, shownName, name, source, children,</span>)}{save.state === "failed" && save.outsideWorkspace && !revealOnClick && (- <span className="inline-flex flex-wrap items-center gap-x-1.5 text-[12px]">+ <span className="inline-flex max-w-full min-w-0 flex-wrap items-center gap-x-1.5 text-[12px]"><OutsideWorkspaceFile filePath={shownPath} /></span>)}diff --git a/src/styles.css b/src/styles.cssindex 51ffa1f8fa..c193e37cca 100644--- a/src/styles.css+++ b/src/styles.css@@ -1575,6 +1575,10 @@ body {line-height: 1;-webkit-box-decoration-break: clone;box-decoration-break: clone;+ max-width: 100%;+ overflow-wrap: anywhere;+ word-break: break-all;+ box-sizing: border-box;}/* One row of a popover menu: 30px, 14px, icon then label. */.ui-menu-row {