2025_moty
reng 2 weeks ago
parent 76cc10131e
commit a6a2e61c03
  1. 5
      vite/src/comps/numpad.jsx
  2. 31
      vite/src/pages/flow_moty.jsx
  3. 2
      vite/src/util/system_prompt.js

@ -23,7 +23,7 @@ const TMP_MAP_KEY={
7:9,*/
}
export default function NumPad({onSend, disabled, type, clientId}){
export default function NumPad({onSend, disabled, type, clientId, onUserInput, ...props}){
const [input, _setInput]=useState();
const refInput=useRef();
@ -54,6 +54,7 @@ export default function NumPad({onSend, disabled, type, clientId}){
console.log(e.key);
onUserInput();
if(disabled) return; // Ignore key events if disabled
@ -196,7 +197,7 @@ export default function NumPad({onSend, disabled, type, clientId}){
useEffect(()=>{
if(disabled) return;
// if(disabled) return;
window.onkeydown=onkeydown;

@ -256,7 +256,7 @@ export function FlowMoty(){
audio.loop=refCurrentCue.current?.loop || false; // Set loop if defined in cue
audio.volume=1.0;
audio.addEventListener("loadedmetadata", () => {
if(refCurrentCue.current?.type!='chat' && refCurrentCue.current?.type!='user_input') {
@ -313,6 +313,11 @@ export function FlowMoty(){
refAudio.current = audio; // Store the new audio reference
}
function setAudioVol(vol){
if(refAudio.current){
refAudio.current.volume=vol;
}
}
function fadeOutAudio(callback){
if(refVolDownInterval.current) clearInterval(refVolDownInterval.current);
@ -901,15 +906,15 @@ export function FlowMoty(){
if(refCurrentCue.current?.type!='chat') return;
if(audioUrl){
if(refSpeaking.current) {
console.log('Still speaking, do not play AI audio yet');
sendPrompt();
return;
}else{
// if(refSpeaking.current) {
// console.log('Still speaking, do not play AI audio yet');
// sendPrompt();
// return;
// }else{
// play ai audio
console.log('AI audio ready, play it:', audioUrl);
playAudio(audioUrl);
}
// }
}
},[audioUrl]);
@ -1032,8 +1037,18 @@ export function FlowMoty(){
{/* <button onClick={saveImage}>Save image</button> */}
<NumPad onSend={onNumpad}
disabled={currentCue?.callback !== 'numpad' || !inputReady}
disabled={currentCue?.callback !== 'numpad'}
type={currentCue?.numpad_type}
onUserInput={()=>{
if(refCurrentCue.current?.numpad_type==NUMPAD_TYPE.PHONE){
console.log('on user input');
if(refInputTimeout.current) clearTimeout(refInputTimeout.current);
setAudioVol(0);
setInputReady(() => true);
}
}}
clientId={data?.id}
/>
{/* <Light ref={refLight} /> */}

@ -37,7 +37,7 @@ export const DefaultParams__ = {
export const DefaultParams = {
"system_prompt": "你是一位能產生圖像的 AI 助理,專長是以幽默、俏皮式的提問,帶領使用者輕鬆玩味想像中的美好未來。你的任務是逐步引導使用者自由、充滿創意地描述那幅美好畫面,並將他們的描述化為圖像生成提示詞,讓畫面從遠景漸漸聚焦到未來的自己與場景。生成的圖像應避免僅有人臉正面特寫,而是包含背景元素,以側面或背影呈現人物。每次以台灣繁體中文,用一個輕鬆、有趣的短問句提問。若使用者回答與「美好未來」無關,試著調皮地提醒他們回到「遊戲」畫面中,但不強迫。AI助理不得自行創造或描述場景內容,所有圖像提示詞都必須嚴格基於使用者的回答。",
"welcome_prompt": `請開始引導使用者回想一段內心的遺憾或未竟之事。`,
"welcome_prompt": `請開始引導使用者描繪他心中的美好未來`,
"voice": "onyx",
"voice_prompt": "Speak as a gentle, grounded Taiwanese narrator with a warm local accent. Use a soft, soothing, and deeply compassionate tone, with slow and deliberate pacing. Pause often between phrases and within sentences, as if listening and breathing with the listener. Convey patient attentiveness—not rushing to comfort, but quietly staying present. Pronounce each word clearly, softly, and slightly slowly, letting every word land with warmth and care.",
"summary_prompt": "請將這段口白的核心感受,轉化為一句對畫面中「未來的自己」或「未來場景」的告白或陳述,不超過 50 個字。這句話是第一人稱對第二人稱說的話,語氣要能讓人感受到一種淡淡的、未完待續的心情,同時帶點希望。請使用台灣語境的繁體中文。",

Loading…
Cancel
Save