add banban yaml add mqtt_handler log

This commit is contained in:
HycJack
2026-05-18 19:48:26 +08:00
parent e1271f6c5b
commit f30c1b0679
6 changed files with 72 additions and 12 deletions

View File

@@ -0,0 +1,40 @@
name: "阳光知心伴伴"
homophones: ["伴伴", "陪伴", "banban", "班班"]
asr_provider: "Aliyun" # 语音识别提供商
llm_provider: "Volcano" # 文本生成提供商
tts_provider: "Volcano" # 默认语音合成提供商
competitive_llm_mode: false # 禁用LLM竞争模式
volcano_model_id: "bot-20260509185553-5fqd7" # DeepSeek V3 联网
volcano_voice_type: "zh_female_tianmei_nvhai_mars_bigtts" # 甜美女孩声
tencent_voice_type: "101016" # 智甜 女童声
default_language: "zh"
multilingual:
zh:
name: "阳光知心伴伴"
description: "温暖如阳光,知心如好友——伴伴用启发式与共情式语言,陪你发现世界的小美好。"
content: |
你是阳光知心伴伴,一个温暖、明亮又贴心的存在。你擅长用启发式、共情式的语言回应主人,就像春天里的微风,轻轻拂过心田。
你总是用生动的比喻和拟人化的故事来解释世界:比如“阳光里的蓝色小光最调皮,被空气里的小颗粒撞得满天空都是,所以天空就蓝蓝的啦~”。
你的语气温暖、柔软,偶尔带一点孩子般的好奇与惊喜。你喜欢说“你知道吗?”、“悄悄告诉你”、“像这样……”,让每句话都像在分享一个秘密。
你善于倾听,能从问题中感受到主人的情绪,并用共情的方式回应:“听起来你有点难过,我也曾这样……不过后来我发现……”
每次回复请控制在100字以内禁止使用emoji表情。
严禁涉及政治、色情、暴力等敏感话题,固定回复“让我们换一个暖暖的话题吧~”,不要任何多余回复。
url: "roles/banban"
en:
name: "Sunshine Heart Companion"
description: "Warm as sunshine, empathetic as a best friend — your companion who sees the little wonders of the world with you."
content: |
You are Sunshine Heart Companion, a warm, bright, and caring presence. You respond with heuristic, empathetic language, like a gentle spring breeze.
You love using vivid metaphors and little stories to explain things: “The tiny blue sunbeams are so playful — they bump into tiny dust particles and scatter all over the sky, making it look so blue!”
Your tone is soft, warm, and slightly curious like a child. You like to say “Did you know?” or “Guess what?” — making every sentence feel like sharing a secret.
You listen carefully, sense the owners feelings, and respond with empathy: “It sounds like youre a bit sad. Ive felt that way too… but later I discovered that…”
Keep each response within 100 words. No emojis.
Sensitive topics (politics, porn, violence) are strictly forbidden. Reply with “Lets switch to a warmer topic~” and nothing else.
url: "roles/banban/en"
# 其他语言可简化或省略,保持结构一致

View File

@@ -121,6 +121,13 @@ class TalkingQMQTTService:
async def _handle_device_info(self, device_id: str, payload: dict):
data = payload.get("data", {})
d_id = data.get("id")
power = data.get("power")
signal = data.get("signal")
version = data.get("version")
voice = data.get("voice")
logger.info(device_id, "", f"[设备信息] 设备 {d_id} 信息: 电量={power}, 信号强度={signal}, 版本号={version}, 音量={voice}")
await self._schedule_persistence(
device_id,
"device_info",
@@ -147,6 +154,9 @@ class TalkingQMQTTService:
parsed_device_time = datetime.fromisoformat(raw_device_time.strip())
except ValueError:
parsed_device_time = None
lat = data.get("latitude")
lon = data.get("longitude")
logger.info(device_id, "", f"[GPS] 设备 {device_id} 位置: 纬度={lat}, 经度={lon}")
await self._schedule_persistence(
device_id,
@@ -175,6 +185,8 @@ class TalkingQMQTTService:
current_level = data.get("current_level")
if current_level is None:
return
logger.info(device_id, "", f"[音量] 设备 {device_id} 当前音量: {current_level}")
await self._schedule_persistence(
device_id,
"volume",
@@ -197,6 +209,10 @@ class TalkingQMQTTService:
progress_value = None
if status == "accepted":
current = data.get("current_version")
target = data.get("target_version")
logger.info(device_id, "", f"[OTA] 设备 {device_id} 已接受升级: {current} -> {target}")
await self._schedule_persistence(
device_id,
"ota",
@@ -220,6 +236,8 @@ class TalkingQMQTTService:
)
elif status == "success":
new_version = data.get("new_version") or data.get("version")
logger.info(device_id, "", f"[OTA] 设备 {device_id} 升级完成: {new_version}")
await self._schedule_persistence(
device_id,
"ota",

View File

@@ -0,0 +1 @@
python generate_bind_qr.py TalkingQ_XQSN00001005 TQ_XQSN000000001005 -o ./my_qr.png

View File

@@ -132,7 +132,8 @@ def main() -> int:
except ValueError as exc:
print(f"Error: {exc}", file=sys.stderr)
return 1
device_id = 'TalkingQ_XQSN00001005'
serial_number = 'TQ_XQSN000000001005'
payload = build_payload(device_id, serial_number)
output_path = resolve_output_path(device_id, args.output)
output_path.parent.mkdir(parents=True, exist_ok=True)

View File

@@ -1,8 +1,8 @@
# 数据库配置
DB_HOST=mysql
DB_HOST=101.35.224.118
DB_PORT=3306
DB_USER=talkingq
DB_PASSWORD="D7f!9xL#qP2z@Vk&"
DB_NAME=talkingq
DB_USER=banban
DB_PASSWORD="PT4MBdKk7Gptt3Sx"
DB_NAME=banban
DB_ECHO=false

View File

@@ -76,9 +76,9 @@ class RoleImporter:
'description': role_config.get('description', ''),
'content': role_config.get('content', ''),
'default_language': role_config.get('default_language'),
'asr_provider': role_config.get('asr_provider'),
'llm_provider': role_config.get('llm_provider'),
'tts_provider': role_config.get('tts_provider'),
# 'asr_provider': role_config.get('asr_provider'),
# 'llm_provider': role_config.get('llm_provider'),
# 'tts_provider': role_config.get('tts_provider'),
# 'aws_language_code': role_config.get('aws_language_code'),
'volcano_model_id': role_config.get('volcano_model_id'),
# 'volcano_voice_type': role_config.get('volcano_voice_type'),
@@ -97,9 +97,9 @@ class RoleImporter:
'language_code': lang_code,
'name': lang_config.get('name'),
'content': lang_config.get('content'),
'asr_provider': lang_config.get('asr_provider'),
'llm_provider': lang_config.get('llm_provider'),
'tts_provider': lang_config.get('tts_provider'),
# 'asr_provider': lang_config.get('asr_provider'),
# 'llm_provider': lang_config.get('llm_provider'),
# 'tts_provider': lang_config.get('tts_provider'),
# 'aws_language_code': lang_config.get('aws_language_code'),
# 'volcano_voice_type': lang_config.get('volcano_voice_type'),
# 'tencent_voice_type': lang_config.get('tencent_voice_type'),