chore: add Xunfei STT connectivity test script#16
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a standalone script under scripts/ to validate connectivity and basic functionality against Xunfei (科大讯飞) WebSocket STT (“iat”) by generating or loading PCM audio and streaming it frame-by-frame.
Changes:
- Add
scripts/test-xunfei-stt.pyfor building the authenticated WS URL, generating test PCM, and sending audio frames to Xunfei STT. - Print connection / recognition progress and summarize success/failure at the end.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+18
to
+20
| from datetime import datetime, timezone | ||
| from urllib.parse import urlencode | ||
| from email.utils import formatdate |
| import time | ||
| import struct | ||
| import math | ||
| import websocket |
Comment on lines
+2
to
+4
| """ | ||
| 测试讯飞语音听写 WebSocket STT API | ||
| 用法: python3 test-xunfei-stt.py <APP_ID> <API_KEY> <API_SECRET> [audio_file.pcm] |
Comment on lines
+111
to
+113
| url = build_url(app_id, api_key, api_secret) | ||
| print(f"[连接] {url[:80]}...") | ||
|
|
| if code != 0: | ||
| err = f"API错误 code={code}: {data.get('message', '')}" | ||
| print(f"[错误] {err}") | ||
| errors.append(err) |
| """ | ||
| 测试讯飞语音听写 WebSocket STT API | ||
| 用法: python3 test-xunfei-stt.py <APP_ID> <API_KEY> <API_SECRET> [audio_file.pcm] | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 变更内容
✅ 测试验证
PR 提交规范提醒: