Skip to content

Commit aacb2e7

Browse files
hubyrodclaude
andcommitted
Add editable prompt textarea to summary page
Users can now customize the summarization prompt from the UI. Default prompt is pre-filled, empty falls back to default. Group name and week label are appended automatically. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0161eeb commit aacb2e7

3 files changed

Lines changed: 40 additions & 3 deletions

File tree

app/api/summary/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export async function POST(request: Request) {
151151
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
152152
}
153153

154-
let body: { group?: string; week?: string };
154+
let body: { group?: string; week?: string; prompt?: string };
155155
try {
156156
body = await request.json();
157157
} catch {
@@ -263,7 +263,7 @@ export async function POST(request: Request) {
263263
messages: [
264264
{
265265
role: "user",
266-
content: `Summarize the following messages from the '${group}' group for ${label}. Give a concise overview of the key topics, decisions, and action items discussed:\n\n${formatted}`,
266+
content: `${body.prompt || "Summarize the following messages. Give a concise overview of the key topics, decisions, and action items discussed:"}\n\nGroup: ${group} | ${label}\n\n${formatted}`,
267267
},
268268
],
269269
});

app/summary/summary-form.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@ const WEEK_OPTIONS = Array.from({ length: 52 }, (_, i) => {
2525
return { value: `week${pad}`, label };
2626
});
2727

28+
const DEFAULT_PROMPT =
29+
"Summarize the following messages. Give a concise overview of the key topics, decisions, and action items discussed:";
30+
2831
export default function SummaryForm({ groups }: SummaryFormProps) {
2932
const [group, setGroup] = useState(groups[0] ?? "");
3033
const [week, setWeek] = useState(`week${String(currentWeek).padStart(2, "0")}`);
34+
const [prompt, setPrompt] = useState(DEFAULT_PROMPT);
3135
const [loading, setLoading] = useState(false);
3236
const [summary, setSummary] = useState("");
3337
const [postCount, setPostCount] = useState<number | null>(null);
@@ -46,7 +50,7 @@ export default function SummaryForm({ groups }: SummaryFormProps) {
4650
const res = await fetch("/api/summary", {
4751
method: "POST",
4852
headers: { "Content-Type": "application/json" },
49-
body: JSON.stringify({ group, week }),
53+
body: JSON.stringify({ group, week, prompt: prompt.trim() || undefined }),
5054
});
5155

5256
const text = await res.text();
@@ -107,6 +111,20 @@ export default function SummaryForm({ groups }: SummaryFormProps) {
107111
</select>
108112
</div>
109113

114+
</div>
115+
116+
<div className="sum-field">
117+
<label htmlFor="sum-prompt">Prompt</label>
118+
<textarea
119+
id="sum-prompt"
120+
className="sum-prompt"
121+
value={prompt}
122+
onChange={(e) => setPrompt(e.target.value)}
123+
rows={3}
124+
/>
125+
</div>
126+
127+
<div className="sum-form-row">
110128
<div className="sum-field sum-field--action">
111129
<button
112130
type="submit"

app/summary/summary.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,25 @@
102102
border-color: var(--cfg-accent);
103103
}
104104

105+
.sum-prompt {
106+
font-family: var(--cfg-mono);
107+
font-size: 0.8125rem;
108+
color: var(--cfg-text);
109+
background: var(--cfg-bg);
110+
border: 1px solid var(--cfg-border);
111+
border-radius: 4px;
112+
padding: 0.5rem 0.625rem;
113+
outline: none;
114+
transition: border-color 0.15s ease;
115+
resize: vertical;
116+
width: 100%;
117+
box-sizing: border-box;
118+
}
119+
120+
.sum-prompt:focus {
121+
border-color: var(--cfg-accent);
122+
}
123+
105124
.sum-submit {
106125
font-family: var(--cfg-mono);
107126
font-size: 0.75rem;

0 commit comments

Comments
 (0)