# Conflicts:
#	vite/public/cuelist_0923.json
main
ULTRACOMBOS-DEV 2 months ago
commit 0ec85a7f10
  1. BIN
      vite/public/assets/combine/Q5-4.mp3
  2. BIN
      vite/public/assets/combine/Q5-5.mp3
  3. BIN
      vite/public/assets/debug-1.mp3
  4. BIN
      vite/public/assets/debug-2.mp3
  5. 39
      vite/public/cuelist_0923.json
  6. 2
      vite/src-tauri/capabilities/default.json
  7. 36
      vite/src/pages/flow_free.jsx
  8. 22
      vite/src/util/backend.js

Binary file not shown.

Binary file not shown.

@ -54,18 +54,17 @@
"id": 4.1,
"name": "Q4.1",
"type": "phone",
"description": "撥打音效",
"description": "輸入完成,請描述腦中的記憶畫面",
"auto": false,
"audioFile": "assets/combine/Q4-1_撥打音效.mp3",
"loop": true,
"nextcue": 4.11,
"fadeout":true
"nextcue": 4.11
},
{
"id": 4.11,
"name": "Q4.11",
"type": "phone",
"description": "裝置啟動",
"description": "裝置啟動音效",
"auto": true,
"audioFile": "assets/combine/Q4-1-1.mp3",
"nextcue": 4.2,
@ -141,7 +140,7 @@
"audioFile": "assets/combine/Q5-4.mp3",
"callback":"numpad",
"numpad_type":"password",
"hint":"請設定一組四位數密碼\n確定輸入後,請按#",
"hint":"請輸入四位數密碼\n確定輸入後,請按#",
"hint_time": 7800,
"default_password":"0000"
},
@ -155,7 +154,7 @@
"audioFile": "assets/combine/Q5-5.mp3",
"callback":"numpad",
"numpad_type":"password",
"hint":"請設定一組四位數密碼\n確定輸入後,請按#",
"hint":"請輸入四位數密碼\n確定輸入後,請按#",
"hint_time": 7900,
"default_password":"0000"
},
@ -177,7 +176,6 @@
"auto": false,
"audioFile": "assets/combine/Q6_管家announce_0919.mp3",
"layer":"announce",
"fadeoutBg":true,
"fadeout": true
},
{
@ -187,6 +185,33 @@
"description": "Ending",
"status":"end",
"callback":"fadeout"
},
{
"id": 101,
"name": "Q101",
"type": "debug",
"description": "DEBUG_MODE",
"audioFile": "assets/debug-1.mp3",
"loop": true,
"status":"intro",
"callback":"numpad",
"nextcue": 102,
"numpad_type":"password"
},
{
"id": 102,
"name": "Q102",
"type": "debug",
"description": "DEBUG_MODE",
"audioFile": "assets/debug-2.mp3",
"auto": true,
"nextcue": 103
},
{
"id": 103,
"name": "Q103",
"type": "chat",
"description": "DEBUG_MODE_CHAT"
}
]
}

@ -24,6 +24,8 @@
"url": "http://**/"
},{
"url":"https://script.google.com/macros/s/AKfycbxpXbWhMdd4nv0KHhSzeFTKIV0tqsh-HBKCdlaOT34sh2vl1H5aoa36QnimhQg8I2aKRw/exec"
},{
"url":"https://script.google.com/macros/s/AKfycbx-Ytlql0yAdVsENNbcaCdXglerX7sNLpNggtusqp4TxebiA3C7V0xjGe4jaI4m1sVjWQ/exec"
}
]
},

