fix(ai-copilot): tăng chiều cao prompt input rows=4 + resize-y, sửa ArrowUp/ArrowDown chỉ gọi history khi cursor ở đầu/cuối text
This commit is contained in:
@@ -15261,18 +15261,18 @@ const App = () => {
|
|||||||
value: aiPrompt,
|
value: aiPrompt,
|
||||||
onChange: e => setAiPrompt(e.target.value),
|
onChange: e => setAiPrompt(e.target.value),
|
||||||
placeholder: "Nhập lệnh điều khiển DAW... (VD: Tạo track mới tên Beat, đặt BPM 128)",
|
placeholder: "Nhập lệnh điều khiển DAW... (VD: Tạo track mới tên Beat, đặt BPM 128)",
|
||||||
className: "w-full bg-[#1e1e1e] text-zinc-200 p-1.5 rounded border border-zinc-700 focus:outline-none focus:border-purple-600 font-mono text-xs resize-none",
|
className: "w-full bg-[#1e1e1e] text-zinc-200 p-1.5 rounded border border-zinc-700 focus:outline-none focus:border-purple-600 font-mono text-xs resize-y",
|
||||||
rows: 2,
|
rows: 4,
|
||||||
onKeyDown: e => {
|
onKeyDown: e => {
|
||||||
if (e.key === 'Enter' && !e.shiftKey) {
|
if (e.key === 'Enter' && !e.shiftKey) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
handleAISend();
|
handleAISend();
|
||||||
} else if (e.key === 'ArrowUp' && promptHistRef.current.length > 0) {
|
} else if (e.key === 'ArrowUp' && promptHistRef.current.length > 0 && e.target.selectionStart === 0) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const idx = promptHistIdx === -1 ? promptHistRef.current.length - 1 : Math.max(0, promptHistIdx - 1);
|
const idx = promptHistIdx === -1 ? promptHistRef.current.length - 1 : Math.max(0, promptHistIdx - 1);
|
||||||
setPromptHistIdx(idx);
|
setPromptHistIdx(idx);
|
||||||
setAiPrompt(promptHistRef.current[idx]);
|
setAiPrompt(promptHistRef.current[idx]);
|
||||||
} else if (e.key === 'ArrowDown') {
|
} else if (e.key === 'ArrowDown' && e.target.selectionStart === aiPrompt.length) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (promptHistIdx === -1) return;
|
if (promptHistIdx === -1) return;
|
||||||
const idx = promptHistIdx + 1;
|
const idx = promptHistIdx + 1;
|
||||||
|
|||||||
@@ -4,6 +4,12 @@
|
|||||||
- **Ghi chú/Test (nếu có):** SpessaSynth CDN load OK (200). Cần kiểm tra browser console.
|
- **Ghi chú/Test (nếu có):** SpessaSynth CDN load OK (200). Cần kiểm tra browser console.
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### [2026-07-27 16:16] Task: Tăng chiều cao + fix phím mũi tên cho Copilot prompt
|
||||||
|
- **Tóm tắt thay đổi:** Tăng rows từ 2 → 4, thêm resize-y. Sửa ArrowUp/ArrowDown: chỉ kích hoạt lịch sử khi con trỏ ở đầu/cuối text, giúp các phím mũi tên dùng để di chuyển con trỏ bình thường. Home/End/PageUp/PageDown tự động hoạt động đúng nhờ không bị chặn.
|
||||||
|
- **Các file ảnh hưởng:** `app/static/js/app.jsx`
|
||||||
|
- **Ghi chú/Test (nếu có):** Kiểm tra bằng cách focus vào ô prompt, gõ vài dòng text, dùng phím mũi tên lên/xuống để di chuyển con trỏ giữa các dòng; khi con trỏ ở đầu/cuối thì mũi tên lên/xuống vẫn gọi lịch sử prompt.
|
||||||
|
---
|
||||||
|
|
||||||
### [2026-07-26 20:15] Task: Stabilize client preview (oscillator + FluidSynth server)
|
### [2026-07-26 20:15] Task: Stabilize client preview (oscillator + FluidSynth server)
|
||||||
- **Tóm tắt thay đổi:** Kết luận sau debug: SpessaSynth parser (fromArrayBuffer) không extract được presets từ SF2. Client luôn dùng oscillator (ADSR theo program). Server-side FluidSynth render cho âm thanh chính xác khi Export. Xoá debug logs, clean code.
|
- **Tóm tắt thay đổi:** Kết luận sau debug: SpessaSynth parser (fromArrayBuffer) không extract được presets từ SF2. Client luôn dùng oscillator (ADSR theo program). Server-side FluidSynth render cho âm thanh chính xác khi Export. Xoá debug logs, clean code.
|
||||||
- **Các file ảnh hưởng:** `app/static/js/services/soundfontPlayer.js`, `app/api/v1/plugins.py`, `app/static/js/app.precompiled.js`
|
- **Các file ảnh hưởng:** `app/static/js/services/soundfontPlayer.js`, `app/api/v1/plugins.py`, `app/static/js/app.precompiled.js`
|
||||||
|
|||||||
Reference in New Issue
Block a user