A-yum1 commited on
Commit
7811276
·
1 Parent(s): 2a860fb

Prepare button design

Browse files
Files changed (3) hide show
  1. templates/feedback.html +148 -117
  2. templates/index.html +168 -162
  3. templates/talkDetail.html +118 -79
templates/feedback.html CHANGED
@@ -1,136 +1,167 @@
1
  <!DOCTYPE html>
2
  <html lang="ja">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>会話フィードバック画面</title>
7
  <style>
8
- body {
9
- font-family: Arial, sans-serif;
10
- display: flex;
11
- justify-content: center;
12
- align-items: center;
13
- height: 100vh;
14
- margin: 0;
15
- background-color: #f5f5f5;
16
- }
17
- .card {
18
- border: 2px solid #000;
19
- border-radius: 20px;
20
- padding: 30px;
21
- width: 500px;
22
- text-align: center;
23
- background-color: white;
24
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
25
- }
26
- .level {
27
- font-size: 28px;
28
- font-weight: bold;
29
- margin-bottom: 20px;
30
- }
31
- .message {
32
- margin: 15px 0;
33
- font-size: 20px;
34
- font-weight: bold;
35
- color: #333;
36
- }
37
- .bar-container {
38
- display: flex;
39
- align-items: center;
40
- margin: 8px 0;
41
- }
42
- .bar-label {
43
- width: 60px;
44
- margin-right: 10px;
45
- font-weight: bold;
46
- }
47
- .bar {
48
- flex: 1;
49
- height: 25px;
50
- background-color: lightgray;
51
- border-radius: 5px;
52
- overflow: hidden;
53
- }
54
- .bar-fill {
55
- height: 100%;
56
- border-radius: 5px;
57
- }
58
- .back-button, .history-button {
59
- margin-top: 20px;
60
- padding: 10px 20px;
61
- background-color: #007bff;
62
- color: white;
63
- border: none;
64
- border-radius: 5px;
65
- cursor: pointer;
66
- }
67
- .back-button:hover, .history-button:hover {
68
- background-color: #0056b3;
69
- }
 
 
 
 
 
 
 
70
  </style>
71
  <script>
72
- function getMessage(level) {
73
- if (level < 20) return "やばい";
74
- if (level < 40) return "気をつけよう";
75
- if (level < 60) return "まずまずですね";
76
- if (level < 80) return "がんばれあとちょっと";
77
- return "素晴らしい";
78
- }
79
-
80
- function showRecorder() {
81
- window.location.href = "index.html";
82
- }
83
-
84
- function showHistory() {
85
- window.location.href = "talkDetail.html";
86
- }
87
 
88
- window.onload = function() {
89
- const level = 73; // レベル値
90
- const percentages = [80, 50, 60, 100, 30]; // 各バーのパーセンテージ
91
- const labels = ["項目1", "項目2", "項目3", "項目4", "項目5"]; // 各項目名
92
 
93
- const message = getMessage(level);
94
- document.getElementById("level").innerText = `話者Lv: ${level}`;
95
- document.getElementById("message").innerText = message;
96
 
97
- const barElements = document.getElementsByClassName("bar-fill");
98
- const labelElements = document.getElementsByClassName("bar-label");
99
- for (let i = 0; i < barElements.length; i++) {
100
- barElements[i].style.width = `${percentages[i]}%`;
101
- labelElements[i].innerText = labels[i];
102
- }
103
- };
104
  </script>
105
- </head>
106
- <body>
107
  <div class="card">
108
- <div class="level" id="level">話者Lv: 85</div>
109
- <div class="message" id="message">素晴らしい</div>
110
 
111
- <div class="bar-container">
112
- <span class="bar-label"></span>
113
- <div class="bar"><div class="bar-fill" style="background-color: lightblue;"></div></div>
 
114
  </div>
115
- <div class="bar-container">
116
- <span class="bar-label"></span>
117
- <div class="bar"><div class="bar-fill" style="background-color: peachpuff;"></div></div>
 
 
118
  </div>
119
- <div class="bar-container">
120
- <span class="bar-label"></span>
121
- <div class="bar"><div class="bar-fill" style="background-color: lightblue;"></div></div>
 
 
122
  </div>
123
- <div class="bar-container">
124
- <span class="bar-label"></span>
125
- <div class="bar"><div class="bar-fill" style="background-color: peachpuff;"></div></div>
 
 
126
  </div>
127
- <div class="bar-container">
128
- <span class="bar-label"></span>
129
- <div class="bar"><div class="bar-fill" style="background-color: lightcoral;"></div></div>
 
 
130
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
131
 
132
- <button class="back-button" onclick="showRecorder()">録音画面を表示</button>
133
- <button class="history-button" onclick="showHistory()">会話履歴を表示</button>
 
 
 
 
 
 
 
 
 
 
134
  </div>
135
- </body>
136
- </html>
 
1
  <!DOCTYPE html>
2
  <html lang="ja">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
  <title>会話フィードバック画面</title>
7
  <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ display: flex;
11
+ justify-content: center;
12
+ align-items: center;
13
+ height: 100vh;
14
+ margin: 0;
15
+ background-color: #f5f5f5;
16
+ }
17
+ .card {
18
+ border: 2px solid #000;
19
+ border-radius: 20px;
20
+ padding: 30px;
21
+ width: 500px;
22
+ text-align: center;
23
+ background-color: white;
24
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
25
+ }
26
+ .level {
27
+ font-size: 28px;
28
+ font-weight: bold;
29
+ margin-bottom: 20px;
30
+ }
31
+ .message {
32
+ margin: 15px 0;
33
+ font-size: 20px;
34
+ font-weight: bold;
35
+ color: #333;
36
+ }
37
+ .bar-container {
38
+ display: flex;
39
+ align-items: center;
40
+ margin: 8px 0;
41
+ }
42
+ .bar-label {
43
+ width: 60px;
44
+ margin-right: 10px;
45
+ font-weight: bold;
46
+ }
47
+ .bar {
48
+ flex: 1;
49
+ height: 25px;
50
+ background-color: lightgray;
51
+ border-radius: 5px;
52
+ overflow: hidden;
53
+ }
54
+ .bar-fill {
55
+ height: 100%;
56
+ border-radius: 5px;
57
+ }
58
+ .back-button,
59
+ .history-button {
60
+ margin-top: 20px;
61
+ margin-left: 20px;
62
+ padding: 10px 20px;
63
+ background-color: #007bff;
64
+ color: white;
65
+ border: none;
66
+ border-radius: 5px;
67
+ cursor: pointer;
68
+ }
69
+ .back-button:hover,
70
+ .history-button:hover {
71
+ background-color: #0056b3;
72
+ }
73
+ .flex {
74
+ display: flex;
75
+ justify-content: center;
76
+ }
77
  </style>
78
  <script>
79
+ function getMessage(level) {
80
+ if (level < 20) return "やばい";
81
+ if (level < 40) return "気をつけよう";
82
+ if (level < 60) return "まずまずですね";
83
+ if (level < 80) return "がんばれあとちょっと";
84
+ return "素晴らしい";
85
+ }
 
 
 
 
 
 
 
 
86
 
87
+ window.onload = function () {
88
+ const level = 73; // レベル値
89
+ const percentages = [80, 50, 60, 100, 30]; // 各バーのパーセンテージ
90
+ const labels = ["項目1", "項目2", "項目3", "項目4", "項目5"]; // 各項目名
91
 
92
+ const message = getMessage(level);
93
+ document.getElementById("level").innerText = `話者Lv: ${level}`;
94
+ document.getElementById("message").innerText = message;
95
 
96
+ const barElements = document.getElementsByClassName("bar-fill");
97
+ const labelElements = document.getElementsByClassName("bar-label");
98
+ for (let i = 0; i < barElements.length; i++) {
99
+ barElements[i].style.width = `${percentages[i]}%`;
100
+ labelElements[i].innerText = labels[i];
101
+ }
102
+ };
103
  </script>
