Skip to content

Commit 7c81706

Browse files
committed
✅ Integrate Bhagavad Gita quotes into chat
- Added BhagavadGitaQuotes instance in ChatManager - Added motivational quote triggers in generateSmartFallback() - Supports: 'motivate me', 'inspire me', 'gita quote', 'bhagavad gita' - Returns complete Sanskrit verses with English translations - All 700+ Gita verses now accessible via chat - Multi-language support ready
1 parent cc90086 commit 7c81706

1 file changed

Lines changed: 35 additions & 6 deletions

File tree

app/src/main/kotlin/com/davidstudioz/david/chat/ChatManager.kt

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ data class ChatMessage(
2727
)
2828

2929
/**
30-
* ChatManager - COMPLETE with LlamaCpp Integration
30+
* ChatManager - COMPLETE with LlamaCpp Integration + Bhagavad Gita
3131
* ✅ NEW: LlamaCpp GGUF model support
32+
* ✅ NEW: Bhagavad Gita quotes integration (700+ verses)
3233
* ✅ ALL 100+ smart responses PRESERVED
3334
* ✅ News headlines (India)
3435
* ✅ Real-time weather API (500+ Indian cities)
@@ -59,6 +60,9 @@ class ChatManager(private val context: Context) {
5960

6061
private val responseCache = ResponseCache()
6162
private val personalityEngine = PersonalityEngine()
63+
64+
// ✅ NEW: Bhagavad Gita quotes integration
65+
private val gitaQuotes = BhagavadGitaQuotes()
6266

6367
init {
6468
loadLLMModel()
@@ -409,11 +413,34 @@ class ChatManager(private val context: Context) {
409413
}
410414

411415
/**
412-
* ✅ ALL 100+ SMART RESPONSES PRESERVED
416+
* ✅ ALL 100+ SMART RESPONSES PRESERVED + Bhagavad Gita Integration
413417
*/
414418
private fun generateSmartFallback(input: String): String {
415419
val lower = input.lowercase().trim()
416420

421+
// ✅ NEW: BHAGAVAD GITA QUOTES
422+
if (lower.contains("gita") || lower.contains("bhagavad") ||
423+
lower.contains("quote") || lower.contains("motivate") ||
424+
lower.contains("inspire") || lower.contains("motivation") ||
425+
lower.contains("wisdom") || lower.contains("spiritual")) {
426+
return try {
427+
Log.d(TAG, "🕉️ Fetching Bhagavad Gita quote")
428+
when {
429+
lower.contains("karma") -> gitaQuotes.getQuoteByTheme("Karma Yoga", "en")
430+
lower.contains("peace") || lower.contains("calm") -> gitaQuotes.getQuoteByTheme("Peace", "en")
431+
lower.contains("duty") -> gitaQuotes.getQuoteByTheme("Duty", "en")
432+
lower.contains("meditation") -> gitaQuotes.getQuoteByTheme("Meditation", "en")
433+
lower.contains("devotion") -> gitaQuotes.getQuoteByTheme("Devotion", "en")
434+
lower.contains("ramayana") -> gitaQuotes.getQuoteFrom("ramayana", "en")
435+
lower.contains("purana") -> gitaQuotes.getQuoteFrom("puranas", "en")
436+
else -> gitaQuotes.getRandomQuote("en")
437+
}
438+
} catch (e: Exception) {
439+
Log.e(TAG, "Error fetching Gita quote", e)
440+
"Here's some wisdom: Keep doing your duty without expecting results. That's the essence of Karma Yoga!"
441+
}
442+
}
443+
417444
// GREETINGS
418445
if (lower.matches(".*(hello|hi|hey|greetings|sup|yo).*".toRegex())) {
419446
return listOf(
@@ -447,7 +474,7 @@ class ChatManager(private val context: Context) {
447474

448475
// CAPABILITIES
449476
if (lower.contains("what can you do") || lower.contains("help") || lower.contains("capabilities")) {
450-
return "I can:\n• Get news headlines (India)\n• Control device (WiFi, Bluetooth, flashlight, volume)\n• Get real weather data (500+ Indian cities)\n• Make calls & send messages\n• Check time & date\n• Answer questions\n• Set reminders\n• Open apps\n• And much more! Just ask!"
477+
return "I can:\n• Get news headlines (India)\n• Control device (WiFi, Bluetooth, flashlight, volume)\n• Get real weather data (500+ Indian cities)\n• Make calls & send messages\n• Check time & date\nGive motivational quotes (Bhagavad Gita)\nAnswer questions\n• Set reminders\n• Open apps\n• And much more! Just ask!"
451478
}
452479

453480
// TIME & DATE
@@ -492,9 +519,9 @@ class ChatManager(private val context: Context) {
492519

493520
// DEFAULT
494521
return when {
495-
input.endsWith("?") -> "That's a great question! I can help with news, weather, device control, and more. What do you need?"
522+
input.endsWith("?") -> "That's a great question! I can help with news, weather, device control, motivational quotes, and more. What do you need?"
496523
input.length < 3 -> "I'm listening. What would you like me to do?"
497-
else -> "I understand you're asking about that. Try asking me about news, weather, time, or device control!"
524+
else -> "I understand you're asking about that. Try asking me about news, weather, time, Gita quotes, or device control!"
498525
}
499526
}
500527

@@ -575,14 +602,16 @@ class ChatManager(private val context: Context) {
575602
append("\n✅ Weather API: Available")
576603
append("\n✅ Web Search: Available")
577604
append("\n✅ Device Control: Available")
605+
append("\n✅ Bhagavad Gita: 700+ verses")
578606
}
579607
}
580608

581609
fun getModelInfo(): Map<String, String> = mapOf(
582610
"gguf_ready" to llamaCppEngine.isReady().toString(),
583611
"model_ready" to isModelReady().toString(),
584612
"model_name" to (llmModelPath?.name ?: "none"),
585-
"model_size_mb" to "${(llmModelPath?.length() ?: 0) / (1024 * 1024)}"
613+
"model_size_mb" to "${(llmModelPath?.length() ?: 0) / (1024 * 1024)}",
614+
"gita_verses" to "700+"
586615
)
587616

588617
fun release() {

0 commit comments

Comments
 (0)