Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

fix(web): widen rich bot output (#72)

Leo51ee2333fa4c
diff --git a/apps/web/src/components/ChatMarkdown.test.tsx b/apps/web/src/components/ChatMarkdown.test.tsx
index 4594444bc..e0441a252 100644
--- a/apps/web/src/components/ChatMarkdown.test.tsx
+++ b/apps/web/src/components/ChatMarkdown.test.tsx
@@ -201,6 +201,39 @@ describe("orderedListGutterStyle", () => {
});
describe("ChatMarkdown rich formatting", () => {
+ it("renders bot assistant artifacts", () => {
+ const html = renderToStaticMarkup(
+ <ChatMarkdown
+ cwd="/tmp/project"
+ text={[
+ "| File | State |",
+ "| --- | --- |",
+ "| src/output.ts | Ready |",
+ "",
+ "- [x] Render table",
+ "- [ ] Review diff",
+ "",
+ "```diff",
+ "-const state = 'plain';",
+ "+const state = 'rich';",
+ "```",
+ "",
+ '```ts title="src/generated.ts"',
+ "export const ready = true;",
+ "```",
+ ].join("\n")}
+ />,
+ );
+
+ expect(html).toContain("chat-markdown-table-container");
+ expect(html.match(/type="checkbox"/g)).toHaveLength(2);
+ expect(html.match(/disabled=""/g)).toHaveLength(2);
+ expect(html.match(/readOnly=""/g)).toHaveLength(2);
+ expect(html).toContain('data-language="diff"');
+ expect(html).toContain('data-language="ts"');
+ expect(html).toContain("src/generated.ts");
+ });
+
it("renders inline and display math", () => {
const html = renderToStaticMarkup(
<ChatMarkdown
diff --git a/apps/web/src/components/roster/BotThreadLanding.markdown.test.ts b/apps/web/src/components/roster/BotThreadLanding.markdown.test.ts
index 40ae80bfb..d0d0e4b6d 100644
--- a/apps/web/src/components/roster/BotThreadLanding.markdown.test.ts
+++ b/apps/web/src/components/roster/BotThreadLanding.markdown.test.ts
@@ -5,15 +5,25 @@ import { describe, expect, it } from "vite-plus/test";
describe("BotThreadLanding message formatting", () => {
it("renders assistant messages with the shared rich markdown component", () => {
- const sources = ["BotThreadLanding.tsx", "GroupThreadLanding.tsx"].map((file) =>
- NodeFS.readFileSync(new URL(`./${file}`, import.meta.url), "utf8"),
- );
+ const entries = [
+ ["BotThreadLanding.tsx", "bot-provider-message", "bot-user-message"],
+ ["GroupThreadLanding.tsx", "group-provider-message", "group-user-message"],
+ ] as const;
+
+ for (const [file, assistantTestId, userTestId] of entries) {
+ const source = NodeFS.readFileSync(new URL(`./${file}`, import.meta.url), "utf8");
+ const assistantStart = source.indexOf(`data-testid="${assistantTestId}"`);
+ const userStart = source.indexOf(`data-testid="${userTestId}"`, assistantStart);
+ const assistantSource = source.slice(assistantStart, userStart);
- for (const source of sources) {
- expect(source).toContain('import ChatMarkdown from "../ChatMarkdown"');
- expect(source).toContain("<ChatMarkdown");
- expect(source).toContain("cwd={runtime.defaultProject?.workspaceRoot}");
- expect(source).toContain("threadRef={runtime.linkedThreadRef ?? undefined}");
+ expect(assistantStart).toBeGreaterThan(-1);
+ expect(userStart).toBeGreaterThan(assistantStart);
+ expect(assistantSource).toContain("<ChatMarkdown");
+ expect(assistantSource).toContain("cwd={runtime.defaultProject?.workspaceRoot}");
+ expect(assistantSource).toContain("threadRef={runtime.linkedThreadRef ?? undefined}");
+ expect(assistantSource).toContain('className="min-w-0 flex-1"');
+ expect(assistantSource).not.toContain("onTaskListChange");
+ expect(source.slice(userStart)).toContain('className="whitespace-pre-wrap"');
}
});
diff --git a/apps/web/src/components/roster/BotThreadLanding.tsx b/apps/web/src/components/roster/BotThreadLanding.tsx
index e4734f341..07fce0cf9 100644
--- a/apps/web/src/components/roster/BotThreadLanding.tsx
+++ b/apps/web/src/components/roster/BotThreadLanding.tsx
@@ -150,7 +150,7 @@ export function BotThreadLanding({ botId }: { readonly botId: string }) {
name={bot.name}
className="mt-0.5 size-7 shrink-0"
/>
- <div className="min-w-0 max-w-[85%]">
+ <div className="min-w-0 flex-1">
<div className="text-sm font-medium">{bot.name}</div>
<ChatMarkdown
className="mt-1"
diff --git a/apps/web/src/components/roster/GroupThreadLanding.tsx b/apps/web/src/components/roster/GroupThreadLanding.tsx
index 357e50a7c..67e944911 100644
--- a/apps/web/src/components/roster/GroupThreadLanding.tsx
+++ b/apps/web/src/components/roster/GroupThreadLanding.tsx
@@ -104,7 +104,7 @@ export function GroupThreadLanding({ groupId }: { readonly groupId: string }) {
name={respondingBot.name}
className="mt-0.5 size-7 shrink-0"
/>
- <div className="min-w-0 max-w-[85%]">
+ <div className="min-w-0 flex-1">
<div className="text-sm font-medium">{respondingBot.name}</div>
<ChatMarkdown
className="mt-1"