104
+ </head>
105
+ <body>
106
  <div class="card">
107
+ <div class="level" id="level">話者Lv: 85</div>
108
+ <div class="message" id="message">素晴らしい</div>
109
 
110
+ <div class="bar-container">
111
+ <span class="bar-label"></span>
112
+ <div class="bar">
113
+ <div class="bar-fill" style="background-color: lightblue"></div>
114
  </div>
115
+ </div>
116
+ <div class="bar-container">
117
+ <span class="bar-label"></span>
118
+ <div class="bar">
119
+ <div class="bar-fill" style="background-color: peachpuff"></div>
120
  </div>
121
+ </div>
122
+ <div class="bar-container">
123
+ <span class="bar-label"></span>
124
+ <div class="bar">
125
+ <div class="bar-fill" style="background-color: lightblue"></div>
126
  </div>
127
+ </div>
128
+ <div class="bar-container">
129
+ <span class="bar-label"></span>
130
+ <div class="bar">
131
+ <div class="bar-fill" style="background-color: peachpuff"></div>
132
  </div>
133
+ </div>
134
+ <div class="bar-container">
135
+ <span class="bar-label"></span>
136
+ <div class="bar">
137
+ <div class="bar-fill" style="background-color: lightcoral"></div>
138
  </div>
139
+ </div>
140
+ <div class="flex">
141
+ <form method="POST" action="/index">
142
+ <div class="feedback-space">
143
+ <input
144
+ class="history-button"
145
+ id="indexButton"
146
+ type="submit"
147
+ name="submit"
148
+ value="録音画面を表示"
149
+ />
150
+ </div>
151
+ </form>
152
 
153
+ <form method="POST" action="/talk_detail">
154
+ <div class="feedback-space">
155
+ <input
156
+ class="history-button"
157
+ id="detailButton"
158
+ type="submit"
159
+ name="submit"
160
+ value="会話履歴を表示"
161
+ />
162
+ </div>
163
+ </form>
164
+ </div>
165
  </div>
166
+ </body>
167
+ </html>
templates/index.html CHANGED
@@ -1,171 +1,177 @@
1
  <!DOCTYPE html>
2
  <html lang="ja">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Voice Recorder Interface</title>
7
- <style>
8
- body {
9
- display: flex;
10
- flex-direction: column;
11
- justify-content: center;
12
- align-items: center;
13
- height: 100vh;
14
- margin: 0;
15
- background-color: #121212;
16
- color: white;
17
- }
18
- .chart {
19
- width: 300px;
20
- height: 300px;
21
- margin-bottom: 20px;
22
- }
23
- .record-button {
24
- position: fixed;
25
- bottom: 30px;
26
- width: 80px;
27
- height: 80px;
28
- background-color: transparent;
29
- border-radius: 50%;
30
- border: 4px solid white;
31
- display: flex;
32
- justify-content: center;
33
- align-items: center;
34
- cursor: pointer;
35
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
36
- transition: all 0.2s ease;
37
- }
38
- .record-icon {
39
- width: 60px;
40
- height: 60px;
41
- background-color: #d32f2f;
42
- border-radius: 50%;
43
- transition: all 0.2s ease;
44
- }
45
- .recording .record-icon {
46
- width: 40px;
47
- height: 40px;
48
- border-radius: 10%;
49
- }
50
- .result-button {
51
- margin-top: 20px;
52
- padding: 10px 20px;
53
- background-color: #4caf50;
54
- border: none;
55
- border-radius: 5px;
56
- color: white;
57
- cursor: pointer;
58
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
59
- }
60
- .result-button:hover {
61
- background-color: #388e3c;
62
- }
63
- </style>
64
- <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
65
- </head>
66
- <body>
67
- <div class="chart">
68
- <canvas id="speechChart"></canvas>
69
- </div>
70
- <button class="record-button" id="recordButton" onclick="toggleRecording()">
71
- <div class="record-icon" id="recordIcon"></div>
72
- </button>
73
- <!--
74
- <button class="result-button" id="resultButton" onclick="showResults()">結果を表示</button>
75
- -->
76
-
77
- <form method="POST" action="/feedback">
78
- <div class="feedback-space">
79
- <input class="result-button" id="resultButton" type="submit" name="submit" value="フィードバック画面を表示">
80
- </div>
81
- </form>
82
 
 
 
 
 
 
 
 
 
 
 
