|
187 | 187 |
|
188 | 188 | <div id="chat-log"></div> |
189 | 189 |
|
| 190 | + <div id="audio-option-row" style="display: flex; align-items: center; gap: 1em; margin-bottom: 0.5em;"> |
| 191 | + <label style="display: flex; align-items: center; gap: 0.5em; cursor: pointer; color: #37474f;"> |
| 192 | + <input id="include-audio" type="checkbox" checked style="cursor: pointer;" /> |
| 193 | + <span>음성 포함</span> |
| 194 | + </label> |
| 195 | + </div> |
| 196 | + |
190 | 197 | <div id="input-row"> |
191 | 198 | <input id="user-input" type="text" placeholder="메시지를 입력하세요" autocomplete="off" /> |
192 | 199 | <button id="send-btn">전송</button> |
|
233 | 240 | const guestIdInput = document.getElementById('guest-id'); |
234 | 241 | const loginBtn = document.getElementById('login-btn'); |
235 | 242 | const loginSection = document.getElementById('login-section'); |
| 243 | + const includeAudioCheckbox = document.getElementById('include-audio'); |
236 | 244 |
|
237 | 245 | const audioQueue = []; |
238 | 246 | let isPlayingAudio = false; |
|
272 | 280 | headers: { |
273 | 281 | 'Content-Type': 'application/json' |
274 | 282 | }, |
275 | | - body: JSON.stringify(guestId) // 문자열로 직접 전송 |
276 | | - // body: JSON.stringify({ guestId: guestId }) // JSON 객체로 전송 (Controller 수정 시) |
| 283 | + body: JSON.stringify(guestId) |
277 | 284 | }); |
278 | 285 |
|
279 | 286 | if (response.ok) { |
|
321 | 328 | const messageType = dataView.getUint8(offset); |
322 | 329 | offset += 1; |
323 | 330 |
|
324 | | - if (messageType !== 0x03) { // MESSAGE_TYPE_INTEGRATED |
325 | | - return null; // 지원하지 않는 메시지 타입 |
| 331 | + if (messageType !== 0x03) { |
| 332 | + return null; |
326 | 333 | } |
327 | 334 |
|
328 | | - // 세션 ID 읽기 |
329 | | - const sessionIdLength = dataView.getUint32(offset, true); // little-endian |
330 | | - offset += 4; |
331 | | - const sessionIdBytes = new Uint8Array(arrayBuffer, offset, sessionIdLength); |
332 | | - const sessionId = new TextDecoder().decode(sessionIdBytes); |
333 | | - offset += sessionIdLength; |
334 | | - |
335 | 335 | // 텍스트 읽기 |
336 | 336 | const textLength = dataView.getUint32(offset, true); |
337 | 337 | offset += 4; |
|
668 | 668 | userInput.value = ""; |
669 | 669 |
|
670 | 670 | const payload = { |
671 | | - actor: "web_user", |
672 | 671 | message: msg, |
673 | 672 | action: "chat", |
674 | 673 | character_id: characterSelect.value, |
675 | | - user_id: userId || "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb" |
| 674 | + use_tts: includeAudioCheckbox.checked |
676 | 675 | }; |
677 | 676 |
|
| 677 | + console.log(includeAudioCheckbox.checked) |
| 678 | + |
678 | 679 | const headers = { "Content-Type": "application/json" }; |
679 | 680 | if (authToken) { |
680 | 681 | headers["Authorization"] = `Bearer ${authToken}`; |
|
692 | 693 | } |
693 | 694 | return res.json(); |
694 | 695 | }) |
695 | | - .then(data => { |
696 | | - // sessionId 로직 제거 - 응답 처리는 WebSocket을 통해 |
697 | | - }) |
698 | 696 | .catch(err => { |
699 | 697 | appendLog(`<span style='color:red'>[HTTP 오류] ${err}</span>`); |
700 | 698 | console.error(err); |
|
0 commit comments