Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix: don't repeat the emoji when a reaction to an app card is replayed
AdityaUmale119fefbdcfcc
diff --git a/server/replies.test.ts b/server/replies.test.tsindex 8cad62ba7c..c940b510b1 100644--- a/server/replies.test.ts+++ b/server/replies.test.ts@@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";import { WIDGET_SAMPLES } from "../shared/widget-samples.ts";import { parseWidgetInput, widgetActions, widgetToText, type WidgetAction, type WidgetRoot } from "../shared/widget.ts";+import { cardRecords } from "./records-block.ts";import { promptWithReply, replyExcerpt, replyTargetIn, transcriptText, type ReplyTarget } from "./replies.ts";import type { Message } from "./store.ts";@@ -38,7 +39,7 @@ describe("the app's own add-a-key suggestion", () => {it("keeps the person's reaction, and stays a card the bot did not write when it is a widget", () => {const card = message({ kind: "widget", text: "Want me to sort your email for free? Add a key.", setupSuggestion: { kind: "helperKey" } });const reacted = message({ id: "m2", role: "user", text: "π", replyToId: "m1", reaction: "π" });- expect(transcriptText(reacted, new Map([["m1", card]]))).toMatch(/^\[reacted π to a card shown in this chat\]\n\[Records from a card shown/);+ expect(transcriptText(reacted, new Map([["m1", card]]))).toBe(`[reacted π to a card shown in this chat]\n${cardRecords(card.text)}`);const typed = promptWithReply("what is this?", card);expect(typed).toContain("a card shown to the person in this chat, which you did not write");expect(typed).not.toContain("a widget you showed");diff --git a/server/replies.ts b/server/replies.tsindex af680d3184..4941530f5f 100644--- a/server/replies.ts+++ b/server/replies.ts@@ -194,7 +194,7 @@ export function transcriptText(stored: Message, messagesById: ReadonlyMap<stringconst target = quoted ? { ...quoted, text: contextText(quoted) } : undefined;if (!target?.text) return message.text;const excerpt = replyExcerpt(target.text, 220);- if (appCard(target)) return `[${message.reaction ? `reacted ${message.reaction} to` : "answering"} a card shown in this chat]\n${cardRecords(excerpt)}\n${message.text}`;+ if (appCard(target)) return message.reaction ? `[reacted ${message.reaction} to a card shown in this chat]\n${cardRecords(excerpt)}` : `[answering a card shown in this chat]\n${cardRecords(excerpt)}\n${message.text}`;if (message.reaction) return `[reacted ${message.reaction} to ${replySpeaker(target, userName)}: β${excerpt}β]`;if (target.kind === "app") {return message.fromApp