Skip to content

Open source CapCut alternative.

TypeScript

site/donkeyvision: tighten API copy and render inline code chips

David Le8c150061fc93
diff --git a/site/src/app/donkeyvision/ApiReference.tsx b/site/src/app/donkeyvision/ApiReference.tsx
index 21a6ea25..163c4ae3 100644
--- a/site/src/app/donkeyvision/ApiReference.tsx
+++ b/site/src/app/donkeyvision/ApiReference.tsx
@@ -11,7 +11,7 @@ import {
RESPONSE_SAMPLE,
type ApiField,
} from "@/app/donkeyvision/apiContract";
-import { HighlightedCode } from "@/app/donkeyvision/codeHighlight";
+import { HighlightedCode, InlineMarkup } from "@/app/donkeyvision/codeHighlight";
function CopyButton({ value, label }: { value: string; label: string }) {
const [copied, setCopied] = useState(false);
@@ -125,7 +125,7 @@ function FieldList({ fields }: { fields: ApiField[] }) {
</span>
</dt>
<dd className="mt-1 text-sm leading-6 text-[#555]">
- {field.description}
+ <InlineMarkup text={field.description} />
</dd>
</div>
))}
@@ -147,9 +147,9 @@ export function ApiReference() {
</code>
</div>
<p className="shrink-0 text-sm text-[#555]">
- Authenticate with{" "}
+ Auth:{" "}
<code className="rounded bg-[#0F0E0D]/8 px-1.5 py-0.5 font-mono text-[0.85em] text-[#0F0E0D]">
- Authorization: Bearer dk_live_…
+ Authorization: Bearer dk_live_...
</code>
</p>
</div>
@@ -161,11 +161,11 @@ export function ApiReference() {
Request
</h3>
<p className="mt-2 text-sm leading-6 text-[#555]">
- Send your screenshot as base64. Add an{" "}
+ Submit a base64 screenshot. Add an optional{" "}
<code className="rounded bg-[#0F0E0D]/8 px-1 py-0.5 font-mono text-[0.85em] text-[#0F0E0D]">
instruction
</code>{" "}
- and you also get back the one spot to click.
+ to return a matching click target.
</p>
<div className="mt-4">
<RequestExamples />
@@ -184,8 +184,8 @@ export function ApiReference() {
Response
</h3>
<p className="mt-2 text-sm leading-6 text-[#555]">
- The numbers are pixels in the screenshot you sent, counted from the
- top-left corner. You can click them right away.
+ Coordinates are pixel values from the submitted screenshot, measured
+ from the top-left corner.
</p>
<div className="mt-4">
<ResponseExample />
diff --git a/site/src/app/donkeyvision/ApiSection.tsx b/site/src/app/donkeyvision/ApiSection.tsx
index 3ba843d6..89e595a9 100644
--- a/site/src/app/donkeyvision/ApiSection.tsx
+++ b/site/src/app/donkeyvision/ApiSection.tsx
@@ -1,4 +1,5 @@
import { ApiReference } from "@/app/donkeyvision/ApiReference";
+import { InlineMarkup } from "@/app/donkeyvision/codeHighlight";
import { features } from "@/app/donkeyvision/data";
import type { Feature } from "@/app/donkeyvision/types";
@@ -9,23 +10,23 @@ type FeatureLineProps = {
export function ApiSection() {
return (
<section
- className="border-b-2 border-[#0F0E0D] bg-[#FAF6EC] px-6 py-20 md:px-12"
+ className="border-b-2 border-[#0F0E0D] bg-[#FAF6EC] py-20"
id="api"
>
- <div className="mx-auto max-w-[1400px]">
+ <div className="mx-auto max-w-[1400px] px-6 md:px-12">
<div className="max-w-3xl">
<h2 className="text-4xl font-semibold leading-none md:text-6xl">
- Here&rsquo;s how the API works.
+ How the API works
</h2>
<p className="mt-6 text-lg leading-8 text-[#454545]">
- Send a screenshot to <Code>/parse</Code>. The response is a list of
- detected UI elements with IDs, labels, types, boxes, center points,
- and confidence scores.
+ Send a screenshot to <Code>/api/inference/vision</Code>. The response
+ includes detected UI elements with IDs, labels, types, bounding
+ boxes, center points, and confidence scores.
</p>
<p className="mt-4 text-lg leading-8 text-[#454545]">
- You can also send a text prompt, like{" "}
- <Code>click the play button</Code>, and get back the exact region to
- click. Use your choice of LLM: ChatGPT, Claude, Gemini, or a custom
+ Add an optional text instruction, such as{" "}
+ <Code>click the play button</Code>, to return the matching click
+ target. Model selection supports ChatGPT, Claude, Gemini, or a custom
model.
</p>
</div>
@@ -55,7 +56,7 @@ function FeatureLine({ feature }: FeatureLineProps) {
<div>
<h3 className="text-base font-semibold">{feature.title}</h3>
<p className="mt-1 text-sm leading-6 text-[#555]">
- {feature.description}
+ <InlineMarkup text={feature.description} />
</p>
</div>
</div>
diff --git a/site/src/app/donkeyvision/MediaSection.tsx b/site/src/app/donkeyvision/MediaSection.tsx
index 0064e2c1..f2f2ebd5 100644
--- a/site/src/app/donkeyvision/MediaSection.tsx
+++ b/site/src/app/donkeyvision/MediaSection.tsx
@@ -1,34 +1,31 @@
-import { Check } from "lucide-react";
-
import { surfaces } from "@/app/donkeyvision/data";
export function MediaSection() {
return (
- <section className="border-y-2 border-[#0F0E0D] bg-white px-6 py-20 md:px-12">
- <div className="mx-auto grid max-w-[1400px] gap-10 lg:grid-cols-[0.85fr_1.15fr]">
- <div>
- <h2 className="max-w-2xl text-4xl font-semibold leading-none md:text-6xl">
- If you can screenshot it, Donkey Vision can read it.
- </h2>
- <p className="mt-6 max-w-2xl text-lg leading-8 text-[#454545]">
- Detection works on pixels, not a private integration or the DOM. The
- same request handles a native Mac window, a browser tab, or a remote
- desktop — no per-app setup and no brittle selectors.
- </p>
- </div>
- <div className="grid gap-4 sm:grid-cols-2">
+ <section className="border-y-2 border-[#0F0E0D] bg-white py-20">
+ <div className="mx-auto max-w-[1400px] px-6 md:px-12">
+ <h2 className="max-w-2xl text-4xl font-semibold leading-none md:text-6xl">
+ Works anywhere a screenshot can be captured.
+ </h2>
+ <p className="mt-6 max-w-2xl text-lg leading-8 text-[#454545]">
+ Donkey Vision analyzes pixels directly. No DOM access, private
+ integration, app-specific setup, or brittle selectors required.
+ </p>
+ <p className="mt-4 max-w-2xl text-lg leading-8 text-[#454545]">
+ The same API request can process native apps, browser tabs, Electron
+ apps, remote desktops, and other screenshot-based environments.
+ </p>
+ <ul className="mt-10 grid max-w-3xl gap-x-10 gap-y-3 sm:grid-cols-2">
{surfaces.map((surface) => (
- <div
- className="flex items-center gap-3 rounded-lg border-2 border-[#0F0E0D] bg-[#FAF6EC] p-4"
- key={surface}
- >
- <span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-md border-2 border-[#0F0E0D] bg-[#B7E4C7]">
- <Check size={18} aria-hidden="true" />
- </span>
+ <li className="flex items-baseline gap-3" key={surface}>
+ <span
+ aria-hidden="true"
+ className="h-1.5 w-1.5 shrink-0 translate-y-[7px] rounded-full bg-[#0F0E0D]"
+ />
<span className="text-base font-semibold leading-6">{surface}</span>
- </div>
+ </li>
))}
- </div>
+ </ul>
</div>
</section>
);
diff --git a/site/src/app/donkeyvision/UseCasesSection.tsx b/site/src/app/donkeyvision/UseCasesSection.tsx
index 1b00a4b3..c103bf88 100644
--- a/site/src/app/donkeyvision/UseCasesSection.tsx
+++ b/site/src/app/donkeyvision/UseCasesSection.tsx
@@ -1,3 +1,4 @@
+import { InlineMarkup } from "@/app/donkeyvision/codeHighlight";
import { useCases } from "@/app/donkeyvision/data";
import type { Feature } from "@/app/donkeyvision/types";
@@ -11,12 +12,13 @@ export function UseCasesSection() {
<div className="mb-10 flex flex-col justify-between gap-5 md:flex-row md:items-end">
<div>
<h2 className="max-w-3xl text-4xl font-semibold leading-none md:text-6xl">
- Screen understanding for software that exposes no API.
+ Use screenshots when there is no API.
</h2>
</div>
<p className="max-w-lg text-lg leading-8 text-[#454545]">
- Send a screenshot from any application and get back a structured UI
- map your own agents and tools can reason over.
+ Send a screenshot from any application. Donkey Vision returns detected
+ UI elements, labels, bounding boxes, center points, and optional
+ prompt-matched click targets.
</p>
</div>
<div className="grid gap-5 md:grid-cols-2 lg:grid-cols-4">
@@ -37,7 +39,9 @@ function UseCaseCard({ feature }: Props) {
<Icon size={22} aria-hidden="true" />
</div>
<h3 className="text-xl font-semibold leading-7">{feature.title}</h3>
- <p className="mt-3 text-sm leading-6 text-[#555]">{feature.description}</p>
+ <p className="mt-3 text-sm leading-6 text-[#555]">
+ <InlineMarkup text={feature.description} />
+ </p>
</div>
);
}
diff --git a/site/src/app/donkeyvision/apiContract.ts b/site/src/app/donkeyvision/apiContract.ts
index 5af5f286..3d0c6c0d 100644
--- a/site/src/app/donkeyvision/apiContract.ts
+++ b/site/src/app/donkeyvision/apiContract.ts
@@ -113,25 +113,25 @@ export const BODY_PARAMS: ApiField[] = [
type: "string",
required: true,
description:
- "Your screenshot as base64 text (PNG, JPEG, or WebP). For the best results, make it a JPEG at quality 0.8 and shrink it so the longest side is 1568 pixels.",
+ "Base64-encoded screenshot. Supports PNG, JPEG, and WebP. For best results, use JPEG quality `0.8` and resize the longest side to `1568px`.",
},
{
name: "instruction",
type: "string",
description:
- "Tell it what to click in plain words, like “click the play button”. Then you also get back the one spot to click.",
+ "Natural language click instruction, such as `click the play button`. When provided, the response includes a matching click target.",
},
{
name: "model",
type: "string",
description:
- "Which model picks the spot to click. Use gemini-3.5-flash or gemini-3.1-flash-lite. If you don’t pick, it uses gemini-3.1-flash-lite.",
+ "Model used for prompt-based targeting. Supported options include `gemini-3.5-flash` and `gemini-3.1-flash-lite`. Defaults to `gemini-3.1-flash-lite`.",
},
{
name: "returnElements",
type: "boolean",
description:
- "Set to true to get the full list of things it found. It’s on by default, and off when you send an instruction.",
+ "Controls whether the full detected element list is returned. Defaults to `true`; disabled automatically when an instruction is provided.",
},
];
@@ -139,28 +139,29 @@ export const RESPONSE_FIELDS: ApiField[] = [
{
name: "image",
type: "object",
- description: "How big your screenshot is, in pixels: { width, height }.",
+ description: "Screenshot dimensions in pixels: `{ width, height }`.",
},
{
name: "elements",
type: "array",
description:
- "Everything it found. Each one has an id, label, kind, interactive, box, point, and confidence. Left out when returnElements is false.",
+ "Detected UI elements. Each element includes `id`, `label`, `kind`, `interactive`, `box`, `point`, and `confidence`. Omitted when `returnElements` is `false`.",
},
{
name: "target",
type: "object | null",
description:
- "The one thing to click for your instruction, with its box and click point. Only here when you send an instruction.",
+ "Best matching click target for the provided instruction. Includes the target element, bounding box, and click point. Returned only when `instruction` is provided.",
},
{
name: "alternates",
type: "array",
- description: "Other things that might match your instruction, best ones first.",
+ description:
+ "Additional possible matches for the instruction, sorted by confidence.",
},
{
name: "model",
type: "string",
- description: "The model that picked the spot to click.",
+ description: "Model used for prompt-based target selection.",
},
];
diff --git a/site/src/app/donkeyvision/codeHighlight.tsx b/site/src/app/donkeyvision/codeHighlight.tsx
index 276e1a31..49114377 100644
--- a/site/src/app/donkeyvision/codeHighlight.tsx
+++ b/site/src/app/donkeyvision/codeHighlight.tsx
@@ -26,6 +26,24 @@ const KEYWORDS = new Set([
const TOKENIZER_SOURCE =
"(\\/\\/[^\\n]*|#[^\\n]*|\\/\\*[\\s\\S]*?\\*\\/)|(\"(?:\\\\.|[^\"\\\\])*\"(?=\\s*:))|(`(?:\\\\.|[^`\\\\])*`|\"(?:\\\\.|[^\"\\\\])*\"|'(?:\\\\.|[^'\\\\])*')|(\\b\\d+(?:\\.\\d+)?\\b)|([A-Za-z_$][\\w$]*)";
+// Renders a plain string, turning `backtick` spans into inline <code> chips.
+// Used for prose (feature cards, parameter descriptions) where the source copy
+// marks code-like tokens with backticks.
+export function InlineMarkup({ text }: { text: string }): ReactNode {
+ return text.split(/(`[^`]+`)/g).map((part, i) =>
+ part.startsWith("`") && part.endsWith("`") ? (
+ <code
+ key={i}
+ className="rounded bg-[#0F0E0D]/8 px-1 py-0.5 font-mono text-[0.85em] text-[#0F0E0D]"
+ >
+ {part.slice(1, -1)}
+ </code>
+ ) : (
+ part
+ ),
+ );
+}
+
export function HighlightedCode({ code }: { code: string }): ReactNode {
const tokenizer = new RegExp(TOKENIZER_SOURCE, "g");
const nodes: ReactNode[] = [];
diff --git a/site/src/app/donkeyvision/data.ts b/site/src/app/donkeyvision/data.ts
index e15452c4..839a2431 100644
--- a/site/src/app/donkeyvision/data.ts
+++ b/site/src/app/donkeyvision/data.ts
@@ -31,31 +31,31 @@ export const features: Feature[] = [
},
{
description:
- "Each element includes a bounding box and center point in the same image coordinate space.",
+ "Bounding boxes and center points are returned in the original screenshot coordinate space.",
icon: Crosshair,
title: "Coordinates",
},
{
description:
- "Each element includes a readable label and kind, such as button, input, icon, or text.",
+ "Each element includes a readable label and kind, such as `button`, `input`, `icon`, or `text`.",
icon: Type,
title: "Labels and types",
},
{
description:
- "Send a natural language instruction and get back the matching element, click point, and region.",
+ "Natural language instructions return the matching element, click point, and region.",
icon: MousePointerClick,
title: "Prompt-to-click",
},
{
description:
- "Adjust thresholds per request to control sensitivity and element merging.",
+ "Per-request thresholds control detection sensitivity and element merging.",
icon: SlidersHorizontal,
title: "Detection options",
},
{
description:
- "Use ChatGPT, Claude, Gemini, or bring your own custom model for prompt-based targeting.",
+ "Prompt-based targeting supports ChatGPT, Claude, Gemini, or a custom model.",
icon: Sparkles,
title: "Model choice",
},
@@ -64,35 +64,35 @@ export const features: Feature[] = [
export const useCases: Feature[] = [
{
description:
- "Give an agent a fresh map of the current app before it decides where to click, type, or ask for confirmation.",
+ "Give agents the current screen state before taking action. Return clickable elements, coordinates, labels, and prompt-matched targets for tasks like `click the play button`.",
icon: Zap,
title: "Computer-use agents",
},
{
description:
- "Index screenshots from common applications so QA, support, and automation systems can reason over UI state.",
+ "Convert screenshots into structured UI data: detected elements, text labels, element types, bounding boxes, and center points.",
icon: ImageIcon,
- title: "Screenshot understanding",
+ title: "Screenshot parsing",
},
{
description:
- "Turn video frames into UI element timelines for product demos, workflow mining, and regression review.",
+ "Parse video frames into UI element timelines. Track visible controls, labels, and screen changes across demos, workflows, and regression tests.",
icon: Video,
- title: "Video walkthroughs",
+ title: "Video frame analysis",
},
{
description:
- "Find the next step in unfamiliar software without relying on DOM access, app-specific integrations, or brittle selectors.",
+ "Find click targets across native apps, web apps, Electron apps, VNC sessions, and remote desktops without DOM access or app-specific selectors.",
icon: ListChecks,
- title: "Cross-app workflow routing",
+ title: "Cross-app automation",
},
];
export const surfaces: string[] = [
"Native macOS apps",
"Web apps in any browser",
- "Electron and hybrid shells",
- "Remote desktop and VNC sessions",
+ "Electron and hybrid apps",
+ "Remote desktops and VNC sessions",
"Enterprise and internal tools",
"Games and media players",
];