Skip to content

Commit 663ebe1

Browse files
pallaoroclaude
andcommitted
Auto-grow Generate textarea and add GPT-5.4 Image 2 model
Quick-generate's textarea now resizes with content via a layout effect that resets height to scrollHeight on prompt changes; cap raised to 240px with overflow-y scroll past that. Adds openai/gpt-5.4-image-2 to the /api/models list. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 18cdc78 commit 663ebe1

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/client/components/quick-generate.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useState, useCallback, useRef, useEffect, useMemo, type DragEvent, type KeyboardEvent } from "react";
1+
import { useState, useCallback, useRef, useEffect, useLayoutEffect, useMemo, type DragEvent, type KeyboardEvent } from "react";
22
import { useWorkflow } from "../context";
33
import { api } from "../api";
44
import type { Generation } from "../types";
@@ -117,6 +117,14 @@ export function QuickGenerate() {
117117
const [imageDims, setImageDims] = useState<Record<number, number>>({});
118118
const fileRef = useRef<HTMLInputElement>(null);
119119
const gridRef = useRef<HTMLDivElement>(null);
120+
const textareaRef = useRef<HTMLTextAreaElement>(null);
121+
122+
useLayoutEffect(() => {
123+
const ta = textareaRef.current;
124+
if (!ta) return;
125+
ta.style.height = "auto";
126+
ta.style.height = `${ta.scrollHeight}px`;
127+
}, [prompt]);
120128

121129
// Measure container
122130
useEffect(() => {
@@ -319,7 +327,8 @@ export function QuickGenerate() {
319327
</div>
320328
)}
321329
<textarea
322-
className="w-full bg-transparent text-gray-900 text-sm leading-relaxed resize-none outline-none min-h-[24px] max-h-[120px] placeholder:text-gray-400 border-none p-0"
330+
ref={textareaRef}
331+
className="w-full bg-transparent text-gray-900 text-sm leading-relaxed resize-none outline-none min-h-[24px] max-h-[240px] overflow-y-auto placeholder:text-gray-400 border-none p-0"
323332
placeholder="Describe the scene you imagine"
324333
value={prompt}
325334
onChange={(e) => setPrompt(e.target.value)}

src/server/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ app.openapi(listModels, async (c) => {
336336
{ id: "openai/gpt-image-1", name: "GPT Image 1" },
337337
{ id: "openai/gpt-5-image-mini", name: "GPT-5 Image Mini" },
338338
{ id: "openai/gpt-5-image", name: "GPT-5 Image" },
339+
{ id: "openai/gpt-5.4-image-2", name: "GPT-5.4 Image 2" },
339340
{ id: "google/gemini-2.5-flash-image", name: "Gemini 2.5 Flash Image" },
340341
{ id: "bytedance-seed/seedream-4.5", name: "SeedDream 4.5" },
341342
{ id: "black-forest-labs/flux.2-max", name: "FLUX.2 Max" },

0 commit comments

Comments
 (0)