fix(prompt)+feat(gateway): platform-hint truth pass + universal voice-bubble transcode (all 22 hints source-verified) (#97873)
* fix(prompt): platform-hint truth pass — CLI/TUI file-delivery reality (paths/URLs only, MEDIA: prints literally), CLI no-markdown verified live, Slack/Discord markdown+tables truth, shared local-cron constant * feat(gateway): universal voice-bubble delivery — shared transcode_to_ogg_opus; telegram [[audio_as_voice]] any-format; feishu native voice; hints to new truth * chore: delete the webui ghost hint (tombstone comment, audit-verified); sync send_voice signature pin in tts routing test
This commit is contained in:
@@ -2247,15 +2247,36 @@ class FeishuAdapter(BasePlatformAdapter):
|
||||
metadata: Optional[Dict[str, Any]] = None,
|
||||
**kwargs,
|
||||
) -> SendResult:
|
||||
"""Send audio to Feishu as a file attachment plus optional caption."""
|
||||
return await self._send_uploaded_file_message(
|
||||
chat_id=chat_id,
|
||||
file_path=audio_path,
|
||||
reply_to=reply_to,
|
||||
metadata=metadata,
|
||||
caption=caption,
|
||||
outbound_message_type="audio",
|
||||
)
|
||||
"""Send audio to Feishu as a native voice message (opus) or file.
|
||||
|
||||
Feishu's voice channel only accepts Opus (msg_type='audio' with an
|
||||
opus upload). Non-opus audio (mp3/wav/flac/...) is transcoded on the
|
||||
fly via the shared ffmpeg engine so audio actually arrives as a
|
||||
playable voice message; when ffmpeg is unavailable the original
|
||||
file is sent as a file attachment (previous behavior).
|
||||
"""
|
||||
transcoded_path: Optional[str] = None
|
||||
ext = Path(audio_path).suffix.lower()
|
||||
if ext not in _FEISHU_OPUS_UPLOAD_EXTENSIONS:
|
||||
from gateway.platforms.base import transcode_to_ogg_opus
|
||||
transcoded_path = await asyncio.to_thread(transcode_to_ogg_opus, audio_path)
|
||||
if transcoded_path:
|
||||
audio_path = transcoded_path
|
||||
try:
|
||||
return await self._send_uploaded_file_message(
|
||||
chat_id=chat_id,
|
||||
file_path=audio_path,
|
||||
reply_to=reply_to,
|
||||
metadata=metadata,
|
||||
caption=caption,
|
||||
outbound_message_type="audio",
|
||||
)
|
||||
finally:
|
||||
if transcoded_path:
|
||||
try:
|
||||
os.unlink(transcoded_path)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
async def send_document(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user