83
 
84
- <script>
85
- let isRecording = false;
86
- let mediaRecorder;
87
- let audioChunks = [];
88
- async function toggleRecording() {
89
- const recordButton = document.getElementById('recordButton');
90
- const recordIcon = document.getElementById('recordIcon');
91
- if (!isRecording) {
92
- // 録音開始
93
- isRecording = true;
94
- recordButton.classList.add('recording');
95
- try {
96
- const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
97
- mediaRecorder = new MediaRecorder(stream);
98
- audioChunks = [];
99
- mediaRecorder.ondataavailable = event => {
100
- if (event.data.size > 0) {
101
- audioChunks.push(event.data);
102
- }
103
- };
104
- mediaRecorder.onstop = () => {
105
- const audioBlob = new Blob(audioChunks, { type: 'audio/wav' });
106
- const reader = new FileReader();
107
- reader.onloadend = () => {
108
- const base64String = reader.result.split(',')[1]; // Base64 エンコードされた音声データ
109
- // サーバーへ音声データを送信
110
- fetch('/upload_audio', {
111
- method: 'POST',
112
- headers: {
113
- 'Content-Type': 'application/json',
114
- },
115
- body: JSON.stringify({ audio_data: base64String }),
116
- })
117
- .then(response => response.json())
118
- .then(data => {
119
- alert('音声がバックエンドに送信されました。');
120
- })
121
- .catch(error => {
122
- console.error('エラー:', error);
123
- });
 
 
 
 
124
  };
125
- reader.readAsDataURL(audioBlob);
126
- };
127
- mediaRecorder.start();
128
- } catch (error) {
129
- console.error('マイクへのアクセスに失敗しました:', error);
 
 
 
130
  isRecording = false;
131
- recordButton.classList.remove('recording');
132
- }
133
- } else {
134
- // 録音停止
135
- isRecording = false;
136
- recordButton.classList.remove('recording');
137
- if (mediaRecorder && mediaRecorder.state !== 'inactive') {
138
- mediaRecorder.stop();
139
- }
140
- }
141
- }
142
- function showResults() {
143
- window.location.href = 'feedback.html';
144
- }
145
- // Chart.js の初期化
146
- const ctx = document.getElementById('speechChart').getContext('2d');
147
- const speechChart = new Chart(ctx, {
148
- type: 'doughnut',
149
- data: {
150
- labels: ['自分', '他の人'],
151
- datasets: [{
152
- data: [30, 70],
153
- backgroundColor: ['#4caf50', '#757575'],
154
- }],
155
- },
156
- options: {
157
- responsive: true,
158
- plugins: {
159
- legend: {
160
- display: true,
161
- position: 'bottom',
162
- labels: {
163
- color: 'white'
164
- }
165
  }
166
  }
167
  }
168
- });
169
- </script>
170
- </body>
171
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <!DOCTYPE html>
2
  <html lang="ja">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Voice Recorder Interface</title>
