feat: auto-resize textarea, persistent token stats
This commit is contained in:
+11
-2
@@ -240,6 +240,10 @@ export default function GamePage() {
|
||||
const tempSession = { ...session, messages: updatedMessages };
|
||||
setSession(tempSession);
|
||||
setInput("");
|
||||
// Reset textarea height
|
||||
if (inputRef.current) {
|
||||
inputRef.current.style.height = "auto";
|
||||
}
|
||||
setIsLoading(true);
|
||||
setError(null);
|
||||
setStreamingContent("");
|
||||
@@ -588,11 +592,16 @@ export default function GamePage() {
|
||||
<textarea
|
||||
ref={inputRef}
|
||||
value={input}
|
||||
onChange={(e) => setInput(e.target.value)}
|
||||
onChange={(e) => {
|
||||
setInput(e.target.value);
|
||||
// Auto-resize
|
||||
e.target.style.height = "auto";
|
||||
e.target.style.height = Math.min(e.target.scrollHeight, 150) + "px";
|
||||
}}
|
||||
onKeyDown={handleKeyDown}
|
||||
placeholder="Что ты хочешь сделать?..."
|
||||
disabled={isLoading}
|
||||
rows={2}
|
||||
rows={1}
|
||||
/>
|
||||
{isLoading ? (
|
||||
<button onClick={handleStop} className="send-btn stop-btn">
|
||||
|
||||
Reference in New Issue
Block a user