Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Inbox panel: fewer comments, and the step after an answer without a lint override
milind-sonib14fd45ccc32
diff --git a/src/components/inbox/InboxAnswer.tsx b/src/components/inbox/InboxAnswer.tsxindex 3865fecbe9..ace30b8b7f 100644--- a/src/components/inbox/InboxAnswer.tsx+++ b/src/components/inbox/InboxAnswer.tsx@@ -1,6 +1,3 @@-// The "You" part of a line read in the inbox: how it is answered, chosen by the kind of card it carries. Each kind answers-// with what the chat already answers it with, through the same route, so one answer settles it on every surface. A new-// kind of card adds its kind in inbox-answer.ts and one entry here.import { useState, type ReactNode } from "react";import { Check, ExternalLink } from "lucide-react";import type { InboxRow, InboxView } from "../../../shared/inbox";@@ -31,7 +28,6 @@ function QuestionAnswer({ view, row, threadId, asker }: AnswerProps) {const { answer } = useInboxActions(view);const question = singleQuestion(row);if (!threadId) return null;- // A set of several questions keeps the chat's own card, with a tab for each.if (!question) return <QuestionCard threadId={threadId} asker={asker} message={asMessage(row)} />;return <InboxQuestionAnswer row={row} question={question} asker={asker}onAnswer={(response, failed) => { answer(row, response, failed); settleInboxRow(row); }} />;diff --git a/src/components/inbox/InboxPanel.tsx b/src/components/inbox/InboxPanel.tsxindex 0b98ff2d3d..f5b930250a 100644--- a/src/components/inbox/InboxPanel.tsx+++ b/src/components/inbox/InboxPanel.tsx@@ -1,6 +1,3 @@-// The person's whole inbox in the right panel, as a tab with its count: one list, newest first, a dot on what waits on them,-// a search over it, and each line read in full in the same place. A line answered there gives way to the next one, and to-// the list when none is left. At phone width it is a sheet over the chat.import { useEffect, useRef, useState, type KeyboardEvent } from "react";import { createPortal } from "react-dom";import { Inbox, Maximize2, Minimize2, Search, X } from "lucide-react";@@ -41,7 +38,6 @@ export function InboxPanel() {const ids = rows.map((row) => row.id);const at = reading ? ids.indexOf(reading.id) : -1;- // The list as it stood while the line was in it, so the step after an answer goes to the line that was below it.const order = useRef<string[]>([]);if (at >= 0) order.current = ids;const waited = useRef<string | null>(null);@@ -54,9 +50,7 @@ export function InboxPanel() {const row = next ? view?.rows.find((one) => one.id === next) : undefined;if (row) readInboxRow(row);readInboxLine(row ? row.id : null);- // Only the line read and whether it settled move it on; the list itself is read through the ref.- // eslint-disable-next-line react-hooks/exhaustive-deps- }, [reading?.id, reading?.tab]);+ }, [reading, ids, view]);const step = (by: -1 | 1) => {const row = rows[at + by];diff --git a/src/components/inbox/InboxQuestionAnswer.tsx b/src/components/inbox/InboxQuestionAnswer.tsxindex 3993d4d536..efd5554ee9 100644--- a/src/components/inbox/InboxQuestionAnswer.tsx+++ b/src/components/inbox/InboxQuestionAnswer.tsx@@ -1,6 +1,3 @@-// A question read in the inbox, answered there: its choices as cards to tick, each with what it means and the bot's-// recommendation marked, a note of the person's own, and send. Number keys tick a choice, × closes it unanswered. The-// answer goes where it was asked, through the same route as the chat's card, so it settles there and everywhere.import { useEffect, useState } from "react";import { ArrowUp, Check, LoaderCircle, X } from "lucide-react";import { formatQuestionAnswers, MAX_CUSTOM_ANSWER, type AskQuestion } from "../../../shared/ask-question";@@ -13,11 +10,8 @@ import { cardAnswerFor } from "../bot-access/access-card";import { recommendedOf } from "./inbox-answer";import { closeResponse } from "./inbox-view";-/** Most choices a number key reaches. */const KEYED_CHOICES = 9;-/** What sending the ticked choices and the note answers: the chat card's own words for a provider's question set, the- * choice as offered for a card's own, and the note after it. */export function questionResponse(row: InboxRow, question: AskQuestion, picked: readonly string[], note: string): CardResponse | null {const words = note.trim();if (!picked.length && !words) return null;diff --git a/src/components/inbox/InboxReading.tsx b/src/components/inbox/InboxReading.tsxindex 28514df760..01273a7a48 100644--- a/src/components/inbox/InboxReading.tsx+++ b/src/components/inbox/InboxReading.tsx@@ -1,6 +1,3 @@-// One line of the inbox read in full inside the panel. A bar with the way back, where it is in the list with a step up and-// down, and a menu; where it came from and what it is about; the bot's words in context as the chat draws them; then the-// person's part, answered with what its kind of card answers with (InboxAnswer).import { Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, ExternalLink, MoreHorizontal, UserRound, X } from "lucide-react";import type { InboxRow, InboxView } from "../../../shared/inbox";import { t } from "@/lib/i18n";diff --git a/src/components/inbox/InboxRow.tsx b/src/components/inbox/InboxRow.tsxindex ace7e147bd..4eac681b08 100644--- a/src/components/inbox/InboxRow.tsx+++ b/src/components/inbox/InboxRow.tsx@@ -1,6 +1,3 @@-// One line of the person's inbox as a dense row: a dot while it waits on them or is unread, the sender's face, who it is-// from and where, the time, what it is about in bold, and for a question its choices on one line, the recommended one-// marked. On hover or keyboard focus the time gives way to the row's quick actions.import { Check, CornerUpLeft, ExternalLink, Split, X, type LucideIcon } from "lucide-react";import type { InboxRow } from "../../../shared/inbox";import { cn } from "@/lib/cn";diff --git a/src/components/inbox/inbox-answer.ts b/src/components/inbox/inbox-answer.tsindex c525874372..a2e381b642 100644--- a/src/components/inbox/inbox-answer.ts+++ b/src/components/inbox/inbox-answer.ts@@ -1,5 +1,3 @@-// What a line of the inbox is answered with, by the kind of card it carries, and the words its row and reading view show.-// A new kind of card adds a kind here and its answer in InboxAnswer, and every row and reading view picks it up.import type { AskQuestion } from "../../../shared/ask-question";import type { InboxRow } from "../../../shared/inbox";import { t } from "@/lib/i18n";diff --git a/src/components/inbox/use-ask-context.ts b/src/components/inbox/use-ask-context.tsindex fc35c0c5a3..5e5ad28b81 100644--- a/src/components/inbox/use-ask-context.ts+++ b/src/components/inbox/use-ask-context.ts@@ -1,14 +1,10 @@-// What the bot said just before a line of the inbox, read from the conversation it came from, so the line reads in context:-// its words since the person last wrote there. Nothing when that conversation can't be read; the line still reads alone.import { useEffect, useState } from "react";import type { InboxRow } from "../../../shared/inbox";import type { Message } from "@/state/store";import { api } from "@/state/api";-/** How far back the reading view looks for the bot's words before the line. */const CONTEXT_PAGE = 8;-/** The bot's own words before the line, since the person last wrote: what a question or a report builds on. */export function contextBefore(messages: readonly Message[]): Message[] {const out: Message[] = [];for (let index = messages.length - 1; index >= 0; index--) {