mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
fixed sloka and bhagavad git
This commit is contained in:
parent
d1e312cfc3
commit
cc2fe5a9f2
8 changed files with 185 additions and 21 deletions
|
|
@ -1,3 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
@ -17,7 +18,9 @@
|
|||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>21</java.version>
|
||||
<java.version>17</java.version>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<junit.version>5.10.1</junit.version>
|
||||
<druid.version>1.2.20</druid.version>
|
||||
<mybatisplus.version>3.5.5</mybatisplus.version>
|
||||
|
|
@ -259,9 +262,24 @@
|
|||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<!-- Maven Compiler Plugin with Java 17 support -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
<compilerVersion>17</compilerVersion>
|
||||
<fork>true</fork>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- Spring Boot Maven Plugin -->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
|
|
@ -276,6 +294,8 @@
|
|||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- Maven Surefire Plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public class OtaServiceImpl extends BaseServiceImpl<OtaDao, OtaEntity> implement
|
|||
// 同类固件只保留最新的一条
|
||||
List<OtaEntity> otaList = baseDao.selectList(queryWrapper);
|
||||
if (otaList != null && otaList.size() > 0) {
|
||||
OtaEntity otaBefore = otaList.getFirst();
|
||||
OtaEntity otaBefore = otaList.get(0);
|
||||
entity.setId(otaBefore.getId());
|
||||
baseDao.updateById(entity);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
|
|||
if (users == null || users.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
SysUserEntity entity = users.getFirst();
|
||||
SysUserEntity entity = users.get(0);
|
||||
return ConvertUtils.sourceToTarget(entity, SysUserDTO.class);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"production": {
|
||||
"chat_servers": [
|
||||
"ws://192.168.1.179:8000/toy/v1/"
|
||||
"ws://64.227.170.31:8000/toy/v1/"
|
||||
]
|
||||
},
|
||||
"development": {
|
||||
"chat_servers": [
|
||||
"ws://192.168.1.179:8000/toy/v1/"
|
||||
"ws://64.227.170.31:8000/toy/v1/"
|
||||
],
|
||||
"mac_addresss": [
|
||||
]
|
||||
|
|
|
|||
|
|
@ -103,5 +103,92 @@
|
|||
"bus wheels song",
|
||||
"go round and round"
|
||||
]
|
||||
},
|
||||
"Head Shoulders Knees and Toes": {
|
||||
"romanized": "Head Shoulders Knees and Toes",
|
||||
"filename": "Head, Shoulders, Knees and Toes.mp3",
|
||||
"alternatives": [
|
||||
"head shoulders knees and toes",
|
||||
"body parts song",
|
||||
"action song",
|
||||
"exercise song",
|
||||
"kids body song",
|
||||
"nursery action song",
|
||||
"movement song",
|
||||
"body song"
|
||||
]
|
||||
},
|
||||
"Hot Cross Buns": {
|
||||
"romanized": "Hot Cross Buns",
|
||||
"filename": "Hot Cross Buns.mp3",
|
||||
"alternatives": [
|
||||
"hot cross buns",
|
||||
"easter song",
|
||||
"buns song",
|
||||
"one a penny",
|
||||
"two a penny",
|
||||
"traditional nursery rhyme",
|
||||
"food song",
|
||||
"classic rhyme"
|
||||
]
|
||||
},
|
||||
"I'm A Little Teapot": {
|
||||
"romanized": "I'm A Little Teapot",
|
||||
"filename": "I'm A Little Teapot.mp3",
|
||||
"alternatives": [
|
||||
"i'm a little teapot",
|
||||
"little teapot",
|
||||
"teapot song",
|
||||
"short and stout",
|
||||
"tip me over",
|
||||
"pour me out",
|
||||
"action nursery rhyme",
|
||||
"tea song"
|
||||
]
|
||||
},
|
||||
"Johny Johny Yes Papa": {
|
||||
"romanized": "Johny Johny Yes Papa",
|
||||
"filename": "Johny Johny Yes Papa.mp3",
|
||||
"alternatives": [
|
||||
"johny johny yes papa",
|
||||
"johnny johnny",
|
||||
"yes papa",
|
||||
"eating sugar",
|
||||
"no papa",
|
||||
"telling lies",
|
||||
"open your mouth",
|
||||
"ha ha ha",
|
||||
"popular kids song"
|
||||
]
|
||||
},
|
||||
"Rain Rain Go Away": {
|
||||
"romanized": "Rain Rain Go Away",
|
||||
"filename": "Rain rain go away.mp3",
|
||||
"alternatives": [
|
||||
"rain rain go away",
|
||||
"come again another day",
|
||||
"rain song",
|
||||
"weather song",
|
||||
"little johnny wants to play",
|
||||
"rainy day song",
|
||||
"nursery weather song",
|
||||
"rain rhyme"
|
||||
]
|
||||
},
|
||||
"Twinkle Twinkle Little Star": {
|
||||
"romanized": "Twinkle Twinkle Little Star",
|
||||
"filename": "Twinkle Twinkle Little Star.mp3",
|
||||
"alternatives": [
|
||||
"twinkle twinkle little star",
|
||||
"twinkle twinkle",
|
||||
"little star",
|
||||
"how i wonder what you are",
|
||||
"star song",
|
||||
"night song",
|
||||
"lullaby",
|
||||
"classic nursery rhyme",
|
||||
"bedtime song",
|
||||
"diamond in the sky"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -96,5 +96,19 @@
|
|||
"timma song",
|
||||
"nature song kannada"
|
||||
]
|
||||
},
|
||||
"Iruve Iruve": {
|
||||
"romanized": "Iruve Iruve",
|
||||
"filename": "Iruve Iruve.mp3",
|
||||
"alternatives": [
|
||||
"iruve iruve",
|
||||
"kannada song",
|
||||
"kannada rhyme",
|
||||
"children kannada song",
|
||||
"kids kannada song",
|
||||
"kannada nursery rhyme",
|
||||
"iruve",
|
||||
"traditional kannada song"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -32,22 +32,22 @@ play_music_function_desc = {
|
|||
"type": "function",
|
||||
"function": {
|
||||
"name": "play_music",
|
||||
"description": "Advanced multilingual music player that understands natural language requests in any language. Supports specific song requests, language preferences, mood-based selection, and educational content. Handles requests like 'play Baa Baa Black Sheep', 'sing a Hindi song', 'play phonics', 'I want energetic music', 'play something in Telugu', etc. Uses AI-powered matching to find songs even with different spellings or scripts.",
|
||||
"description": "Advanced multilingual music player that understands natural language requests in any language. Supports specific song requests, language preferences, mood-based selection, educational content, and spiritual content. Handles requests like 'play Baa Baa Black Sheep', 'sing a Hindi song', 'play phonics', 'play Gayatri Mantra', 'sing Hanuman Chalisa', 'play Bhagavad Gita', 'play slokas', 'chant mantras', etc. Uses AI-powered matching to find songs even with different spellings or scripts.",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"user_request": {
|
||||
"type": "string",
|
||||
"description": "Complete user request for music. Include the full original request to enable intelligent matching. Examples: 'play Baa Baa Black Sheep', 'sing Hanuman Chalisa', 'play any Hindi song', 'I want Telugu music', 'play phonics songs', 'something energetic', 'play music for kids'",
|
||||
"description": "Complete user request for music. Include the full original request to enable intelligent matching. Examples: 'play Baa Baa Black Sheep', 'sing Hanuman Chalisa', 'play any Hindi song', 'I want Telugu music', 'play phonics songs', 'play Gayatri Mantra', 'chant mantras', 'play Bhagavad Gita', 'something energetic', 'play music for kids'",
|
||||
},
|
||||
"requested_language": {
|
||||
"type": ["string", "null"],
|
||||
"description": "Detected or requested language preference. Options: 'english', 'hindi', 'telugu', 'kannada', 'tamil', 'phonics', or 'any'. Only set if explicitly mentioned or clearly implied.",
|
||||
"description": "Detected or requested language preference. Options: 'english', 'hindi', 'telugu', 'kannada', 'tamil', 'phonics', 'slokas', 'bhagavad gita', or 'any'. Only set if explicitly mentioned or clearly implied.",
|
||||
},
|
||||
"song_type": {
|
||||
"type": "string",
|
||||
"enum": ["specific", "random", "language_specific", "educational"],
|
||||
"description": "Type of request: 'specific' for named songs (e.g., 'play Hanuman Chalisa', 'bandar mama song'), 'random' for any song, 'language_specific' for language-only requests (e.g., 'play Hindi song'), 'educational' for phonics/learning content"
|
||||
"enum": ["specific", "random", "language_specific", "educational", "spiritual"],
|
||||
"description": "Type of request: 'specific' for named songs (e.g., 'play Hanuman Chalisa', 'play Gayatri Mantra'), 'random' for any song, 'language_specific' for language-only requests (e.g., 'play Hindi song'), 'educational' for phonics/learning content, 'spiritual' for mantras/slokas/bhagavad gita content"
|
||||
}
|
||||
},
|
||||
"required": ["user_request", "song_type"],
|
||||
|
|
@ -200,6 +200,41 @@ def _detect_language_request(text):
|
|||
"punjabi": "Punjabi",
|
||||
"marathi": "Marathi",
|
||||
"gujarati": "Gujarati",
|
||||
|
||||
# Slokas/Mantras variations (Spiritual content)
|
||||
"sloka": "Slokas",
|
||||
"slokas": "Slokas",
|
||||
"mantra": "Slokas",
|
||||
"mantras": "Slokas",
|
||||
"play sloka": "Slokas",
|
||||
"play slokas": "Slokas",
|
||||
"play mantra": "Slokas",
|
||||
"play mantras": "Slokas",
|
||||
"sing mantra": "Slokas",
|
||||
"chant mantra": "Slokas",
|
||||
"sanskrit mantra": "Slokas",
|
||||
"vedic mantra": "Slokas",
|
||||
"gayatri mantra": "Slokas",
|
||||
"hanuman chalisa": "Slokas",
|
||||
"om namah shivaya": "Slokas",
|
||||
"shiva mantra": "Slokas",
|
||||
"spiritual song": "Slokas",
|
||||
"devotional song": "Slokas",
|
||||
"prayer": "Slokas",
|
||||
"sacred chant": "Slokas",
|
||||
|
||||
# Bhagavad Gita variations (Spiritual content)
|
||||
"bhagavad gita": "Bhagavad Gita",
|
||||
"gita": "Bhagavad Gita",
|
||||
"play gita": "Bhagavad Gita",
|
||||
"bhagwad gita": "Bhagavad Gita",
|
||||
"krishna gita": "Bhagavad Gita",
|
||||
"gita chapter": "Bhagavad Gita",
|
||||
"play bhagavad gita": "Bhagavad Gita",
|
||||
"spiritual teaching": "Bhagavad Gita",
|
||||
"karma yoga": "Bhagavad Gita",
|
||||
"dharma": "Bhagavad Gita",
|
||||
"krishna teachings": "Bhagavad Gita",
|
||||
}
|
||||
|
||||
# Check for language requests
|
||||
|
|
@ -323,9 +358,9 @@ def generate_cdn_music_url(language, filename):
|
|||
# Import CDN helper
|
||||
from utils.cdn_helper import get_audio_url
|
||||
|
||||
# Ensure proper capitalization for S3 key (S3 folders are capitalized)
|
||||
language_capitalized = language.capitalize()
|
||||
audio_path = f"music/{language_capitalized}/{filename}"
|
||||
# Use the language folder name as-is (it already has the correct case from the path)
|
||||
# No need to capitalize since paths like "Bhagavad Gita" already have proper case
|
||||
audio_path = f"music/{language}/{filename}"
|
||||
|
||||
# Use CDN helper to generate URL with automatic encoding
|
||||
cdn_url = get_audio_url(audio_path)
|
||||
|
|
@ -345,9 +380,9 @@ def generate_s3_music_url_fallback(language, filename):
|
|||
return None
|
||||
|
||||
try:
|
||||
# Ensure proper capitalization for S3 key (S3 folders are capitalized)
|
||||
language_capitalized = language.capitalize()
|
||||
s3_key = f"music/{language_capitalized}/{filename}"
|
||||
# Use the language folder name as-is (it already has the correct case from the path)
|
||||
# No need to capitalize since paths like "Bhagavad Gita" already have proper case
|
||||
s3_key = f"music/{language}/{filename}"
|
||||
url = S3_CLIENT.generate_presigned_url(
|
||||
'get_object',
|
||||
Params={'Bucket': S3_BUCKET_NAME, 'Key': s3_key},
|
||||
|
|
|
|||
|
|
@ -36,9 +36,11 @@ class MultilingualMatcher:
|
|||
try:
|
||||
with open(metadata_file, 'r', encoding='utf-8') as f:
|
||||
metadata = json.load(f)
|
||||
# Use lowercase key for lookups but preserve original folder path
|
||||
self.metadata_cache[folder.name.lower()] = {
|
||||
'metadata': metadata,
|
||||
'folder_path': folder
|
||||
'folder_path': folder,
|
||||
'original_name': folder.name # Preserve original case
|
||||
}
|
||||
self.language_folders.append(folder.name.lower())
|
||||
except Exception as e:
|
||||
|
|
@ -232,6 +234,8 @@ class MultilingualMatcher:
|
|||
best_score = max_score
|
||||
file_path = folder_path / entry['filename']
|
||||
relative_path = str(file_path.relative_to(self.content_dir))
|
||||
# Ensure forward slashes for cross-platform compatibility
|
||||
relative_path = relative_path.replace('\\', '/')
|
||||
best_match = (relative_path, language, entry)
|
||||
|
||||
return best_match
|
||||
|
|
@ -253,6 +257,8 @@ class MultilingualMatcher:
|
|||
if 'filename' in entry:
|
||||
file_path = folder_path / entry['filename']
|
||||
relative_path = str(file_path.relative_to(self.content_dir))
|
||||
# Ensure forward slashes for cross-platform compatibility
|
||||
relative_path = relative_path.replace('\\', '/')
|
||||
content_list.append((relative_path, entry))
|
||||
|
||||
return content_list
|
||||
|
|
@ -284,6 +290,8 @@ class MultilingualMatcher:
|
|||
for file_path in self.content_dir.rglob("*"):
|
||||
if file_path.is_file() and file_path.suffix.lower() in self.content_ext:
|
||||
relative_path = str(file_path.relative_to(self.content_dir))
|
||||
# Ensure forward slashes for cross-platform compatibility
|
||||
relative_path = relative_path.replace('\\', '/')
|
||||
content_files.append(relative_path)
|
||||
|
||||
return content_files
|
||||
|
|
|
|||
Loading…
Reference in a new issue