Spaces:
Runtime error
Runtime error
| <html lang="ja"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>会話表示画面</title> | |
| <style> | |
| body { | |
| font-family: Arial, sans-serif; | |
| margin: 0; | |
| padding: 20px; | |
| background-color: #f4f4f4; | |
| } | |
| .container { | |
| max-width: 800px; | |
| margin: 0 auto; | |
| background-color: #fff; | |
| padding: 20px; | |
| border-radius: 8px; | |
| box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | |
| } | |
| h2 { | |
| margin-bottom: 20px; | |
| } | |
| #transcription { | |
| white-space: pre-wrap; | |
| padding: 10px; | |
| background-color: #e9e9e9; | |
| border-radius: 4px; | |
| margin-bottom: 20px; | |
| max-height: 400px; | |
| overflow-y: auto; | |
| } | |
| button { | |
| margin: 5px; | |
| padding: 10px 20px; | |
| border: none; | |
| border-radius: 4px; | |
| background-color: #007bff; | |
| color: #fff; | |
| cursor: pointer; | |
| } | |
| button:hover { | |
| background-color: #0056b3; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <h2>会話の文字起こし表示</h2> | |
| <div id="transcription">ここに会話内容が表示されます。</div> | |
| <button onclick="goToRecording()">録音画面</button> | |
| <button onclick="goToFeedback()">フィードバック画面</button> | |
| </div> | |
| <script> | |
| // 会話データを表示 | |
| async function displayTranscription() { | |
| const transcriptionElement = document.getElementById('transcription'); | |
| try { | |
| // バックエンドからデータを取得(デモ用のURLを指定) | |
| const response = await fetch('/api/transcription'); | |
| if (!response.ok) throw new Error('データ取得に失敗しました。'); | |
| const data = await response.json(); | |
| // 会話内容を整形して表示 | |
| const formattedText = data.conversations.map((conv, index) => | |
| `【${conv.speaker}】 ${conv.text}` | |
| ).join('\n'); | |
| transcriptionElement.textContent = formattedText; | |
| } catch (error) { | |
| transcriptionElement.textContent = `エラー: ${error.message}`; | |
| console.error('データ取得エラー:', error); | |
| } | |
| } | |
| // 録音画面に戻る | |
| function goToRecording() { | |
| window.location.href = 'index.html'; | |
| } | |
| // フィードバック画面に移動 | |
| function goToFeedback() { | |
| window.location.href = 'feedback.html'; | |
| } | |
| // 初期化処理 | |
| displayTranscription(); | |
| </script> | |
| </body> | |
| </html> |