I own a car detailing business. Teach ai about it - Follow Up Deployment
Browse files- index.html +399 -43
- prompts.txt +3 -1
index.html
CHANGED
@@ -577,13 +577,134 @@
|
|
577 |
</div>
|
578 |
|
579 |
<script>
|
580 |
-
// AI Training Data
|
581 |
let trainingData = {
|
582 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
583 |
customResponses: {
|
584 |
-
business:
|
585 |
-
|
586 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
587 |
}
|
588 |
};
|
589 |
|
@@ -659,28 +780,66 @@
|
|
659 |
});
|
660 |
}
|
661 |
|
662 |
-
// Training Functions
|
663 |
function submitTraining() {
|
664 |
const input = document.getElementById('trainingInput');
|
665 |
if (input.value.trim() !== '') {
|
666 |
-
|
667 |
|
668 |
-
// Add
|
669 |
const chatContainer = document.querySelector('#trainingScreen .flex-1.overflow-y-auto');
|
670 |
const userBubble = document.createElement('div');
|
671 |
userBubble.className = 'user-bubble mt-4 animate-fadeIn';
|
672 |
-
userBubble.innerHTML = `<p>${
|
673 |
chatContainer.appendChild(userBubble);
|
674 |
|
675 |
-
//
|
676 |
-
setTimeout(() => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
677 |
const aiBubble = document.createElement('div');
|
678 |
aiBubble.className = 'ai-bubble mt-4 animate-fadeIn';
|
679 |
-
aiBubble.innerHTML = `
|
680 |
-
<
|
681 |
-
|
682 |
-
|
683 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
684 |
`;
|
685 |
chatContainer.appendChild(aiBubble);
|
686 |
chatContainer.scrollTop = chatContainer.scrollHeight;
|
@@ -690,36 +849,49 @@
|
|
690 |
}
|
691 |
}
|
692 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
693 |
function handleTrainingKeyPress(e) {
|
694 |
if (e.key === 'Enter') {
|
695 |
submitTraining();
|
696 |
}
|
697 |
}
|
698 |
|
699 |
-
function generateAIResponse(inputText) {
|
700 |
-
// Simple response generation logic
|
701 |
-
if (inputText.includes('business') || inputText.includes('work')) {
|
702 |
-
return `<div class="mt-2 bg-blue-50 dark:bg-blue-900 rounded-lg p-3">
|
703 |
-
<p>${trainingData.customResponses.business}</p>
|
704 |
-
</div>`;
|
705 |
-
}
|
706 |
-
else if (inputText.includes('personal') || inputText.includes('family')) {
|
707 |
-
return `<div class="mt-2 bg-blue-50 dark:bg-blue-900 rounded-lg p-3">
|
708 |
-
<p>${trainingData.customResponses.personal}</p>
|
709 |
-
</div>`;
|
710 |
-
}
|
711 |
-
else if (inputText.includes('spam') || inputText.includes('block')) {
|
712 |
-
return `<div class="mt-2 bg-blue-50 dark:bg-blue-900 rounded-lg p-3">
|
713 |
-
<p>${trainingData.customResponses.spam}</p>
|
714 |
-
</div>`;
|
715 |
-
}
|
716 |
-
|
717 |
-
// Default response
|
718 |
-
return `<div class="mt-2 bg-blue-50 dark:bg-blue-900 rounded-lg p-3">
|
719 |
-
<p>"I'll ask about the purpose of the call and take a message if needed."</p>
|
720 |
-
</div>`;
|
721 |
-
}
|
722 |
-
|
723 |
// Voice Processing Functions
|
724 |
let voiceProcessor = {
|
725 |
model: 'okada-female',
|
@@ -779,11 +951,176 @@
|
|
779 |
audio.play();
|
780 |
}
|
781 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
782 |
// Initialize when page loads
|
783 |
document.addEventListener('DOMContentLoaded', () => {
|
784 |
-
|
785 |
-
addAppearAnimations();
|
786 |
-
simulateAIProgress();
|
787 |
|
788 |
// Focus input when training screen opens
|
789 |
document.querySelectorAll('[onclick^="showScreen"]').forEach(btn => {
|
@@ -795,6 +1132,25 @@
|
|
795 |
}
|
796 |
});
|
797 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
798 |
});
|
799 |
</script>
|
800 |
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=jjmandog/ccx" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
|
|
577 |
</div>
|
578 |
|
579 |
<script>
|
580 |
+
// Enhanced AI Training Data with Natural Language Learning
|
581 |
let trainingData = {
|
582 |
+
learnedResponses: {
|
583 |
+
"business": [
|
584 |
+
{
|
585 |
+
"input": "car detailing",
|
586 |
+
"response": "Thank you for calling [Your Business Name], premium auto detailing specialists. How can we help you today?",
|
587 |
+
"tokens": ["car", "detailing"],
|
588 |
+
"lastUsed": "2023-11-15T00:00:00.000Z"
|
589 |
+
},
|
590 |
+
{
|
591 |
+
"input": "appointment",
|
592 |
+
"response": "For appointments, we have availability this week. Would you prefer a wash & wax ($75), full detail ($150) or ceramic coating ($400)?",
|
593 |
+
"tokens": ["appointment"],
|
594 |
+
"lastUsed": "2023-11-15T00:00:00.000Z"
|
595 |
+
},
|
596 |
+
{
|
597 |
+
"input": "hours",
|
598 |
+
"response": "Our detailing center is open Monday-Friday 8am-6pm, Saturday 9am-4pm. We're closed Sundays.",
|
599 |
+
"tokens": ["hours"],
|
600 |
+
"lastUsed": "2023-11-15T00:00:00.000Z"
|
601 |
+
}
|
602 |
+
]
|
603 |
+
},
|
604 |
customResponses: {
|
605 |
+
"business": "Hello, you've reached [Your Business Name] auto detailing. Ask me about our services: basic wash ($35), premium detailing ($150), or ceramic coatings ($400+).",
|
606 |
+
"spam": "We don't accept sales calls. Please email us at [email protected] for business inquiries."
|
607 |
+
},
|
608 |
+
phoneNumber: "+1 (562) 228-9429",
|
609 |
+
callHandling: {
|
610 |
+
transferContacts: ["Mom", "Dad"],
|
611 |
+
screenContacts: true,
|
612 |
+
spamDetection: true
|
613 |
+
},
|
614 |
+
personality: {
|
615 |
+
tone: "professional",
|
616 |
+
useName: true,
|
617 |
+
responseSpeed: "normal",
|
618 |
+
businessName: "Shine On Auto Detailing",
|
619 |
+
services: [
|
620 |
+
{name: "Basic Wash", price: "$35", duration: "30 mins"},
|
621 |
+
{name: "Deluxe Detail", price: "$150", duration: "3 hours"},
|
622 |
+
{name: "Ceramic Coating", price: "$400+", duration: "1-2 days"}
|
623 |
+
]
|
624 |
+
}
|
625 |
+
};
|
626 |
+
|
627 |
+
// Initialize Natural Language Processing
|
628 |
+
const nlp = {
|
629 |
+
processInput: function(text) {
|
630 |
+
// Simple NLP processing
|
631 |
+
text = text.toLowerCase().trim();
|
632 |
+
const keywords = {
|
633 |
+
business: ["work", "job", "meeting", "business"],
|
634 |
+
personal: ["family", "friend", "mom", "dad"],
|
635 |
+
spam: ["spam", "block", "unwanted", "telemarketer"],
|
636 |
+
question: ["what", "when", "where", "how", "why", "can you", "would you"]
|
637 |
+
};
|
638 |
+
|
639 |
+
return text;
|
640 |
+
},
|
641 |
+
learnResponse: function(inputText, preferredResponse) {
|
642 |
+
// Tokenize input and learn patterns
|
643 |
+
const tokens = inputText.toLowerCase().split(/\s+/);
|
644 |
+
const context = this.determineContext(inputText);
|
645 |
+
|
646 |
+
if (!trainingData.learnedResponses[context]) {
|
647 |
+
trainingData.learnedResponses[context] = [];
|
648 |
+
}
|
649 |
+
|
650 |
+
trainingData.learnedResponses[context].push({
|
651 |
+
input: inputText,
|
652 |
+
response: preferredResponse,
|
653 |
+
tokens: tokens,
|
654 |
+
lastUsed: new Date()
|
655 |
+
});
|
656 |
+
|
657 |
+
this.saveToLocalStorage();
|
658 |
+
return true;
|
659 |
+
},
|
660 |
+
determineContext: function(text) {
|
661 |
+
text = text.toLowerCase();
|
662 |
+
if (text.includes('work') || text.includes('business') || text.includes('job')) return 'business';
|
663 |
+
if (text.includes('family') || text.includes('mom') || text.includes('dad')) return 'personal';
|
664 |
+
if (text.includes('spam') || text.includes('block')) return 'spam';
|
665 |
+
return 'general';
|
666 |
+
},
|
667 |
+
getBestResponse: function(inputText) {
|
668 |
+
const context = this.determineContext(inputText);
|
669 |
+
const possibleResponses = trainingData.learnedResponses[context] || [];
|
670 |
+
|
671 |
+
if (possibleResponses.length === 0) {
|
672 |
+
return this.generateDefaultResponse(context);
|
673 |
+
}
|
674 |
+
|
675 |
+
// Find the most relevant response based on keyword matching
|
676 |
+
const inputTokens = inputText.toLowerCase().split(/\s+/);
|
677 |
+
let bestMatch = {score: 0, response: possibleResponses[0]};
|
678 |
+
|
679 |
+
possibleResponses.forEach(item => {
|
680 |
+
let score = 0;
|
681 |
+
inputTokens.forEach(token => {
|
682 |
+
if (item.tokens.includes(token)) score++;
|
683 |
+
});
|
684 |
+
if (score > bestMatch.score) {
|
685 |
+
bestMatch = {score, response: item};
|
686 |
+
}
|
687 |
+
});
|
688 |
+
|
689 |
+
return bestMatch.response.response || this.generateDefaultResponse(context);
|
690 |
+
},
|
691 |
+
generateDefaultResponse: function(context) {
|
692 |
+
const defaults = {
|
693 |
+
business: "Hello! Thank you for calling our auto detailing service. We offer car washes starting at $35 and full detailing for $150. How can we assist you?",
|
694 |
+
personal: "Hi, this is [Name]'s phone. I'll get your message to them if it's important.",
|
695 |
+
spam: "We don't accept sales calls. Please email us at [email protected] for business inquiries.",
|
696 |
+
general: "I'll connect you with our detailing team. Are you calling about an appointment or would you like service information?"
|
697 |
+
};
|
698 |
+
return defaults[context] || defaults.general;
|
699 |
+
},
|
700 |
+
saveToLocalStorage: function() {
|
701 |
+
localStorage.setItem('aiCallAssistantTraining', JSON.stringify(trainingData));
|
702 |
+
},
|
703 |
+
loadFromLocalStorage: function() {
|
704 |
+
const savedData = localStorage.getItem('aiCallAssistantTraining');
|
705 |
+
if (savedData) {
|
706 |
+
trainingData = JSON.parse(savedData);
|
707 |
+
}
|
708 |
}
|
709 |
};
|
710 |
|
|
|
780 |
});
|
781 |
}
|
782 |
|
783 |
+
// Enhanced Training Functions
|
784 |
function submitTraining() {
|
785 |
const input = document.getElementById('trainingInput');
|
786 |
if (input.value.trim() !== '') {
|
787 |
+
const userMessage = input.value;
|
788 |
|
789 |
+
// Add user message to chat
|
790 |
const chatContainer = document.querySelector('#trainingScreen .flex-1.overflow-y-auto');
|
791 |
const userBubble = document.createElement('div');
|
792 |
userBubble.className = 'user-bubble mt-4 animate-fadeIn';
|
793 |
+
userBubble.innerHTML = `<p>${userMessage}</p>`;
|
794 |
chatContainer.appendChild(userBubble);
|
795 |
|
796 |
+
// Process user input and generate AI response
|
797 |
+
setTimeout(async () => {
|
798 |
+
const isTeachingExample = userMessage.includes("should respond");
|
799 |
+
let aiResponse;
|
800 |
+
|
801 |
+
if (isTeachingExample) {
|
802 |
+
// Extract teaching example
|
803 |
+
const parts = userMessage.split("should respond");
|
804 |
+
const question = parts[0].trim();
|
805 |
+
const answer = parts[1].replace(/with/i, '').trim();
|
806 |
+
|
807 |
+
// Teach the AI this response
|
808 |
+
nlp.learnResponse(question, answer);
|
809 |
+
|
810 |
+
aiResponse = `
|
811 |
+
<p>Got it! I've learned this response:</p>
|
812 |
+
<div class="mt-2 bg-blue-50 dark:bg-blue-900 rounded-lg p-3">
|
813 |
+
<p><strong>Question:</strong> ${question}</p>
|
814 |
+
<p><strong>Answer:</strong> ${answer}</p>
|
815 |
+
</div>
|
816 |
+
<p class="mt-2">I'll use this response when I hear similar questions.</p>
|
817 |
+
`;
|
818 |
+
} else {
|
819 |
+
// Get smart response based on learned data
|
820 |
+
const response = nlp.getBestResponse(userMessage);
|
821 |
+
aiResponse = `
|
822 |
+
<p>Based on what you've taught me, here's how I would respond:</p>
|
823 |
+
<div class="mt-2 bg-blue-50 dark:bg-blue-900 rounded-lg p-3">
|
824 |
+
<p>${response}</p>
|
825 |
+
</div>
|
826 |
+
`;
|
827 |
+
}
|
828 |
+
|
829 |
const aiBubble = document.createElement('div');
|
830 |
aiBubble.className = 'ai-bubble mt-4 animate-fadeIn';
|
831 |
+
aiBubble.innerHTML = aiResponse + `
|
832 |
+
<div class="mt-3 flex gap-2">
|
833 |
+
<button class="flex-1 py-2 bg-green-500 text-white rounded-lg" onclick="acceptResponse(this)">
|
834 |
+
Accept <i class="fas fa-check ml-1"></i>
|
835 |
+
</button>
|
836 |
+
<button class="flex-1 py-2 bg-red-500 text-white rounded-lg" onclick="editResponse(this)">
|
837 |
+
Edit <i class="fas fa-edit ml-1"></i>
|
838 |
+
</button>
|
839 |
+
<button class="px-3 py-2 bg-accent text-white rounded-lg" onclick="playResponse(this)">
|
840 |
+
<i class="fas fa-volume-up"></i>
|
841 |
+
</button>
|
842 |
+
</div>
|
843 |
`;
|
844 |
chatContainer.appendChild(aiBubble);
|
845 |
chatContainer.scrollTop = chatContainer.scrollHeight;
|
|
|
849 |
}
|
850 |
}
|
851 |
|
852 |
+
function acceptResponse(button) {
|
853 |
+
const responseText = button.closest('.ai-bubble').querySelector('div p').textContent;
|
854 |
+
const context = nlp.determineContext(responseText);
|
855 |
+
trainingData.customResponses[context] = responseText;
|
856 |
+
nlp.saveToLocalStorage();
|
857 |
+
|
858 |
+
button.innerHTML = '<i class="fas fa-check-circle"></i> Saved';
|
859 |
+
button.classList.remove('bg-green-500');
|
860 |
+
button.classList.add('bg-emerald-600');
|
861 |
+
}
|
862 |
+
|
863 |
+
function editResponse(button) {
|
864 |
+
const bubble = button.closest('.ai-bubble');
|
865 |
+
const responseDiv = bubble.querySelector('div.bg-blue-50');
|
866 |
+
const currentText = responseDiv.querySelector('p').textContent;
|
867 |
+
|
868 |
+
responseDiv.innerHTML = `
|
869 |
+
<textarea class="w-full p-2 rounded border border-gray-300">${currentText}</textarea>
|
870 |
+
<button onclick="saveEditedResponse(this)" class="mt-2 px-4 py-1 bg-accent text-white rounded">
|
871 |
+
Save Changes
|
872 |
+
</button>
|
873 |
+
`;
|
874 |
+
}
|
875 |
+
|
876 |
+
function saveEditedResponse(button) {
|
877 |
+
const newText = button.parentElement.querySelector('textarea').value;
|
878 |
+
const bubble = button.closest('.ai-bubble');
|
879 |
+
const responseDiv = button.parentElement;
|
880 |
+
|
881 |
+
responseDiv.innerHTML = `<p>${newText}</p>`;
|
882 |
+
|
883 |
+
// Update the training data with edited response
|
884 |
+
const context = nlp.determineContext(newText);
|
885 |
+
trainingData.customResponses[context] = newText;
|
886 |
+
nlp.saveToLocalStorage();
|
887 |
+
}
|
888 |
+
|
889 |
function handleTrainingKeyPress(e) {
|
890 |
if (e.key === 'Enter') {
|
891 |
submitTraining();
|
892 |
}
|
893 |
}
|
894 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
895 |
// Voice Processing Functions
|
896 |
let voiceProcessor = {
|
897 |
model: 'okada-female',
|
|
|
951 |
audio.play();
|
952 |
}
|
953 |
|
954 |
+
// Phone Integration with WebRTC
|
955 |
+
const phoneHandler = {
|
956 |
+
client: null,
|
957 |
+
isCallActive: false,
|
958 |
+
currentCall: null,
|
959 |
+
|
960 |
+
init: function() {
|
961 |
+
// Load saved training data
|
962 |
+
nlp.loadFromLocalStorage();
|
963 |
+
|
964 |
+
// Initialize WebRTC client (simplified)
|
965 |
+
this.client = {
|
966 |
+
onIncomingCall: (call) => this.handleIncomingCall(call),
|
967 |
+
answerCall: (call) => this.answerCall(call),
|
968 |
+
endCall: () => this.endCall()
|
969 |
+
};
|
970 |
+
|
971 |
+
// Check for active call on page load
|
972 |
+
this.checkActiveCall();
|
973 |
+
|
974 |
+
// Initialize voice processor
|
975 |
+
voiceProcessor.init();
|
976 |
+
addAppearAnimations();
|
977 |
+
},
|
978 |
+
|
979 |
+
handleIncomingCall: function(call) {
|
980 |
+
this.isCallActive = true;
|
981 |
+
this.currentCall = call;
|
982 |
+
|
983 |
+
// Update UI to show active call
|
984 |
+
showScreen('homeScreen');
|
985 |
+
document.querySelector('.fab i').classList.remove('fa-microphone');
|
986 |
+
document.querySelector('.fab i').classList.add('fa-phone-alt');
|
987 |
+
document.querySelector('.fab').style.background = '#ff375f';
|
988 |
+
|
989 |
+
// Show call notification
|
990 |
+
const callerInfo = call.callerID || 'Unknown Caller';
|
991 |
+
const notification = document.createElement('div');
|
992 |
+
notification.className = 'fixed top-16 left-1/2 transform -translate-x-1/2 bg-gray-800 text-white px-4 py-2 rounded-full animate-fadeIn z-50';
|
993 |
+
notification.innerHTML = `
|
994 |
+
Incoming call from: ${callerInfo}
|
995 |
+
<div class="mt-2 flex justify-center gap-4">
|
996 |
+
<button onclick="phoneHandler.answerCall()" class="bg-green-500 w-12 h-12 rounded-full flex items-center justify-center">
|
997 |
+
<i class="fas fa-phone"></i>
|
998 |
+
</button>
|
999 |
+
<button onclick="phoneHandler.endCall()" class="bg-red-500 w-12 h-12 rounded-full flex items-center justify-center">
|
1000 |
+
<i class="fas fa-phone-slash"></i>
|
1001 |
+
</button>
|
1002 |
+
</div>
|
1003 |
+
`;
|
1004 |
+
document.body.appendChild(notification);
|
1005 |
+
|
1006 |
+
// Auto-screen call if enabled
|
1007 |
+
if (trainingData.callHandling.screenContacts ||
|
1008 |
+
(!callerInfo && trainingData.callHandling.spamDetection)) {
|
1009 |
+
setTimeout(() => this.screenCall(), 2000);
|
1010 |
+
}
|
1011 |
+
},
|
1012 |
+
|
1013 |
+
screenCall: function() {
|
1014 |
+
const callerInfo = this.currentCall.callerID || 'Unknown Caller';
|
1015 |
+
const isSpam = callerInfo === 'Unknown Caller' && trainingData.callHandling.spamDetection;
|
1016 |
+
const isTransfer = trainingData.callHandling.transferContacts.some(name =>
|
1017 |
+
callerInfo.includes(name));
|
1018 |
+
|
1019 |
+
let response;
|
1020 |
+
if (isTransfer) {
|
1021 |
+
response = `Transferring call from ${callerInfo} to you...`;
|
1022 |
+
this.currentCall.transfer();
|
1023 |
+
} else if (isSpam) {
|
1024 |
+
response = trainingData.customResponses.spam || nlp.generateDefaultResponse('spam');
|
1025 |
+
this.currentCall.reject();
|
1026 |
+
} else {
|
1027 |
+
response = nlp.getBestResponse(callerInfo);
|
1028 |
+
this.currentCall.speakResponse(response);
|
1029 |
+
}
|
1030 |
+
|
1031 |
+
// Log the interaction
|
1032 |
+
this.logInteraction(callerInfo, response, isSpam ? 'blocked' : 'screened');
|
1033 |
+
},
|
1034 |
+
|
1035 |
+
answerCall: function() {
|
1036 |
+
if (!this.isCallActive) return;
|
1037 |
+
|
1038 |
+
const callerInfo = this.currentCall.callerID || 'Unknown Caller';
|
1039 |
+
this.currentCall.answer();
|
1040 |
+
|
1041 |
+
// Generate smart greeting
|
1042 |
+
const greeting = nlp.getBestResponse(`call from ${callerInfo}`);
|
1043 |
+
this.currentCall.speakResponse(greeting);
|
1044 |
+
|
1045 |
+
// Setup voice recognition for conversation
|
1046 |
+
this.currentCall.startVoiceRecognition((text) => {
|
1047 |
+
const response = nlp.getBestResponse(text);
|
1048 |
+
this.currentCall.speakResponse(response);
|
1049 |
+
|
1050 |
+
// If the response includes transferring, initiate transfer
|
1051 |
+
if (response.includes('transferring') || response.includes('connecting you')) {
|
1052 |
+
this.currentCall.transfer();
|
1053 |
+
}
|
1054 |
+
});
|
1055 |
+
|
1056 |
+
// Log the answered call
|
1057 |
+
this.logInteraction(callerInfo, greeting, 'answered');
|
1058 |
+
},
|
1059 |
+
|
1060 |
+
endCall: function() {
|
1061 |
+
if (!this.isCallActive) return;
|
1062 |
+
this.currentCall.hangup();
|
1063 |
+
this.isCallActive = false;
|
1064 |
+
this.currentCall = null;
|
1065 |
+
|
1066 |
+
// Reset UI
|
1067 |
+
document.querySelector('.fab i').classList.remove('fa-phone-alt');
|
1068 |
+
document.querySelector('.fab i').classList.add('fa-microphone');
|
1069 |
+
document.querySelector('.fab').style.background = 'linear-gradient(135deg, #0a84ff, #5e5ce6)';
|
1070 |
+
},
|
1071 |
+
|
1072 |
+
logInteraction: function(caller, response, type) {
|
1073 |
+
const logEntry = {
|
1074 |
+
date: new Date(),
|
1075 |
+
caller,
|
1076 |
+
response,
|
1077 |
+
type,
|
1078 |
+
duration: type === 'answered' ? Math.floor(Math.random() * 120) + 5 : 0
|
1079 |
+
};
|
1080 |
+
|
1081 |
+
// Add to recent activity
|
1082 |
+
const activityElement = document.createElement('div');
|
1083 |
+
activityElement.className = 'flex items-start animate-fadeIn';
|
1084 |
+
activityElement.innerHTML = `
|
1085 |
+
<div class="w-10 h-10 rounded-full ${type === 'blocked' ? 'bg-purple-100 dark:bg-purple-900' : 'bg-green-100 dark:bg-green-900'} flex items-center justify-center">
|
1086 |
+
<i class="fas fa-phone-alt ${type === 'blocked' ? 'text-purple-600 dark:text-purple-400' : 'text-green-600 dark:text-green-400'}"></i>
|
1087 |
+
</div>
|
1088 |
+
<div class="ml-3 flex-1">
|
1089 |
+
<div class="flex justify-between">
|
1090 |
+
<h3 class="font-medium">${caller}</h3>
|
1091 |
+
<span class="text-xs text-gray-500 dark:text-gray-400">${logEntry.date.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'})}</span>
|
1092 |
+
</div>
|
1093 |
+
<p class="text-sm text-gray-500 dark:text-gray-400 mt-1">
|
1094 |
+
AI ${type} call: "${response.substring(0, 40)}${response.length > 40 ? '...' : ''}"
|
1095 |
+
</p>
|
1096 |
+
</div>
|
1097 |
+
`;
|
1098 |
+
|
1099 |
+
// Add to top of recent activity
|
1100 |
+
const activityContainer = document.querySelector('#homeScreen .space-y-4');
|
1101 |
+
if (activityContainer.firstChild) {
|
1102 |
+
activityContainer.insertBefore(activityElement, activityContainer.firstChild);
|
1103 |
+
} else {
|
1104 |
+
activityContainer.appendChild(activityElement);
|
1105 |
+
}
|
1106 |
+
},
|
1107 |
+
|
1108 |
+
checkActiveCall: function() {
|
1109 |
+
// Simulated check in demo - in real app would check with telephony provider
|
1110 |
+
const activeCall = false;
|
1111 |
+
if (activeCall) {
|
1112 |
+
this.handleIncomingCall({
|
1113 |
+
callerID: 'Incoming call',
|
1114 |
+
answer: () => console.log('Call answered'),
|
1115 |
+
speakResponse: (text) => voiceProcessor.speak(text).play()
|
1116 |
+
});
|
1117 |
+
}
|
1118 |
+
}
|
1119 |
+
};
|
1120 |
+
|
1121 |
// Initialize when page loads
|
1122 |
document.addEventListener('DOMContentLoaded', () => {
|
1123 |
+
phoneHandler.init();
|
|
|
|
|
1124 |
|
1125 |
// Focus input when training screen opens
|
1126 |
document.querySelectorAll('[onclick^="showScreen"]').forEach(btn => {
|
|
|
1132 |
}
|
1133 |
});
|
1134 |
});
|
1135 |
+
|
1136 |
+
// Simulate incoming call for demo purposes
|
1137 |
+
window.simulateCall = function(callerID) {
|
1138 |
+
phoneHandler.handleIncomingCall({
|
1139 |
+
callerID: callerID || 'Unknown Caller',
|
1140 |
+
answer: function() {
|
1141 |
+
console.log('Call answered');
|
1142 |
+
const audio = voiceProcessor.speak("Hello, this call has been answered by the AI assistant.");
|
1143 |
+
audio.play();
|
1144 |
+
},
|
1145 |
+
speakResponse: function(text) {
|
1146 |
+
const audio = voiceProcessor.speak(text);
|
1147 |
+
audio.play();
|
1148 |
+
},
|
1149 |
+
reject: function() { console.log('Call rejected'); },
|
1150 |
+
hangup: function() { console.log('Call ended'); },
|
1151 |
+
transfer: function() { console.log('Call transferred'); }
|
1152 |
+
});
|
1153 |
+
};
|
1154 |
});
|
1155 |
</script>
|
1156 |
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=jjmandog/ccx" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
prompts.txt
CHANGED
@@ -1 +1,3 @@
|
|
1 |
-
Make voice humanistic . Add rvc technology and okada tts
|
|
|
|
|
|
1 |
+
Make voice humanistic . Add rvc technology and okada tts
|
2 |
+
Please make the training work. Currently doesn’t . Add intelligence and smart learning. I want to be able to make custom text replies and also have it answer the phone and answer questions that I teach it . Have it learn diction. Make everything work and insure that this can and is used whenever someone callls my phone number 5622289429
|
3 |
+
I own a car detailing business. Teach ai about it
|