Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
25 changes: 22 additions & 3 deletions chat-init.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
document.addEventListener("DOMContentLoaded", () => {
const { chatBox, chatInput, clearChatBtn, voiceToggleBtn, modelSelect, synth, autoSpeakEnabled, speakMessage, stopSpeaking, showToast, toggleSpeechRecognition, initSpeechRecognition, handleVoiceCommand, speakSentences } = window._chatInternals;
const {
chatBox,
chatInput,
clearChatBtn,
voiceToggleBtn,
modelSelect,
synth,
autoSpeakEnabled,
speakMessage,
stopSpeaking,
showToast,
speakSentences
} = window._chatInternals || {};
const { toggleSpeechRecognition, initSpeechRecognition, handleVoiceCommand } = window._chatInternals || {};
const imagePatterns = window.imagePatterns;
const randomSeed = window.randomSeed;
const generateSessionTitle = messages => {
Expand Down Expand Up @@ -520,7 +533,11 @@ document.addEventListener("DOMContentLoaded", () => {
}
btn.title = "Toggle voice input";
window._chatInternals.setVoiceInputButton(btn);
btn.addEventListener("click", toggleSpeechRecognition);
btn.addEventListener("click", () => {
if (window._chatInternals && typeof window._chatInternals.toggleSpeechRecognition === "function") {
window._chatInternals.toggleSpeechRecognition();
}
});
};
setupVoiceChatToggle();
document.addEventListener("click", e => {
Expand Down Expand Up @@ -557,7 +574,9 @@ document.addEventListener("DOMContentLoaded", () => {
});
sendButton.addEventListener("click", handleSendMessage);
// Send on Enter; newline with Shift+Enter
window.setupEnterToSend(chatInput, handleSendMessage);
if (typeof window.setupEnterToSend === "function") {
window.setupEnterToSend(chatInput, handleSendMessage);
}
sendButton.disabled = chatInput.value.trim() === "";
chatInput.dispatchEvent(new Event("input"));
const initialSession = Storage.getCurrentSession();
Expand Down
21 changes: 19 additions & 2 deletions chat-storage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
document.addEventListener("DOMContentLoaded", () => {
const { chatBox, chatInput, clearChatBtn, voiceToggleBtn, modelSelect, synth, autoSpeakEnabled, speakMessage, stopSpeaking, showToast, toggleSpeechRecognition, initSpeechRecognition, handleVoiceCommand, speakSentences } = window._chatInternals;
const {
chatBox,
chatInput,
clearChatBtn,
voiceToggleBtn,
modelSelect,
synth,
autoSpeakEnabled,
speakMessage,
stopSpeaking,
showToast,
speakSentences
} = window._chatInternals || {};
const { toggleSpeechRecognition, initSpeechRecognition, handleVoiceCommand } = window._chatInternals || {};
const imagePatterns = window.imagePatterns;

function openImageModal(imageUrl) {
Expand Down Expand Up @@ -580,7 +593,11 @@ document.addEventListener("DOMContentLoaded", () => {
}
btn.title = "Toggle voice input";
window._chatInternals.setVoiceInputButton(btn);
btn.addEventListener("click", toggleSpeechRecognition);
btn.addEventListener("click", () => {
if (window._chatInternals && typeof window._chatInternals.toggleSpeechRecognition === "function") {
window._chatInternals.toggleSpeechRecognition();
}
});
}
setupVoiceChatToggle();
document.addEventListener('click', function(e) {
Expand Down
Loading