|
|
|
@ -49,13 +49,8 @@ export function FreeFlow(){ |
|
|
|
const [chatWelcome, setChatWelcome] = useState(null); |
|
|
|
const [chatWelcome, setChatWelcome] = useState(null); |
|
|
|
const [audioInput, setAudioInput] = useState(true); |
|
|
|
const [audioInput, setAudioInput] = useState(true); |
|
|
|
const [autoSend, setAutoSend] = useState(true); |
|
|
|
const [autoSend, setAutoSend] = useState(true); |
|
|
|
// const [userId, setUserId] = useState(); |
|
|
|
|
|
|
|
const [summary, setSummary] = useState(null); |
|
|
|
|
|
|
|
// const [voice, setVoice] = useState(Voice.ONYX); |
|
|
|
|
|
|
|
//const [speechPaused, setSpeechPaused]=useState(false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [chatStatus, setChatStatus] = useState(ChatStatus.System); // System, User, Processing |
|
|
|
const [chatStatus, setChatStatus] = useState(ChatStatus.System); // System, User, Processing |
|
|
|
const { userId, setUserId, getFileId, setPassword, reset:resetUser, uploadHistory } = useUser(); |
|
|
|
const { userId, setUserId, getFileId, setPassword, reset:resetUser, uploadHistory, setSummary, summary,setChoice } = useUser(); |
|
|
|
|
|
|
|
|
|
|
|
const refTimer=useRef(); |
|
|
|
const refTimer=useRef(); |
|
|
|
const refAudio=useRef(); |
|
|
|
const refAudio=useRef(); |
|
|
|
@ -70,7 +65,8 @@ export function FreeFlow(){ |
|
|
|
|
|
|
|
|
|
|
|
const refCurrentCue= useRef(null); |
|
|
|
const refCurrentCue= useRef(null); |
|
|
|
|
|
|
|
|
|
|
|
const { history, status, reset, sendMessage, setStatus, audioOutput, setAudioOutput, stop:stopChat, audioUrl, }=useChat(); |
|
|
|
const { history, status, reset, sendMessage, setStatus, audioOutput, setAudioOutput, stop:stopChat, |
|
|
|
|
|
|
|
audioUrl }=useChat(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { |
|
|
|
const { |
|
|
|
@ -217,11 +213,11 @@ export function FreeFlow(){ |
|
|
|
console.log('Summary:', summary_); |
|
|
|
console.log('Summary:', summary_); |
|
|
|
onCueEnd(); // End the current cue after getting summary |
|
|
|
onCueEnd(); // End the current cue after getting summary |
|
|
|
|
|
|
|
|
|
|
|
setSummary(summary_); |
|
|
|
setSummary(summary_?.result); |
|
|
|
refContainer.current.scrollTop = refContainer.current.scrollHeight; // Scroll to bottom |
|
|
|
refContainer.current.scrollTop = refContainer.current.scrollHeight; // Scroll to bottom |
|
|
|
|
|
|
|
|
|
|
|
// sendOsc(OSC_ADDRESS.SUMMARY, summary_?.result); |
|
|
|
// sendOsc(OSC_ADDRESS.SUMMARY, summary_?.result); |
|
|
|
sendOsc(OSC_ADDRESS.SAVE, `${getFileId()}#${summary_?.result}`); // Save summary with file ID |
|
|
|
// sendOsc(OSC_ADDRESS.EXPORT, `${getFileId()}#${summary_?.result}#${password}`); // Save summary with file ID |
|
|
|
|
|
|
|
|
|
|
|
}).catch(error => { |
|
|
|
}).catch(error => { |
|
|
|
console.error('Error getting summary:', error); |
|
|
|
console.error('Error getting summary:', error); |
|
|
|
@ -230,7 +226,7 @@ export function FreeFlow(){ |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'user_input': |
|
|
|
case 'user_input': |
|
|
|
console.log('User input cue, setting chat status to User'); |
|
|
|
console.log('User input cue, setting chat status to User'); |
|
|
|
setChatStatus(ChatStatus.User); // Set chat status to User for user input cues |
|
|
|
setChatStatus(ChatStatus.Clear); // Set chat status to User for user input cues |
|
|
|
resetTranscript(); // Reset transcript for user input |
|
|
|
resetTranscript(); // Reset transcript for user input |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -284,7 +280,6 @@ export function FreeFlow(){ |
|
|
|
refChatCueEnd.current=true; |
|
|
|
refChatCueEnd.current=true; |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
uploadHistory(history); // Save chat history when cue ends |
|
|
|
uploadHistory(history); // Save chat history when cue ends |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -339,10 +334,12 @@ export function FreeFlow(){ |
|
|
|
break; |
|
|
|
break; |
|
|
|
case NUMPAD_TYPE.CHOICE: |
|
|
|
case NUMPAD_TYPE.CHOICE: |
|
|
|
next=cue.branch[mess.toString()].nextcue; |
|
|
|
next=cue.branch[mess.toString()].nextcue; |
|
|
|
|
|
|
|
setChoice(cue.branch[mess.toString()].description); // Set choice for user input |
|
|
|
break; |
|
|
|
break; |
|
|
|
case NUMPAD_TYPE.PASSWORD: |
|
|
|
case NUMPAD_TYPE.PASSWORD: |
|
|
|
setPassword(()=>mess); |
|
|
|
setPassword(()=>mess); |
|
|
|
sendOsc(OSC_ADDRESS.PASSWORD, mess); // Send OSC password message |
|
|
|
// sendOsc(OSC_ADDRESS.PASSWORD, mess); // Send OSC password message |
|
|
|
|
|
|
|
sendOsc(OSC_ADDRESS.EXPORT, `${getFileId()}#${summary}#${mess}`); |
|
|
|
sendOsc(OSC_ADDRESS.CHOICE, OSC_ADDRESS.SAVE); // Send OSC save choice message |
|
|
|
sendOsc(OSC_ADDRESS.CHOICE, OSC_ADDRESS.SAVE); // Send OSC save choice message |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|