Spaces:
Running
Running
Prepare button design
Browse files- feedback.html +144 -115
- index.html +169 -157
- 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 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
</style>
|
71 |
<script>
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
</script>
|
97 |
-
</head>
|
98 |
-
<body>
|
99 |
<div class="card">
|
100 |
-
|
101 |
-
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
|
|
|
106 |
</div>
|
107 |
-
|
108 |
-
|
109 |
-
|
|
|
|
|
110 |
</div>
|
111 |
-
|
112 |
-
|
113 |
-
|
|
|
|
|
114 |
</div>
|
115 |
-
|
116 |
-
|
117 |
-
|
|
|
|
|
118 |
</div>
|
119 |
-
|
120 |
-
|
121 |
-
|
|
|
|
|
122 |
</div>
|
123 |
-
|
|
|
124 |
<form method="POST" action="/index">
|
125 |
-
|
126 |
-
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
</form>
|
129 |
|
130 |
-
|
131 |
<form method="POST" action="/talk_detail">
|
132 |
-
|
133 |
-
|
134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
<input class="result-button" id="resultButton" type="submit" name="submit" value="フィードバック画面を表示">
|
77 |
-
</div>
|
78 |
-
</form>
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
};
|
121 |
-
|
122 |
-
}
|
123 |
-
|
124 |
-
|
125 |
-
|
|
|
|
|
|
|
126 |
isRecording = false;
|
127 |
-
recordButton.classList.remove(
|
128 |
-
|
129 |
-
|
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 |
-
|
164 |
-
|
165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
</style>
|
50 |
-
</head>
|
51 |
-
<body>
|
52 |
<div class="container">
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
<form method="POST" action="/index">
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
</form>
|
61 |
|
62 |
<form method="POST" action="/feedback">
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
</div>
|
69 |
|
70 |
<script>
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
|
80 |
-
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
}
|
92 |
}
|
|
|
93 |
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
|
104 |
-
|
105 |
-
|
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>
|