diff --git a/vite/public/assets/q4-2.mp3 b/vite/public/assets/q4-2.mp3
index a579446..d16827e 100644
Binary files a/vite/public/assets/q4-2.mp3 and b/vite/public/assets/q4-2.mp3 differ
diff --git a/vite/public/assets/q4-2__.mp3 b/vite/public/assets/q4-2__.mp3
new file mode 100644
index 0000000..a579446
Binary files /dev/null and b/vite/public/assets/q4-2__.mp3 differ
diff --git a/vite/public/cuelist_free.json b/vite/public/cuelist_free.json
index e2dc6d1..a99fb64 100644
--- a/vite/public/cuelist_free.json
+++ b/vite/public/cuelist_free.json
@@ -34,7 +34,7 @@
"type": "phone",
"description": "引導撥號",
"auto": false,
- "audioFile": "assets/0721/onyx/q4.mp3",
+ "audioFile": "assets/q4.mp3",
"nextcue": 4.1,
"callback":"numpad"
},
@@ -44,7 +44,7 @@
"type": "phone",
"description": "電話開頭",
"auto": true,
- "audioFile": "assets/0721/onyx/q4-1.mp3",
+ "audioFile": "assets/q4-1.mp3",
"nextcue": 4.2
},
{
@@ -53,7 +53,7 @@
"type": "phone",
"description": "示範影片,引導回憶",
"auto": true,
- "audioFile": "assets/0721/onyx/q4-2.mp3",
+ "audioFile": "assets/q4-2.mp3",
"nextcue": 4.3,
"status":"intro",
"callback":"fade_out_light"
@@ -99,7 +99,7 @@
"name": "Q5.3",
"type": "phone",
"description": "ending",
- "audioFile": "assets/0721/onyx/q5-2.mp3",
+ "audioFile": "assets/q5-2.mp3",
"auto": true,
"nextcue": 6
},
diff --git a/vite/src/comps/debug.jsx b/vite/src/comps/debug.jsx
index 4653b66..35d2e40 100644
--- a/vite/src/comps/debug.jsx
+++ b/vite/src/comps/debug.jsx
@@ -1,7 +1,7 @@
import { sendOsc, OSC_ADDRESS, updatePrompt } from "../util/osc"
import { useData } from '../util/useData.jsx';
-const TEST_PROMPT='a hazy memory of a {{ light }}, seen through soft atmospheric blur, distant silhouettes and faded contours, pastel light and cinematic haze, (analog film texture), (shallow depth of field:1.3), shallow depth of field, memory fragment effect, light leak, subtle grain, chromatic aberration, surreal glow, in muted warm tones, cinematic framing,';
+export const TEST_PROMPT='A distant, ambient setting with gentle light';
export function DebugControl({refLight}){
diff --git a/vite/src/pages/flow_free.jsx b/vite/src/pages/flow_free.jsx
index e3faf67..709aa9a 100644
--- a/vite/src/pages/flow_free.jsx
+++ b/vite/src/pages/flow_free.jsx
@@ -11,7 +11,7 @@ import { Light } from "../comps/light";
import { useData } from "../util/useData";
import VoiceAnalysis from "../comps/voiceanalysis";
import { sendOsc, OSC_ADDRESS, updatePrompt } from "../util/osc";
-import { DebugControl } from "../comps/debug";
+import { DebugControl, TEST_PROMPT } from "../comps/debug";
const EmojiType={
@@ -27,6 +27,7 @@ const ChatStatus={
System: 'system',
User: 'user',
Processing: 'processing',
+ Clear: 'clear',
}
const Voice={
@@ -104,6 +105,24 @@ export function FreeFlow(){
if(refCurrentCue.current?.type!='chat') onCueEnd();
else{
setChatStatus(ChatStatus.User); // Reset chat status to User after audio ends
+
+
+ // if history contains user input, send it
+ const user_input = history.find(msg => msg.role === 'user');
+ if(user_input && user_input.content.trim() !== '') {
+ sendOsc(OSC_ADDRESS.STATUS, 'go'); // Send OSC status message
+ }
+
+
+ // send prompt
+ let raw_prompt=history[history.length-1]?.prompt || '';
+
+ if(raw_prompt && raw_prompt.trim() !== '') {
+ const prompt = `${data?.sd_prompt_prefix || ''}${raw_prompt}${data?.sd_prompt_suffix || ''}`;
+
+ updatePrompt(prompt);
+ sendOsc(OSC_ADDRESS.PROMPT, prompt);
+ }
}
}
@@ -112,7 +131,8 @@ export function FreeFlow(){
if(refCurrentCue.current?.type!='chat' && refCurrentCue.current?.type!='user_input') {
refTimer.current?.restart(audio.duration*1000 || 0);
}else{
- setChatStatus(()=>ChatStatus.System);
+ if(refCurrentCue.current?.type=='chat') setChatStatus(()=>ChatStatus.System);
+ else setChatStatus(()=>ChatStatus.Clear);
}
});
}
@@ -129,7 +149,7 @@ export function FreeFlow(){
console.log('clear conversation...');
reset();
- const prompt = `${data?.sd_prompt_prefix || ''}${'memory'}${data?.sd_prompt_suffix || ''}`;
+ const prompt = `${data?.sd_prompt_prefix || ''}${TEST_PROMPT}${data?.sd_prompt_suffix || ''}`;
updatePrompt(prompt);
}
@@ -149,10 +169,12 @@ export function FreeFlow(){
console.log('Ending conversation with message:', message);
sendMessage(message, false, true, voice);
setChatWelcome(false);
-
+ setChatStatus(ChatStatus.Clear);
break;
case 'summary':
console.log('Getting summary...');
+
+ setChatStatus(ChatStatus.Clear); // Set chat status to Processing
getSummary(history.map(el=>`${el.role}:${el.content}`).join('\n'), data).then(summary => {
console.log('Summary:', summary);
@@ -164,6 +186,7 @@ export function FreeFlow(){
}).catch(error => {
console.error('Error getting summary:', error);
});
+
break;
case 'user_input':
console.log('User input cue, setting chat status to User');
@@ -189,7 +212,7 @@ export function FreeFlow(){
// control unity
- if(cue.status){
+ if(cue.status && cue.status!='go') {
sendOsc(OSC_ADDRESS.STATUS, cue.status); // Send OSC status message
if(cue.status=='reset') {
refLight.current.set(1);
@@ -302,7 +325,7 @@ export function FreeFlow(){
}
useEffect(()=>{
- console.log('Final transcript changed:', finalTranscript);
+ // console.log('Final transcript changed:', finalTranscript);
if(finalTranscript.trim().length > 0) {
onSpeechEnd();
}
@@ -382,7 +405,7 @@ export function FreeFlow(){
useEffect(()=>{
switch(status) {
case Status.SUCCESS:
- console.log('Success!');
+ console.log('Success!');
setStatus(Status.IDLE);
refInput.current.value = '';
@@ -425,11 +448,11 @@ export function FreeFlow(){