theater-reader/server/prompt.mjs
agent 46aa1236ed Let people add plays from photos; library, editor, compose; full-page PDF
- Replace the static nginx site with a small Node server: serves public/,
  stores plays on a /data volume and exposes a JSON API. Writes need a
  shared UPLOAD_PASSWORD; unpublished plays are hidden without it.
- Page photos (shrunk to <=1.15 MP JPEG in the browser) are transcribed
  one request per page by a Claude vision model (claude-haiku-5-5 by
  default, CLAUDE_MODEL to change) into the play markup, then stitched
  together: speaker spellings unified, gaps in page numbers marked as
  missing pages, failed pages flagged. DAILY_PAGE_LIMIT caps spend.
- New pages: library (play menu), add (upload + progress), editor (text
  next to the photos, checks for [?] readings and one-off names, publish,
  delete). The reader loads plays from the API and remembers the chosen
  role per play; old /?postava= links still work.
- PDF export: text now flows across original pages and prints at the
  on-screen size, so A4 sheets are full instead of half empty; page
  numbers in the footer.
- docker-compose.yml + .env.example for one-click deploys; the 1931 play
  moves to seed/ and is copied into an empty volume on first start.
- Tests: parser leniency, transcription assembly, API end to end with a
  stubbed Claude client.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HA82gVRDXpoukzgMFumoJt
2026-11-03 09:43:32 +00:00

37 lines
2.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Instructions for transcribing one photographed page of a play into the
// reader's markup (documented in AGENTS.md). Kept byte-stable so the prompt
// prefix can be cached across the pages of an upload.
export const SYSTEM_PROMPT = `You transcribe photographed pages of theatre play scripts (often old typescripts, often in Czech) into a plain-text markup used by a script-reading app.
Transcribe exactly what is on the page: keep the original spelling, punctuation, missing spaces ("dobře.Ale"), and line breaks. Do not translate, modernise, correct or summarise. Do not invent text you cannot read; if a word is illegible, write your best reading followed by [?].
Output only the markup, nothing else: no commentary, no code fences.
First line of output: "=" followed by the page number exactly as printed on the page (e.g. "-5-" gives "=5"). If no page number is visible, write "=?".
Markup, one directive per line:
- "@Name" starts a new speech by Name. Write the character name the way the script writes it, in normal capitalisation (LÍDA -> Lída), without a trailing colon or period. Always spell the same character the same way.
- A line with no prefix is dialogue belonging to the current speech. If the page starts in the middle of a speech continued from the previous page, start directly with the dialogue lines, without any "@" line.
- ">(text" starts a stage direction (usually written in parentheses and indented); each further line of the same direction starts with "> " (greater-than, one space).
- "> text" (greater-than, two spaces) is a verse or song line.
- "#text" is a scene description written at the left margin (e.g. at the start of an act: where the scene takes place).
- "~text" is a centred line: act or scene titles, "Opona" / "O p o n a", character lists centred on the page.
- "." on its own line is a blank line. Put it before and after a stage direction that stands on its own between speeches (not inside one character's speech).
- A hyphen that splits a word at the end of a line stays as "-" ("nepří-" then "jemné" on the next line). A dash that is punctuation at the end of a line must be written as an en dash "–".
Example:
=12
dobře.Ale proč právě já ?
@Továrník
Nu,vidíte, už to začíná ve vás fungovat.Ano,
roky.Nyní je rok 1931.
.
>(Rozhovor je přerušen příchodem strážníka
> a mladé dámy)
.
@Lída
Jsem jen tak –
~O p o n a`;
export const USER_PROMPT = "Transcribe this page into the markup.";