main
reng 4 months ago
parent 6b263c35c1
commit a73d5380a6
  1. 13
      vite/public/cuelist_demo2.json
  2. 46
      vite/src/pages/flow_free.jsx
  3. 12
      vite/src/util/useUser.jsx

@ -76,7 +76,7 @@
"description": "chat", "description": "chat",
"auto": true, "auto": true,
"nextcue": 4.3, "nextcue": 4.3,
"duration": 20, "duration": 30,
"status":"go" "status":"go"
}, },
{ {
@ -96,8 +96,15 @@
"description": "call", "description": "call",
"duration": 30, "duration": 30,
"auto": true, "auto": true,
"nextcue": 5.2, "nextcue": 5.11
"callback":"summary" },
{
"id":5.11,
"name":"Q5.11",
"type":"summary",
"auto":true,
"description":"summary",
"nextcue":5.2
}, },
{ {
"id": 5.2, "id": 5.2,

@ -215,23 +215,23 @@ export function FreeFlow(){
setChatWelcome(false); setChatWelcome(false);
setChatStatus(ChatStatus.Clear); setChatStatus(ChatStatus.Clear);
break; break;
// case 'summary': case 'summary':
// console.log('Getting summary...'); console.log('Getting summary...');
// setChatStatus(ChatStatus.Clear); // Set chat status to Processing setChatStatus(ChatStatus.Clear); // Set chat status to Processing
// getSummary(history.map(el=>`${el.role}:${el.content}`).join('\n'), data).then(summary_ => { getSummary(history.map(el=>`${el.role}:${el.content}`).join('\n'), data).then(summary_ => {
// 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_?.result); setSummary(summary_?.result);
// refContainer.current.scrollTop = refContainer.current.scrollHeight; // Scroll to bottom refContainer.current.scrollTop = refContainer.current.scrollHeight; // Scroll to bottom
// }).catch(error => { }).catch(error => {
// console.error('Error getting summary:', error); console.error('Error getting summary:', error);
// }); });
// break; break;
case 'user_input': case 'user_input':
setChatStatus(ChatStatus.Message); // Set chat status to User setChatStatus(ChatStatus.Message); // Set chat status to User
resetTranscript(); // Reset transcript for user input resetTranscript(); // Reset transcript for user input
@ -306,21 +306,21 @@ export function FreeFlow(){
sendOsc(OSC_ADDRESS.HINT, ''); // Clear hint message sendOsc(OSC_ADDRESS.HINT, ''); // Clear hint message
} }
if(cue.callback=='summary') { // if(cue.callback=='summary') {
console.log('Getting summary...'); // console.log('Getting summary...');
getSummary(history.map(el=>`${el.role}:${el.content}`).join('\n'), data).then(summary_ => { // getSummary(history.map(el=>`${el.role}:${el.content}`).join('\n'), data).then(summary_ => {
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_?.result); // setSummary(summary_?.result);
refContainer.current.scrollTop = refContainer.current.scrollHeight; // Scroll to bottom // refContainer.current.scrollTop = refContainer.current.scrollHeight; // Scroll to bottom
}).catch(error => { // }).catch(error => {
console.error('Error getting summary:', error); // console.error('Error getting summary:', error);
}); // });
} // }
refAudio.current?.pause(); // Pause any playing audio refAudio.current?.pause(); // Pause any playing audio
console.log('onCueEnd:', cue.id); console.log('onCueEnd:', cue.id);

@ -1,4 +1,4 @@
import { createContext, useState, useEffect, useContext } from "react"; import { createContext, useState, useEffect, useContext, use } from "react";
import moment from "moment"; import moment from "moment";
import { updateUser } from "./backend"; import { updateUser } from "./backend";
@ -28,12 +28,12 @@ export function UserProvider({children}) {
return `${password||pass||''}_${userId}`; return `${password||pass||''}_${userId}`;
} }
function getDataId(){ function getDataId(){
if(!userId) return `${moment().format('YYYYMM')}/${moment().format("MMDD")}/${sessionId==null? SessionTime[sessionId][0]:'no-sesion'}/testuser_${moment().format('hhmmss')}`; if(!userId) return `${moment().format('YYYYMM')}/${moment().format("MMDD")}/${sessionId!=null? SessionTime[sessionId][0].replace(':',''):'no-session'}/testuser_${moment().format('hhmmss')}`;
return `${moment().format('YYYYMM')}/${moment().format("MMDD")}/${sessionId==null? SessionTime[sessionId][0]:'no-sesion'}/${userId}`; return `${moment().format('YYYYMM')}/${moment().format("MMDD")}/${sessionId!=null? SessionTime[sessionId][0].replace(':',''):'no-session'}/${userId}`;
} }
function getUploadFolder(){ function getUploadFolder(){
return `${moment().format("YYYYMM")}/${moment().format("MMDD")}/${sessionId==null? SessionTime[sessionId][0]:'no-session'}`; return `${moment().format("YYYYMM")}/${moment().format("MMDD")}/${sessionId!=null? SessionTime[sessionId][0].replace(':',''):'no-session'}`;
} }
function reset(){ function reset(){
@ -103,6 +103,10 @@ export function UserProvider({children}) {
}, [userId]); }, [userId]);
useEffect(() => {
console.log("Session ID changed:", sessionId);
}, [sessionId]);
return ( return (
<userContext.Provider value={{ <userContext.Provider value={{

Loading…
Cancel
Save