|
|
|
|
@ -98,6 +98,7 @@ export function FlowMoty(){ |
|
|
|
|
const { history, status, reset, sendMessage, setStatus, audioOutput, setAudioOutput, stop:stopChat, |
|
|
|
|
audioUrl }=useChat(); |
|
|
|
|
|
|
|
|
|
const refHistory=useRef(); |
|
|
|
|
|
|
|
|
|
const { |
|
|
|
|
transcript, |
|
|
|
|
@ -620,8 +621,9 @@ export function FlowMoty(){ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function exportFile(isTest=false){ |
|
|
|
|
const user_input = history.find(msg => msg.role === 'user' && msg.content!='...'); |
|
|
|
|
const user_input = refHistory.current?.find(msg => msg.role === 'user' && msg.content!='...'); |
|
|
|
|
const default_image=!(user_input && user_input.content.trim() !== ''); |
|
|
|
|
console.log('export file', default_image, padInput) |
|
|
|
|
|
|
|
|
|
const order=parseInt(data?.id)||Math.floor(Math.random()*10+5); |
|
|
|
|
const delay=order*2000; |
|
|
|
|
@ -629,9 +631,9 @@ export function FlowMoty(){ |
|
|
|
|
|
|
|
|
|
// setTimeout(()=>{ |
|
|
|
|
if(isTest) { |
|
|
|
|
sendOsc(OSC_ADDRESS.EXPORT, `${getFileId(padInput)}#generated`); // Send OSC export message |
|
|
|
|
sendOsc(OSC_ADDRESS.EXPORT, `${padInput}#generated`); // Send OSC export message |
|
|
|
|
}else{ |
|
|
|
|
sendOsc(OSC_ADDRESS.EXPORT, `${getFileId(padInput)}#${default_image?'default':'generated'}`); // Send OSC export message |
|
|
|
|
sendOsc(OSC_ADDRESS.EXPORT, `${padInput}#${default_image?'default':'generated'}`); // Send OSC export message |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -670,6 +672,10 @@ export function FlowMoty(){ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
useEffect(()=>{ |
|
|
|
|
refHistory.current=history; |
|
|
|
|
},[history]); |
|
|
|
|
|
|
|
|
|
useEffect(()=>{ |
|
|
|
|
|
|
|
|
|
if(!lastOsc) return; |
|
|
|
|
|