fix: đã sửa lỗi các tools của AI

This commit is contained in:
2026-07-22 09:27:12 +07:00
parent 022fbb3351
commit 4791bb22d9
4 changed files with 54 additions and 2 deletions
+24
View File
@@ -7021,6 +7021,11 @@ const App = () => {
if (!hasText && !hasCalls) {
setAiActionLog(prev => [...prev, { type: 'error', text: ` AI không trả về lệnh hoặc text. Kiểm tra provider/model có hỗ trợ function calling.`, time: Date.now() }]);
}
if (prompt) {
promptHistRef.current = [...promptHistRef.current.slice(-49), prompt];
setPromptHistory(promptHistRef.current);
}
setPromptHistIdx(-1);
setAiActionLog(prev => [...prev, { type: 'status', text: ` Hoàn tất.`, time: Date.now() }]);
setAiPrompt('');
setTimeout(() => lucide.createIcons(), 200);
@@ -7352,6 +7357,9 @@ const App = () => {
}
}
detectedBPM = Math.round(Math.min(300, Math.max(30, detectedBPM)));
if (args.set_tempo !== false && detectedBPM > 0) {
setBpm(String(detectedBPM));
}
const bitDepth = 16;
const bitrate = Math.round(sr * channels * bitDepth / 1000);
return {
@@ -8306,6 +8314,22 @@ const App = () => {
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault();
handleAISend();
} else if (e.key === 'ArrowUp' && promptHistRef.current.length > 0) {
e.preventDefault();
const idx = promptHistIdx === -1 ? promptHistRef.current.length - 1 : Math.max(0, promptHistIdx - 1);
setPromptHistIdx(idx);
setAiPrompt(promptHistRef.current[idx]);
} else if (e.key === 'ArrowDown') {
e.preventDefault();
if (promptHistIdx === -1) return;
const idx = promptHistIdx + 1;
if (idx >= promptHistRef.current.length) {
setPromptHistIdx(-1);
setAiPrompt('');
} else {
setPromptHistIdx(idx);
setAiPrompt(promptHistRef.current[idx]);
}
}
}
}), /*#__PURE__*/React.createElement("div", {