• Stefy Lanza (nextime / spora )'s avatar
    let a model carry its prompt, and say how big a page may be (v0.4.91) · 66f639e7
    Stefy Lanza (nextime / spora ) authored
    Two asks that turned out to be about the same thing: a request taken as meant.
    
    A model fine-tuned on a quality ladder needs that ladder on every request, and
    a client speaking the plain OpenAI image API sends a sentence with nowhere to
    put it. CoderAI adds no tags of its own and still does not: prompt_prefix and
    negative_prompt_prefix on the MODEL's config entry are comma-joined in front of
    whatever the caller sent, and both default to empty, so an install that
    configures nothing sends exactly what was written. A request overrides either,
    and an empty string switches one off for that call -- what a caller writing its
    own complete prompt needs. Applied at most once: a prompt that already opens
    with the ladder is left alone rather than given it twice, which would only
    dilute the rest.
    
    The prefix resolves once, before the encode, and the same text feeds the
    embedding cache key. Keyed on the prompt as SENT, two models with different
    prefixes would share one entry and the second would be served the first's
    text. The archive keeps the prompt that ran plus the one requested when they
    differ.
    
    On OCR: there is no per-page byte limit, and there never was. A page over a
    megabyte is ordinary -- an A4 scan at 300 DPI is several -- and both a 3 MB and
    a 50 MB body upload completely and are rejected only at authentication, with
    the bundled nginx at 4096m and the generated /v1/ocr routing not lowering it.
    
    What did exist was a hardcoded 100 MB ceiling on one document, which a 300 DPI
    colour filing passes without being unusual and which nothing could raise. It is
    ocr.max_upload_mb now (0 = no ceiling here), in Settings, and its 413 names the
    setting and says the document was NOT read -- the loud refusal ocr.max_pages
    already makes, instead of "file too large (max 100 MB)".
    
    The 1 MB figure that makes a large page fail in the field is nginx's own
    client_max_body_size default, in a reverse proxy added in front. That is
    exactly the shape of "anything over a megabyte fails", so it is recorded in the
    code, the settings hint and docs/ocr.md rather than left to be rediscovered.
    Also documented there: what IS capped is pixels, not bytes -- Surya-2 and
    Chandra top out near 6.29 MP, an A4 page at about 255 DPI, and above that the
    page is silently downscaled to fit.
    
    37 tests, including a real 1.25 MB single-page PDF built from noise and read
    back through pdfium as one page. Full suite 4512 passed with the same 15
    pre-existing failures as 0.4.90 (diff empty).
    Co-Authored-By: 's avatarClaude Opus 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01S8LAP3ueNzQJtwzhgVbq66
    66f639e7
test_prompt_prefix_and_ocr_upload_size.py 11 KB