@ -60,6 +60,8 @@ export function FreeFlow(){
const [padInput, setPadInput] = useState(null);
const [showMessage, setShowMessage] = useState(false);
const { userId, setUserId, getFileId, setPassword, reset:resetUser, uploadHistory, setSummary, summary,setChoice,choice, getUploadFolder,getDataId, writeSheet } = useUser();
const refTimer=useRef();
@ -83,6 +85,7 @@ export function FreeFlow(){
const refHintTimeout=useRef();
const refFadeOutInterval=useRef();
const refVolDownInterval=useRef();
const { history, status, reset, sendMessage, setStatus, audioOutput, setAudioOutput, stop:stopChat,
audioUrl }=useChat();
@ -183,6 +186,26 @@ export function FreeFlow(){
refAudioAnnounce.current.play().catch(error => {
console.error("Audio announce playback error:", error);
});
// lower audio
if(refAudio.current) {
// fade out current audio
if(refVolDownInterval.current){
clearInterval(refVolDownInterval.current);
}
const dest=0.5;
let fadeOutInterval = setInterval(() => {
if (refAudio.current.volume > dest) {
refAudio.current.volume =Math.max(dest, refAudio.current.volume - 1.0/(AUDIO_FADE_TIME/100)); // Decrease volume gradually
} else {
clearInterval(fadeOutInterval);
}
}, 100);
refVolDownInterval.current=fadeOutInterval;
}
return;
}
@ -659,6 +682,11 @@ export function FreeFlow(){
});
}
function blurText(text) {
if(!text) return '';
return text.replace(/./g, '*');
}
useEffect(()=>{
if(audioInput && isMicrophoneAvailable) {
@ -895,17 +923,17 @@ export function FreeFlow(){
</div>
</section>
<section className="flex-1 self-stretch overflow-y-auto flex flex-col justify-end gap-2 ">
<div ref={refContainer} className="flex-1 flex flex-col overflow-y-auto gap-2">
<div ref={refContainer} className="flex-1 flex flex-col overflow-y-auto gap-2 blur-sm" >
{history?.map((msg, index) => (
<div key={index} className={`w-5/6 ${msg.role=='user'? 'self-end':''}`}>
<div className={`${msg.role=='user'? 'bg-green-300':'bg-pink-300'} px-2`}>{msg.content}</div>
{msg.prompt && <div className="text-xs bg-gray-200">{msg.prompt}</div>}
<div className={`${msg.role=='user'? 'bg-green-300':'bg-pink-300'} px-2`}>{blurText(msg.content)}</div>
{msg.prompt && <div className="text-xs bg-gray-200">{blurText(msg.prompt)}</div>}
</div>
))}
{summary && <div className="w-full self-center bg-blue-200 px-2">{summary}</div>}
</div>
<textarea ref={refInput} name="message" rows={2}
className={`w-full border-1 resize-none p-2 disabled:bg-gray-500`}
className={`w-full border-1 resize-none p-2 disabled:bg-gray-500 blur-sm`}
disabled={chatStatus!=ChatStatus.User && chatStatus!=ChatStatus.Message}></textarea>
<div className="flex flex-row justify-end gap-2 flex-wrap">
<span className="flex flex-row gap-1">

@ -36,25 +36,31 @@ export async function updateUser(id, data){
}
const APPSCRIPT_URL='https://script.google.com/macros/s/AKfycbx-Ytlql0yAdVsENNbcaCdXglerX7sNLpNggtusqp4TxebiA3C7V0xjGe4jaI4m1sVjWQ/exec';
// const APPSCRIPT_URL='https://script.google.com/macros/s/AKfycbxpXbWhMdd4nv0KHhSzeFTKIV0tqsh-HBKCdlaOT34sh2vl1H5aoa36QnimhQg8I2aKRw/exec';
export async function writeToGoogleSheet(date, session, userId, password){
if(!date || !session) {
console.error("Invalid data for writeToGoogleSheet");
return;
}
try{
await fetch(`https://script.google.com/macros/s/AKfycbxpXbWhMdd4nv0KHhSzeFTKIV0tqsh-HBKCdlaOT34sh2vl1H5aoa36QnimhQg8I2aKRw/exec`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
let tosend={
"date":date,
"session":session,
"userId":userId?.toString(),
"password":password?.toString(),
"createdTime": new Date().toLocaleString()
})
};
console.log("Data to send to Google Sheet: ", tosend);
try{
await fetch(APPSCRIPT_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(tosend)
});
console.log("Data successfully sent to Google Sheet!");

Loading…
Cancel
Save