fix(frontend): add X-Accel-Buffering to sse stream and optimize textarea input height resize
This commit is contained in:
@@ -72,6 +72,7 @@ export async function GET(
|
||||
"Content-Type": "text/event-stream",
|
||||
"Cache-Control": "no-cache, no-transform",
|
||||
Connection: "keep-alive",
|
||||
"X-Accel-Buffering": "no",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2025,8 +2025,13 @@ export function ChatPanel({
|
||||
}}
|
||||
onInput={(e) => {
|
||||
const el = e.currentTarget;
|
||||
const newlines = (el.value.match(/\n/g) || []).length;
|
||||
// Cache lastNewlines on the DOM element to avoid state re-render lag
|
||||
if ((el as any).lastNewlines !== newlines) {
|
||||
(el as any).lastNewlines = newlines;
|
||||
el.style.height = "auto";
|
||||
el.style.height = Math.min(el.scrollHeight, 120) + "px";
|
||||
}
|
||||
}}
|
||||
/>
|
||||
{selectToggle}
|
||||
|
||||
Reference in New Issue
Block a user