PROMPT UPLOAD
# Prompt Upload & Version Advancement
> **Phase**: 1.5 — implement before Phase 2 (Evaluation Engine)
>
> **Purpose**: Allow users to load prompt files into the comparison UI via drag-and-drop or file picker, have them automatically persisted to the backend, and support advancing the prompt pair (B becomes A, new B loaded) to represent the next iteration of the comparison session.
---
## Overview
The current UI requires pasting prompt text manually. This feature adds:
1. **Drag-and-drop** on either PromptPanel to load a `.txt` or `.md` file
2. **Browse file button** as an alternative to drag-and-drop
3. **Subtle upload indicator** while the file is being read and saved to the backend
4. **"Use as Prompt A →" button** on the Prompt B panel to advance the session to the next iteration
---
## Drag-and-Drop & File Upload
### Behavior
1. User drags a `.txt` or `.md` file over either PromptPanel editor.
2. The panel highlights (border pulse) while the file is dragged over it.
3. On drop, the file is read via `FileReader.readAsText(file)`.
4. The textarea is **immediately populated** with the file content — no waiting for a network call.
5. In parallel, the content is POSTed to the backend:
- If no prompt manifest exists for this panel slot: `POST /api/eval/prompts` (creates a new prompt)
- If a prompt manifest already exists (file was previously loaded): `POST /api/eval/prompts/:id/versions` (adds a new version)
6. A subtle status strip below the textarea shows: `Reading file…` → `Saved` → (clears after 2s) or `Error saving` (persists until dismissed).
### Supported file types
- `.md` — Markdown system prompts
- `.txt` — Plain text prompts
- Unsupported types: show inline error `"Only .md and .txt files are supported"`; do not clear textarea.
### Browse File Button
A small "Browse…" link/button sits below the textarea alongside the drag hint text.
Clicking it triggers a hidden `<input type="file" accept=".txt,.md">`.
Same behavior as drop — reads file, populates textarea, saves to backend.
---
## PromptPanel Component Changes
**File: `src/components/prompt/PromptPanel.tsx`**
### New propswhen to use it
Community prompt sourced from the open-source GitHub repo illogical/LMEval (no explicit license). A "PROMPT UPLOAD" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.
tags
codingcommunitydeveloper
source
illogical/LMEval · no explicit license
more in Coding
Coding✓ tested
Senior code review (strict mode)
senior staff engineer running a merciless but fair review
Coding✓ tested
Debug by hypothesis, not by guessing
debugging partner who forms theories before touching code
Coding✓ tested
Generate tests from described behavior
test engineer who writes tests that would actually catch regressions