7
+ <style>
8
+ body {
9
+ display: flex;
10
+ flex-direction: column;
11
+ justify-content: center;
12
+ align-items: center;
13
+ height: 100vh;
14
+ margin: 0;
15
+ background-color: #121212;
16
+ color: white;
17
+ }
18
+ .chart {
19
+ width: 300px;
20
+ height: 300px;
21
+ margin-bottom: 20px;
22
+ }
23
+ .record-button {
24
+ position: fixed;
25
+ bottom: 30px;
26
+ width: 80px;
27
+ height: 80px;
28
+ background-color: transparent;
29
+ border-radius: 50%;
30
+ border: 4px solid white;
31
+ display: flex;
32
+ justify-content: center;
33
+ align-items: center;
34
+ cursor: pointer;
35
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
36
+ transition: all 0.2s ease;
37
+ }
38
+ .record-icon {
39
+ width: 60px;
40
+ height: 60px;
41
+ background-color: #d32f2f;
42
+ border-radius: 50%;
43
+ transition: all 0.2s ease;
44
+ }
45
+ .recording .record-icon {
46
+ width: 40px;
47
+ height: 40px;
48
+ border-radius: 10%;
49
+ }
50
+ .result-button {
51
+ margin-top: 20px;
52
+ padding: 10px 20px;
53
+ background-color: #4caf50;
54
+ border: none;
55
+ border-radius: 5px;
56
+ color: white;
57
+ cursor: pointer;
58
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
59
+ }
60
+ .result-button:hover {
61
+ background-color: #388e3c;
62
+ }
63
+ .result {
64
+ display: flex;
65
+ }
66
+ </style>
67
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
68
+ </head>
69
+ <body>
70
+ <div class="chart">
71
+ <canvas id="speechChart"></canvas>
72
+ </div>
73
+ <button class="record-button" id="recordButton" onclick="toggleRecording()">
74
+ <div class="record-icon" id="recordIcon"></div>
75
+ </button>
 
 
 
 
 
 
76
 
77
+ <form method="POST" action="/feedback">
78
+ <div class="result">
79
+ <button class="result-button" id="resultButton" onclick="showHistory()">
80
+ 会話履歴を表示
81
+ </button>
82
+ <button class="result-button" id="resultButton" onclick="showResults()">
83
+ フィードバック画面を表示
84
+ </button>
85
+ </div>
86
+ </form>
87
 
88
+ <script>
89
+ let isRecording = false;
90
+ let mediaRecorder;
91
+ let audioChunks = [];
92
+ async function toggleRecording() {
93
+ const recordButton = document.getElementById("recordButton");
94
+ const recordIcon = document.getElementById("recordIcon");
95
+ if (!isRecording) {
96
+ // 録音開始
97
+ isRecording = true;
98
+ recordButton.classList.add("recording");
99
+ try {
100
+ const stream = await navigator.mediaDevices.getUserMedia({
101
+ audio: true,
102
+ });
103
+ mediaRecorder = new MediaRecorder(stream);
104
+ audioChunks = [];
105
+ mediaRecorder.ondataavailable = (event) => {
106
+ if (event.data.size > 0) {
107
+ audioChunks.push(event.data);
108
+ }
109
+ };
110
+ mediaRecorder.onstop = () => {
111
+ const audioBlob = new Blob(audioChunks, { type: "audio/wav" });
112
+ const reader = new FileReader();
113
+ reader.onloadend = () => {
114
+ const base64String = reader.result.split(",")[1]; // Base64 エンコードされた音声データ
115
+ // サーバーへ音声データを送信
116
+ fetch("/upload_audio", {
117
+ method: "POST",
118
+ headers: {
119
+ "Content-Type": "application/json",
120
+ },
121
+ body: JSON.stringify({ audio_data: base64String }),
122
+ })
123
+ .then((response) => response.json())
124
+ .then((data) => {
125
+ alert("音声がバックエンドに送信されました。");
126
+ })
127
+ .catch((error) => {
128
+ console.error("エラー:", error);
129
+ });
130
+ };
131
+ reader.readAsDataURL(audioBlob);
132
  };
133
+ mediaRecorder.start();
134
+ } catch (error) {
135
+ console.error("マイクへのアクセスに失敗しました:", error);
136
+ isRecording = false;
137
+ recordButton.classList.remove("recording");
138
+ }
139
+ } else {
140
+ // 録音停止
141
  isRecording = false;
142
+ recordButton.classList.remove("recording");
143
+ if (mediaRecorder && mediaRecorder.state !== "inactive") {
144
+ mediaRecorder.stop();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  }
146
  }
147
  }
