Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Merge origin/main into feat/inbox-every-plan

milind-sonie240d996a9ec
diff --cc src/state/inbox.ts
index 90d198a43d,92d64fc5b1..d6a41ffd17
--- a/src/state/inbox.ts
+++ b/src/state/inbox.ts
@@@ -100,10 -85,8 +101,10 @@@ export function doneInboxRow(row: Pick<
}
/** A reply to a line of news that waits on one: it goes back where the line came from, as a Reply in the chat does. */
-export async function replyToInboxRow(view: Pick<InboxView, "botId" | "threadId">, row: Pick<InboxRow, "id">, text: string): Promise<void> {
- await api(`/api/bots/${view.botId}/messages`, { method: "POST", body: JSON.stringify({ text, threadId: view.threadId, replyToId: row.id, sendId: randomUuid() }) });
+export async function replyToInboxRow(view: Pick<InboxView, "botId" | "threadId">, row: Pick<InboxRow, "id" | "origin">, text: string): Promise<void> {
+ const origin = view.threadId ? null : row.origin;
+ const path = origin?.groupId ? `/api/groups/${origin.groupId}/messages` : `/api/bots/${origin?.botId ?? view.botId}/messages`;
- await api(path, { method: "POST", body: JSON.stringify({ text, threadId: origin?.threadId ?? view.threadId, replyToId: row.id, sendId: crypto.randomUUID() }) });
++ await api(path, { method: "POST", body: JSON.stringify({ text, threadId: origin?.threadId ?? view.threadId, replyToId: row.id, sendId: randomUuid() }) });
void refreshInbox();
}