From c6fc95f69cd41aa5b43fbc84c51946aaf40c4e85 Mon Sep 17 00:00:00 2001
From: 0xjrx
Date: Mon, 17 Mar 2025 14:55:14 +0100
Subject: [PATCH 1/6] feat: add script for t2s for Haikus
Refs: OPS-56
---
senju/templates/haiku.html | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/senju/templates/haiku.html b/senju/templates/haiku.html
index 844dfff..f4043b2 100644
--- a/senju/templates/haiku.html
+++ b/senju/templates/haiku.html
@@ -17,4 +17,16 @@
+
{% endblock %}
From bdc88e0644ebc657a716643b093c4cb2491b76dd Mon Sep 17 00:00:00 2001
From: 0xjrx
Date: Mon, 17 Mar 2025 16:25:18 +0100
Subject: [PATCH 2/6] feat: add button for t2s
Refs: OPS-56
---
senju/templates/haiku.html | 58 +++++++++++++++++++++++++++++---------
senju/templates/scan.html | 2 +-
senju/test.py | 7 +++++
3 files changed, 53 insertions(+), 14 deletions(-)
create mode 100644 senju/test.py
diff --git a/senju/templates/haiku.html b/senju/templates/haiku.html
index f4043b2..10cae42 100644
--- a/senju/templates/haiku.html
+++ b/senju/templates/haiku.html
@@ -1,32 +1,64 @@
{% extends "base.html" %}
-
{% block content %}
{% endblock %}
diff --git a/senju/templates/scan.html b/senju/templates/scan.html
index b84a917..a77f594 100644
--- a/senju/templates/scan.html
+++ b/senju/templates/scan.html
@@ -153,7 +153,7 @@ Vote him, task complete.
responseBox.classList.remove('opacity-0');
// Example response
- document.getElementById('ai-response').textContent = 'Dominic Monaghan interviewing Elijah Wood if he will wear wigs';
+ document.getElementById('ai-response').textContent = 'Amogus';
} else {
errorMessage.classList.remove('hidden');
diff --git a/senju/test.py b/senju/test.py
new file mode 100644
index 0000000..31b8119
--- /dev/null
+++ b/senju/test.py
@@ -0,0 +1,7 @@
+from senju.haiku import Haiku
+from senju.store_manager import StoreManager
+
+haiku = Haiku(["Red suit, vents unseen,"," Sus behavior, crew unsure,"," Vote him, task complete."])
+store = StoreManager()
+store.save_haiku(haiku)
+
From b2cf4a0a722a6dc7810a7db864769b6d3e34eced Mon Sep 17 00:00:00 2001
From: 0xjrx
Date: Mon, 17 Mar 2025 16:26:04 +0100
Subject: [PATCH 3/6] fix: remove unnesessary file
---
senju/test.py | 7 -------
1 file changed, 7 deletions(-)
delete mode 100644 senju/test.py
diff --git a/senju/test.py b/senju/test.py
deleted file mode 100644
index 31b8119..0000000
--- a/senju/test.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from senju.haiku import Haiku
-from senju.store_manager import StoreManager
-
-haiku = Haiku(["Red suit, vents unseen,"," Sus behavior, crew unsure,"," Vote him, task complete."])
-store = StoreManager()
-store.save_haiku(haiku)
-
From 6baaee8d9a160a40434c89d0148cbcac73bc238e Mon Sep 17 00:00:00 2001
From: 0xjrx
Date: Fri, 21 Mar 2025 14:16:32 +0100
Subject: [PATCH 4/6] fix: potential fix for the speech synthesis
Refs: OPS-56
---
senju/templates/haiku.html | 67 ++++++++++++++++++--------------------
1 file changed, 31 insertions(+), 36 deletions(-)
diff --git a/senju/templates/haiku.html b/senju/templates/haiku.html
index 10cae42..a259f8f 100644
--- a/senju/templates/haiku.html
+++ b/senju/templates/haiku.html
@@ -25,40 +25,35 @@
+ document.addEventListener('DOMContentLoaded', function () {
+ const speakButton = document.getElementById('speak-button');
+ const haikuText = document.getElementById('haiku-text');
+
+ function speakText() {
+ const textContent = haikuText.innerText.trim();
+ console.log("Speaking text:", textContent);
+
+ const msg = new SpeechSynthesisUtterance(textContent);
+ const voices = window.speechSynthesis.getVoices();
+
+ if (voices.length > 0) {
+ msg.voice = voices[0]; // Use the first available voice
+ } else {
+ console.warn("No voices available!");
+ }
+
+ window.speechSynthesis.cancel(); // Stop any previous speech
+ window.speechSynthesis.speak(msg);
+ }
+
+ if ('speechSynthesis' in window) {
+ speechSynthesis.onvoiceschanged = () => {
+ console.log("Voices loaded:", speechSynthesis.getVoices());
+ speakButton.addEventListener('click', speakText);
+ };
+ } else {
+ speakButton.style.display = 'none';
+ }
+});
+
{% endblock %}
From 3234cf0e6b29a8771a4b60f317ecabcb1a0cf3b1 Mon Sep 17 00:00:00 2001
From: 0xjrx
Date: Fri, 21 Mar 2025 16:34:11 +0100
Subject: [PATCH 5/6] fix: remove unnecessary stuff
Refs: OPS-56
---
senju/templates/scan.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/senju/templates/scan.html b/senju/templates/scan.html
index a77f594..99f669b 100644
--- a/senju/templates/scan.html
+++ b/senju/templates/scan.html
@@ -153,7 +153,7 @@ Vote him, task complete.
responseBox.classList.remove('opacity-0');
// Example response
- document.getElementById('ai-response').textContent = 'Amogus';
+ document.getElementById('ai-response').textContent = 'Example text';
} else {
errorMessage.classList.remove('hidden');
From ce7316246ebb17f97df01591168b1402f8bd0971 Mon Sep 17 00:00:00 2001
From: 0xjrx
Date: Sun, 23 Mar 2025 18:08:24 +0100
Subject: [PATCH 6/6] fix/feat: hopefully fixes the speech synthesis and adds
more voices
Refs: OPS-56
---
senju/templates/haiku.html | 243 ++++++++++++++++++++++++++++++------
senju/templates/prompt.html | 1 +
2 files changed, 208 insertions(+), 36 deletions(-)
diff --git a/senju/templates/haiku.html b/senju/templates/haiku.html
index a259f8f..218a553 100644
--- a/senju/templates/haiku.html
+++ b/senju/templates/haiku.html
@@ -9,14 +9,17 @@
{{ line }}
{% endfor %}
-