148
+
149
+ // Chart.js の初期化
150
+ const ctx = document.getElementById("speechChart").getContext("2d");
151
+ const speechChart = new Chart(ctx, {
152
+ type: "doughnut",
153
+ data: {
154
+ labels: ["自分", "他の人"],
155
+ datasets: [
156
+ {
157
+ data: [30, 70],
158
+ backgroundColor: ["#4caf50", "#757575"],
159
+ },
160
+ ],
161
+ },
162
+ options: {
163
+ responsive: true,
164
+ plugins: {
165
+ legend: {
166
+ display: true,
167
+ position: "bottom",
168
+ labels: {
169
+ color: "white",
170
+ },
171
+ },
172
+ },
173
+ },
174
+ });
175
+ </script>
176
+ </body>
177
+ </html>
templates/talkDetail.html CHANGED
@@ -1,97 +1,136 @@
1
  <!DOCTYPE html>
2
  <html lang="ja">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>会話表示画面</title>
7
  <style>
8
- body {
9
- font-family: Arial, sans-serif;
10
- margin: 0;
11
- padding: 20px;
12
- background-color: #f4f4f4;
13
- height: 100vh;
14
- display: flex;
15
- justify-content: center;
16
- align-items: center;
17
- }
18
- .container {
19
- max-width: 800px;
20
- background-color: #fff;
21
- padding: 20px;
22
- border-radius: 8px;
23
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
24
- }
25
- h2 {
26
- margin-bottom: 20px;
27
- }
28
- #transcription {
29
- white-space: pre-wrap;
30
- padding: 10px;
31
- background-color: #e9e9e9;
32
- border-radius: 4px;
33
- margin-bottom: 20px;
34
- max-height: 400px;
35
- overflow-y: auto;
36
- }
37
- button {
38
- margin: 5px;
39
- padding: 10px 20px;
40
- border: none;
41
- border-radius: 4px;
42
- background-color: #007bff;
43
- color: #fff;
44
- cursor: pointer;
45
- }
46
- button:hover {
47
- background-color: #0056b3;
48
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  </style>
50
- </head>
51
- <body>
52
  <div class="container">
53
- <h2>会話の文字起こし表示</h2>
54
- <div id="transcription">ここに会話内容が表示されます。</div>
55
- <button onclick="showRecorder()">録音画面を表示</button>
56
- <button onclick="showHistory()">フィードバック画面を表示</button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  </div>
58
 
59
  <script>
60
- // 会話データを表示
61
- async function displayTranscription() {
62
- const transcriptionElement = document.getElementById('transcription');
63
 
64
- try {
65
- // バックエンドからデータを取得(デモ用のURLを指定)
66
- const response = await fetch('/api/transcription');
67
- if (!response.ok) throw new Error('データ取得に失敗しました。');
68
 
69
- const data = await response.json();
70
 
71
- // 会話内容を整形して表示
72
- const formattedText = data.conversations.map((conv, index) =>
73
- `【${conv.speaker}】 ${conv.text}`
74
- ).join('\n');
75
 
76
- transcriptionElement.textContent = formattedText;
77
- } catch (error) {
78
- transcriptionElement.textContent = `エラー: ${error.message}`;
79
- console.error('データ取得エラー:', error);
80
- }
81
  }
 
82
 
83
- // 録音画面に戻る
84
- function showRecorder() {
85
- window.location.href = 'index.html';
86
- }
87
 
88
- // フィードバック画面に移動
89
- function showHistory() {
90
- window.location.href = 'feedback.html';
91
- }
92
 
93
- // 初期化処理
94
- displayTranscription();
95
  </script>
96
- </body>
97
- </html>
 
1
  <!DOCTYPE html>
2
  <html lang="ja">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
  <title>会話表示画面</title>
7
  <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ margin: 0;
11
+ padding: 20px;
12
+ background-color: #f4f4f4;
13
+ height: 100vh;
14
+ display: flex;
15
+ justify-content: center;
16
+ align-items: center;
17
+ }
18
+ .container {
19
+ max-width: 800px;
20
+ background-color: #fff;
21
+ padding: 20px;
22
+ border-radius: 8px;
23
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
24
+ }
25
+ h2 {
26
+ margin-bottom: 20px;
27
+ }
28
+ #transcription {
29
+ white-space: pre-wrap;
30
+ padding: 10px;
31
+ background-color: #e9e9e9;
32
+ border-radius: 4px;
33
+ margin-bottom: 20px;
34
+ max-height: 400px;
35
+ overflow-y: auto;
36
+ }
37
+ button {
38
+ margin: 5px;
39
+ padding: 10px 20px;
40
+ border: none;
41
+ border-radius: 4px;
42
+ background-color: #007bff;
43
+ color: #fff;
44
+ cursor: pointer;
45
+ }
46
+ .history-button {
47
+ margin: 5px;
48
+ padding: 10px 20px;
49
+ border: none;
50
+ border-radius: 4px;
51
+ background-color: #007bff;
52
+ color: #fff;
53
+ cursor: pointer;
54
+ }
55
+ history-button:hover {
56
+ background-color: #0056b3;
57
+ }
58
+ button:hover {
59
+ background-color: #0056b3;
60
+ }
61
+ .flex {
62
+ display: flex;
63
+ justify-content: center;
64
+ }
65
  </style>
