Spaces:
Sleeping
Sleeping
buletomato25
commited on
Commit
·
1a34be3
1
Parent(s):
eace12d
fix_feedback
Browse files- static/feedback.js +69 -0
- static/loading.css +56 -0
- static/loading.js +0 -0
- static/talk_detail.js +39 -0
- templates/feedback.html +7 -1
- templates/talkDetail.html +5 -40
static/feedback.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
async function getTranscription() {
|
| 2 |
+
try {
|
| 3 |
+
const response = await fetch("/transcription");
|
| 4 |
+
if (!response.ok) {
|
| 5 |
+
throw new Error("HTTP error! status: ${response.status}");
|
| 6 |
+
}
|
| 7 |
+
const data = await response.json;
|
| 8 |
+
const results = data.response;
|
| 9 |
+
} catch (error) {
|
| 10 |
+
console.error("Failed to fetch transcription", error);
|
| 11 |
+
}
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
async function getAnalysis() {
|
| 15 |
+
try {
|
| 16 |
+
await getTranscription();
|
| 17 |
+
|
| 18 |
+
const response = await fetch("/analyze");
|
| 19 |
+
if (!response.ok) {
|
| 20 |
+
throw new Error(`HTTP error! status: ${response.status}`);
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
const data = await response.json();
|
| 24 |
+
const results = data.results;
|
| 25 |
+
const analysis = results.deepseek_analysis;
|
| 26 |
+
|
| 27 |
+
// 変数に格納
|
| 28 |
+
const conversationLevel = analysis.conversationLevel;
|
| 29 |
+
const harassmentPresent = analysis.harassmentPresent;
|
| 30 |
+
const harassmentType = analysis.harassmentType;
|
| 31 |
+
const repetition = analysis.repetition;
|
| 32 |
+
const pleasantConversation = analysis.pleasantConversation;
|
| 33 |
+
const blameOrHarassment = analysis.blameOrHarassment;
|
| 34 |
+
|
| 35 |
+
// コンソールに表示
|
| 36 |
+
console.log(
|
| 37 |
+
conversationLevel,
|
| 38 |
+
harassmentPresent,
|
| 39 |
+
harassmentType,
|
| 40 |
+
repetition,
|
| 41 |
+
pleasantConversation,
|
| 42 |
+
blameOrHarassment
|
| 43 |
+
);
|
| 44 |
+
|
| 45 |
+
// DOMに表示
|
| 46 |
+
document.getElementById(
|
| 47 |
+
"level"
|
| 48 |
+
).innerText = `会話レベル: ${conversationLevel}`;
|
| 49 |
+
document.getElementById(
|
| 50 |
+
"Harassment_bool"
|
| 51 |
+
).innerText = `ハラスメントの有無: ${harassmentPresent}`;
|
| 52 |
+
document.getElementById(
|
| 53 |
+
"Harassment_type"
|
| 54 |
+
).innerText = `ハラスメントの種類: ${harassmentType}`;
|
| 55 |
+
document.getElementById(
|
| 56 |
+
"Harassment_loop"
|
| 57 |
+
).innerText = `繰り返しの程度: ${repetition}`;
|
| 58 |
+
document.getElementById(
|
| 59 |
+
"Harassment_comfort"
|
| 60 |
+
).innerText = `会話の心地よさ: ${pleasantConversation}`;
|
| 61 |
+
document.getElementById(
|
| 62 |
+
"Harassment_volume"
|
| 63 |
+
).innerText = `非難またはハラスメントの程度: ${blameOrHarassment}`;
|
| 64 |
+
} catch (error) {
|
| 65 |
+
console.error("Failed to fetch analysis data:", error);
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
window.onload = getAnalysis();
|
static/loading.css
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.loader {
|
| 2 |
+
position: absolute;
|
| 3 |
+
top: calc(50% - 32px);
|
| 4 |
+
left: calc(50% - 32px);
|
| 5 |
+
width: 64px;
|
| 6 |
+
height: 64px;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
.loader div {
|
| 10 |
+
position: absolute;
|
| 11 |
+
top: 0;
|
| 12 |
+
left: 0;
|
| 13 |
+
width: 100%;
|
| 14 |
+
height: 100%;
|
| 15 |
+
border-radius: 50%;
|
| 16 |
+
box-sizing: border-box;
|
| 17 |
+
opacity: 0.8;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
.one {
|
| 21 |
+
border-top: 1px solid #8fb259;
|
| 22 |
+
animation: rotate-left 1s linear infinite;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
.two {
|
| 26 |
+
border-right: 1px solid #cccc52;
|
| 27 |
+
animation: rotate-right 1s linear infinite;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
.three {
|
| 31 |
+
border-bottom: 1px solid #ffd933;
|
| 32 |
+
animation: rotate-right 1s linear infinite;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
.four {
|
| 36 |
+
border-left: 1px solid #ff7f00;
|
| 37 |
+
animation: rotate-right 1s linear infinite;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
@keyframes rotate-left {
|
| 41 |
+
0% {
|
| 42 |
+
transform: rotate(360deg);
|
| 43 |
+
}
|
| 44 |
+
100% {
|
| 45 |
+
transform: rotate(0deg);
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
@keyframes rotate-right {
|
| 50 |
+
0% {
|
| 51 |
+
transform: rotate(0deg);
|
| 52 |
+
}
|
| 53 |
+
100% {
|
| 54 |
+
transform: rotate(360deg);
|
| 55 |
+
}
|
| 56 |
+
}
|
static/loading.js
ADDED
|
File without changes
|
static/talk_detail.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
async function displayTranscription() {
|
| 2 |
+
const transcriptionElement = document.getElementById("transcription");
|
| 3 |
+
|
| 4 |
+
try {
|
| 5 |
+
const response = await fetch("/transcription");
|
| 6 |
+
if (!response.ok) throw new Error("データ取得に失敗しました。");
|
| 7 |
+
|
| 8 |
+
const data = await response.json();
|
| 9 |
+
const conversations = data.transcription;
|
| 10 |
+
|
| 11 |
+
if (!data || !data.transcription) {
|
| 12 |
+
throw new Error("会話データが見つかりませんでした。");
|
| 13 |
+
}
|
| 14 |
+
/*
|
| 15 |
+
const formattedText = conversations
|
| 16 |
+
|
| 17 |
+
.map((conv) => `【${conv.speaker}】 ${conv.text}`)
|
| 18 |
+
.join("\n");
|
| 19 |
+
console.log("フォーマットテキスト:", formattedText);
|
| 20 |
+
transcriptionElement.textContent = formattedText;
|
| 21 |
+
*/
|
| 22 |
+
transcriptionElement.textContent = conversations;
|
| 23 |
+
|
| 24 |
+
console.log(conversations);
|
| 25 |
+
} catch (error) {
|
| 26 |
+
transcriptionElement.textContent = `エラー: ${error.message}`;
|
| 27 |
+
console.error("データ取得エラー:", error);
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
displayTranscription();
|
| 32 |
+
|
| 33 |
+
function showRecorder() {
|
| 34 |
+
window.location.href = "/index";
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
function showFeedback() {
|
| 38 |
+
window.location.href = "/feedback";
|
| 39 |
+
}
|
templates/feedback.html
CHANGED
|
@@ -5,6 +5,11 @@
|
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
<title>会話フィードバック画面</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
<script src="https://use.fontawesome.com/releases/v5.10.0/js/all.js"></script>
|
| 9 |
<style>
|
| 10 |
/* Main Container */
|
|
@@ -143,7 +148,7 @@
|
|
| 143 |
</div>
|
| 144 |
|
| 145 |
<!-- Feedback Details -->
|
| 146 |
-
<div class="text-xl font-semibold mb-6" id="level"
|
| 147 |
<div class="text-lg mb-2" id="Harassment_bool">ハラスメントの有無:</div>
|
| 148 |
<div class="text-lg mb-2" id="Harassment_type">ハラスメントの種類:</div>
|
| 149 |
<div class="text-lg mb-2" id="Harassment_loop">繰り返しの程度:</div>
|
|
@@ -154,5 +159,6 @@
|
|
| 154 |
</div>
|
| 155 |
|
| 156 |
<script src="{{ url_for('static', filename='menu.js') }}"></script>
|
|
|
|
| 157 |
</body>
|
| 158 |
</html>
|
|
|
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
<title>会話フィードバック画面</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script>
|
| 9 |
+
tailwind.config = {
|
| 10 |
+
darkMode: "class",
|
| 11 |
+
};
|
| 12 |
+
</script>
|
| 13 |
<script src="https://use.fontawesome.com/releases/v5.10.0/js/all.js"></script>
|
| 14 |
<style>
|
| 15 |
/* Main Container */
|
|
|
|
| 148 |
</div>
|
| 149 |
|
| 150 |
<!-- Feedback Details -->
|
| 151 |
+
<div class="text-xl font-semibold mb-6" id="level">会話レベル:</div>
|
| 152 |
<div class="text-lg mb-2" id="Harassment_bool">ハラスメントの有無:</div>
|
| 153 |
<div class="text-lg mb-2" id="Harassment_type">ハラスメントの種類:</div>
|
| 154 |
<div class="text-lg mb-2" id="Harassment_loop">繰り返しの程度:</div>
|
|
|
|
| 159 |
</div>
|
| 160 |
|
| 161 |
<script src="{{ url_for('static', filename='menu.js') }}"></script>
|
| 162 |
+
<script src="{{ url_for('static', filename='feedback.js') }}"></script>
|
| 163 |
</body>
|
| 164 |
</html>
|
templates/talkDetail.html
CHANGED
|
@@ -5,6 +5,10 @@
|
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
<title>会話詳細画面</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
</head>
|
| 9 |
<body
|
| 10 |
class="bg-gray-100 dark:bg-gray-900 text-gray-900 dark:text-gray-100 min-h-screen flex items-center justify-center"
|
|
@@ -34,45 +38,6 @@
|
|
| 34 |
</button>
|
| 35 |
</div>
|
| 36 |
</div>
|
| 37 |
-
<script>
|
| 38 |
-
async function displayTranscription() {
|
| 39 |
-
const transcriptionElement = document.getElementById("transcription");
|
| 40 |
-
|
| 41 |
-
try {
|
| 42 |
-
const response = await fetch("/transcription");
|
| 43 |
-
if (!response.ok) throw new Error("データ取得に失敗しました。");
|
| 44 |
-
|
| 45 |
-
const data = await response.json();
|
| 46 |
-
const conversations = data.transcription;
|
| 47 |
-
|
| 48 |
-
if (!data || !data.transcription) {
|
| 49 |
-
throw new Error("会話データが見つかりませんでした。");
|
| 50 |
-
}
|
| 51 |
-
/*
|
| 52 |
-
const formattedText = conversations
|
| 53 |
-
|
| 54 |
-
.map((conv) => `【${conv.speaker}】 ${conv.text}`)
|
| 55 |
-
.join("\n");
|
| 56 |
-
console.log("フォーマットテキスト:", formattedText);
|
| 57 |
-
transcriptionElement.textContent = formattedText;
|
| 58 |
-
*/
|
| 59 |
-
transcriptionElement.textContent = conversations;
|
| 60 |
-
console.log(conversations);
|
| 61 |
-
} catch (error) {
|
| 62 |
-
transcriptionElement.textContent = `エラー: ${error.message}`;
|
| 63 |
-
console.error("データ取得エラー:", error);
|
| 64 |
-
}
|
| 65 |
-
}
|
| 66 |
-
|
| 67 |
-
displayTranscription();
|
| 68 |
-
|
| 69 |
-
function showRecorder() {
|
| 70 |
-
window.location.href = "/index";
|
| 71 |
-
}
|
| 72 |
-
|
| 73 |
-
function showFeedback() {
|
| 74 |
-
window.location.href = "/feedback";
|
| 75 |
-
}
|
| 76 |
-
</script>
|
| 77 |
</body>
|
| 78 |
</html>
|
|
|
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
<title>会話詳細画面</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link
|
| 9 |
+
rel="stylesheet"
|
| 10 |
+
href="{{ url_for('static', filename='loading.css') }}"
|
| 11 |
+
/>
|
| 12 |
</head>
|
| 13 |
<body
|
| 14 |
class="bg-gray-100 dark:bg-gray-900 text-gray-900 dark:text-gray-100 min-h-screen flex items-center justify-center"
|
|
|
|
| 38 |
</button>
|
| 39 |
</div>
|
| 40 |
</div>
|
| 41 |
+
<script src="{{ url_for('static', filename='talk_detail.js') }}"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
</body>
|
| 43 |
</html>
|