JusTalk / templates /talkDetail.html
A-yum1's picture
Update talkDetail.html
0f43ba4
raw
history blame
2.63 kB
<!DOCTYPE html>
<html lang="ja" class="dark">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>会話詳細画面</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body
class="bg-gray-100 dark:bg-gray-900 text-gray-900 dark:text-gray-100 min-h-screen flex items-center justify-center"
>
<div
class="container mx-auto p-6 bg-white dark:bg-gray-800 shadow-lg rounded-2xl"
>
<h2 class="text-2xl font-semibold mb-4">会話の文字起こし表示</h2>
<div
id="transcription"
class="p-4 bg-gray-200 dark:bg-gray-700 rounded-lg mb-4 max-h-96 overflow-y-auto"
>
ここに会話内容が表示されます。
</div>
<div class="flex justify-center gap-4">
<button
class="px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors"
onclick="showRecorder()"
>
録音画面を表示
</button>
<button
class="px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors"
onclick="showFeedback()"
>
フィードバック画面を表示
</button>
</div>
</div>
<script>
async function displayTranscription() {
const transcriptionElement = document.getElementById("transcription");
try {
const response = await fetch("/transcription");
if (!response.ok) throw new Error("データ取得に失敗しました。");
const data = await response.json();
const conversations = data.transcription;
if (!data || !data.transcription) {
throw new Error("会話データが見つかりませんでした。");
}
/*
const formattedText = conversations
.map((conv) => `【${conv.speaker}】 ${conv.text}`)
.join("\n");
console.log("フォーマットテキスト:", formattedText);
transcriptionElement.textContent = formattedText;
*/
transcriptionElement.textContent = conversations;
console.log(conversations);
} catch (error) {
transcriptionElement.textContent = `エラー: ${error.message}`;
console.error("データ取得エラー:", error);
}
}
displayTranscription();
function showRecorder() {
window.location.href = "/index";
}
function showFeedback() {
window.location.href = "/feedback";
}
</script>
</body>
</html>