66
+ </head>
67
+ <body>
68
  <div class="container">
69
+ <h2>会話の文字起こし表示</h2>
70
+ <div id="transcription">ここに会話内容が表示されます。</div>
71
+ <div class="flex">
72
+ <form method="POST" action="/index">
73
+ <div class="feedback-space">
74
+ <input
75
+ class="history-button"
76
+ id="indexButton"
77
+ type="submit"
78
+ name="submit"
79
+ value="録音画面を表示"
80
+ />
81
+ </div>
82
+ </form>
83
+
84
+ <form method="POST" action="/feedback">
85
+ <div class="feedback-space">
86
+ <input
87
+ class="history-button"
88
+ id="feedbackButton"
89
+ type="submit"
90
+ name="submit"
91
+ value="フィードバック画面を表示"
92
+ />
93
+ </div>
94
+ </form>
95
+ </div>
96
  </div>
97
 
98
  <script>
99
+ // 会話データを表示
100
+ async function displayTranscription() {
101
+ const transcriptionElement = document.getElementById("transcription");
102
 
103
+ try {
104
+ // バックエンドからデータを取得(デモ用のURLを指定)
105
+ const response = await fetch("/api/transcription");
106
+ if (!response.ok) throw new Error("データ取得に失敗しました。");
107
 
108
+ const data = await response.json();
109
 
110
+ // 会話内容を整形して表示
111
+ const formattedText = data.conversations
112
+ .map((conv, index) => `【${conv.speaker}】 ${conv.text}`)
113
+ .join("\n");
114
 
115
+ transcriptionElement.textContent = formattedText;
116
+ } catch (error) {
117
+ transcriptionElement.textContent = `エラー: ${error.message}`;
118
+ console.error("データ取得エラー:", error);
 
119
  }
120
+ }
121
 
122
+ // 録音画面に戻る
123
+ function showRecorder() {
124
+ window.location.href = "index.html";
125
+ }
126
 
127
+ // フィードバック画面に移動
128
+ function showHistory() {
129
+ window.location.href = "feedback.html";
130
+ }
131
 
132
+ // 初期化処理
133
+ displayTranscription();
134
  </script>
135
+ </body>
136
+ </html>