Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(audio): refresh ASR credentials and Telegram voice files

cyh90682ae7a09c
diff --git a/core/controller.py b/core/controller.py
index 7a4095bfe..eab307802 100644
--- a/core/controller.py
+++ b/core/controller.py
@@ -201,6 +201,7 @@ class Controller:
self.config.include_user_info = v2_config.include_user_info
self.config.reply_enhancements = v2_config.reply_enhancements
self.config.audio_asr = v2_config.audio_asr
+ self.config.remote_access = v2_config.remote_access
audio_asr_service = getattr(self, "audio_asr_service", None)
if audio_asr_service is not None:
audio_asr_service.config = self.config
diff --git a/modules/im/telegram.py b/modules/im/telegram.py
index c327469e2..9574d2b7e 100644
--- a/modules/im/telegram.py
+++ b/modules/im/telegram.py
@@ -633,6 +633,26 @@ class TelegramBot(BaseIMClient):
size=best.get("file_size"),
)
)
+ voice = message.get("voice")
+ if voice:
+ files.append(
+ FileAttachment(
+ name="telegram-voice.ogg",
+ mimetype=voice.get("mime_type") or "audio/ogg",
+ url=voice.get("file_id"),
+ size=voice.get("file_size"),
+ )
+ )
+ audio = message.get("audio")
+ if audio:
+ files.append(
+ FileAttachment(
+ name=audio.get("file_name") or "telegram-audio.mp3",
+ mimetype=audio.get("mime_type") or "audio/mpeg",
+ url=audio.get("file_id"),
+ size=audio.get("file_size"),
+ )
+ )
return files
def _normalize_command_text(self, text: str) -> str:
diff --git a/tests/test_controller_config_reload.py b/tests/test_controller_config_reload.py
index fa07fea80..3b5d2e9d7 100644
--- a/tests/test_controller_config_reload.py
+++ b/tests/test_controller_config_reload.py
@@ -50,3 +50,25 @@ def test_refresh_config_updates_platform_message_settings(tmp_path, monkeypatch)
controller._refresh_config_from_disk()
assert stale_discord_config.require_mention is False
+
+
+def test_refresh_config_updates_remote_access_for_audio_asr(tmp_path, monkeypatch) -> None:
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
+
+ controller = Controller.__new__(Controller)
+ controller.config = V2Config.from_payload(_config_payload({"bot_token": "discord-token"}))
+ controller.im_clients = {}
+ controller._config_mtime = None
+ controller.audio_asr_service = SimpleNamespace(config=controller.config)
+
+ latest_config = V2Config.from_payload(_config_payload({"bot_token": "discord-token"}))
+ latest_config.remote_access.vibe_cloud.enabled = True
+ latest_config.remote_access.vibe_cloud.backend_url = "https://avibe.bot"
+ latest_config.remote_access.vibe_cloud.instance_id = "inst_123"
+ latest_config.remote_access.vibe_cloud.instance_secret = "secret"
+ latest_config.save()
+
+ controller._refresh_config_from_disk()
+
+ assert controller.config.remote_access.vibe_cloud.instance_secret == "secret"
+ assert controller.audio_asr_service.config is controller.config
diff --git a/tests/test_telegram_bot.py b/tests/test_telegram_bot.py
index c9a6661b8..6c6db0aa8 100644
--- a/tests/test_telegram_bot.py
+++ b/tests/test_telegram_bot.py
@@ -84,6 +84,27 @@ def test_group_mention_only_falls_through_as_empty_message() -> None:
assert bot.on_message_callback.await_args.args[1] == ""
+def test_extract_files_includes_voice_and_audio_messages() -> None:
+ bot = TelegramBot(TelegramConfig(bot_token="123456:test-token"))
+
+ files = bot._extract_files(
+ {
+ "voice": {"file_id": "voice-file", "mime_type": "audio/ogg", "file_size": 1234},
+ "audio": {
+ "file_id": "audio-file",
+ "file_name": "song.mp3",
+ "mime_type": "audio/mpeg",
+ "file_size": 5678,
+ },
+ }
+ )
+
+ assert [(file.name, file.mimetype, file.url, file.size) for file in files] == [
+ ("telegram-voice.ogg", "audio/ogg", "voice-file", 1234),
+ ("song.mp3", "audio/mpeg", "audio-file", 5678),
+ ]
+
+
def test_plain_group_sessions_are_channel_scoped() -> None:
bot = TelegramBot(TelegramConfig(bot_token="123456:test-token"))