A-yum1 commited on
Commit
120f536
·
1 Parent(s): 6ffdbaf

Prepare button design

Browse files
Files changed (3) hide show
  1. feedback.html +144 -115
  2. index.html +169 -157
  3. talkDetail.html +114 -86
feedback.html CHANGED
@@ -1,138 +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
- window.onload = function() {
81
- const level = 73; // レベル値
82
- const percentages = [80, 50, 60, 100, 30]; // 各バーのパーセンテージ
83
- const labels = ["項目1", "項目2", "項目3", "項目4", "項目5"]; // 各項目名
84
 
85
- const message = getMessage(level);
86
- document.getElementById("level").innerText = `話者Lv: ${level}`;
87
- document.getElementById("message").innerText = message;
88
 
89
- const barElements = document.getElementsByClassName("bar-fill");
90
- const labelElements = document.getElementsByClassName("bar-label");
91
- for (let i = 0; i < barElements.length; i++) {
92
- barElements[i].style.width = `${percentages[i]}%`;
93
- labelElements[i].innerText = labels[i];
94
- }
95
- };
96
  </script>
97
- </head>
98
- <body>
99
  <div class="card">
100
- <div class="level" id="level">話者Lv: 85</div>
101
- <div class="message" id="message">素晴らしい</div>
102
 
103
- <div class="bar-container">
104
- <span class="bar-label"></span>
105
- <div class="bar"><div class="bar-fill" style="background-color: lightblue;"></div></div>
 
106
  </div>
107
- <div class="bar-container">
108
- <span class="bar-label"></span>
109
- <div class="bar"><div class="bar-fill" style="background-color: peachpuff;"></div></div>
 
 
110
  </div>
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: lightcoral;"></div></div>
 
 
122
  </div>
123
-
 
124
  <form method="POST" action="/index">
125
- <div class="feedback-space">
126
- <input class="history-button" id="indexButton" type="submit" name="submit" value="録音画面を表示">
127
- </div>
 
 
 
 
 
 
128
  </form>
129
 
130
-
131
  <form method="POST" action="/talk_detail">
132
- <div class="feedback-space">
133
- <input class="history-button" id="detailButton" type="submit" name="submit" value="会話履歴を表示">
134
- </div>
 
 
 
 
 
 
135
  </form>
 
136
  </div>
137
- </body>
138
- </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>
index.html CHANGED
@@ -1,165 +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
- <form method="POST" action="/feedback">
75
- <div class="feedback-space">
76
- <input class="result-button" id="resultButton" type="submit" name="submit" value="フィードバック画面を表示">
77
- </div>
78
- </form>
79
 
80
- <script>
81
- let isRecording = false;
82
- let mediaRecorder;
83
- let audioChunks = [];
84
- async function toggleRecording() {
85
- const recordButton = document.getElementById('recordButton');
86
- const recordIcon = document.getElementById('recordIcon');
87
- if (!isRecording) {
88
- // 録音開始
89
- isRecording = true;
90
- recordButton.classList.add('recording');
91
- try {
92
- const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
93
- mediaRecorder = new MediaRecorder(stream);
94
- audioChunks = [];
95
- mediaRecorder.ondataavailable = event => {
96
- if (event.data.size > 0) {
97
- audioChunks.push(event.data);
98
- }
99
- };
100
- mediaRecorder.onstop = () => {
101
- const audioBlob = new Blob(audioChunks, { type: 'audio/wav' });
102
- const reader = new FileReader();
103
- reader.onloadend = () => {
104
- const base64String = reader.result.split(',')[1]; // Base64 エンコードされた音���データ
105
- // サーバーへ音声データを送信
106
- fetch('/upload_audio', {
107
- method: 'POST',
108
- headers: {
109
- 'Content-Type': 'application/json',
110
- },
111
- body: JSON.stringify({ audio_data: base64String }),
112
- })
113
- .then(response => response.json())
114
- .then(data => {
115
- alert('音声がバックエンドに送信されました。');
116
- })
117
- .catch(error => {
118
- console.error('エラー:', error);
119
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  };
121
- reader.readAsDataURL(audioBlob);
122
- };
123
- mediaRecorder.start();
124
- } catch (error) {
125
- console.error('マイクへのアクセスに失敗しました:', error);
 
 
 
126
  isRecording = false;
127
- recordButton.classList.remove('recording');
128
- }
129
- } else {
130
- // 録音停止
131
- isRecording = false;
132
- recordButton.classList.remove('recording');
133
- if (mediaRecorder && mediaRecorder.state !== 'inactive') {
134
- mediaRecorder.stop();
135
- }
136
- }
137
- }
138
-
139
- // Chart.js の初期化
140
- const ctx = document.getElementById('speechChart').getContext('2d');
141
- const speechChart = new Chart(ctx, {
142
- type: 'doughnut',
143
- data: {
144
- labels: ['自分', '他の人'],
145
- datasets: [{
146
- data: [30, 70],
147
- backgroundColor: ['#4caf50', '#757575'],
148
- }],
149
- },
150
- options: {
151
- responsive: true,
152
- plugins: {
153
- legend: {
154
- display: true,
155
- position: 'bottom',
156
- labels: {
157
- color: 'white'
158
- }
159
  }
160
  }
161
  }
162
- });
163
- </script>
164
- </body>
165
- </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>
talkDetail.html CHANGED
@@ -1,108 +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
-
56
  <form method="POST" action="/index">
57
- <div class="feedback-space">
58
- <input class="history-button" id="indexButton" type="submit" name="submit" value="録音画面を表示">
59
- </div>
 
 
 
 
 
 
60
  </form>
61
 
62
  <form method="POST" action="/feedback">
63
- <div class="feedback-space">
64
- <input class="history-button" id="feedbackButton" type="submit" name="submit" value="フィードバック画面を表示">
65
- </div>
66
- </form>
67
-
 
 
 
 
 
 
68
  </div>
69
 
70
  <script>
71
- // 会話データを表示
72
- async function displayTranscription() {
73
- const transcriptionElement = document.getElementById('transcription');
74
 
75
- try {
76
- // バックエンドからデータを取得(デモ用のURLを指定)
77
- const response = await fetch('/api/transcription');
78
- if (!response.ok) throw new Error('データ取得に失敗しました。');
79
 
80
- const data = await response.json();
81
 
82
- // 会話内容を整形して表示
83
- const formattedText = data.conversations.map((conv, index) =>
84
- `【${conv.speaker}】 ${conv.text}`
85
- ).join('\n');
86
 
87
- transcriptionElement.textContent = formattedText;
88
- } catch (error) {
89
- transcriptionElement.textContent = `エラー: ${error.message}`;
90
- console.error('データ取得エラー:', error);
91
- }
92
  }
 
93
 
94
- // 録音画面に戻る
95
- function showRecorder() {
96
- window.location.href = 'index.html';
97
- }
98
 
99
- // フィードバック画面に移動
100
- function showHistory() {
101
- window.location.href = 'feedback.html';
102
- }
103
 
104
- // 初期化処理
105
- displayTranscription();
106
  </script>
107
- </body>
108
- </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>