实战演练:别再让我自己动手!初级用法:“帮我总结一下今天晚上的新闻。”(它会上网搜索并提炼) 终极Boss用法:“在桌面创建一个文件夹,把最近下载的PDF和Excel整理进去,然后阅读Excel内容,给我一个数据趋势总结。
// src/components/ChapterReader.tsx// 播放PCM音频const playPCMChunk = async (base64Audio: string): Promise => { return new Promise((resolve) => { if (!audioContextRef.current) { resolve(); return; } try { // 解码base64 const binaryString = atob(base64Audio); const bytes = new Uint8Array(binaryString.length); for (let i = 0; i < binaryString.length; i++) { bytes[i] = binaryString.charCodeAt(i); } // 创建AudioBuffer - 使用24000Hz采样率 const sampleRate = 24000; const audioBuffer = audioContextRef.current.createBuffer( 1, bytes.length / 2, sampleRate ); const channelData = audioBuffer.getChannelData(0); // 填充音频数据 (有符号16位PCM) const volumeGain = 0.8; // 音量增益,避免爆音 for (let i = 0; i < channelData.length; i++) { const sample = bytes[i * 2] | (bytes[i * 2 + 1] 32767 ? sample - 65536 : sample; channelData[i] = (signedSample / 32768.0) * volumeGain; } // 播放 const source = audioContextRef.current.createBufferSource(); source.buffer = audioBuffer; source.connect(audioContextRef.current.destination); source.onended = () => resolve(); source.start(); } catch (error) { console.error('播放音频失败:', error); resolve(); } });};关键工艺点:采样率:必须使用24000Hz,与TTS服务返回的采样率一致有符号16位PCM:范围是-32768到32767,需要正确处理负值音量增益:设置为0.8,避免音量过大导致爆音队列播放:使用队列串行播放音频块,保证流畅性字符时间映射与实时高亮根据字符时间映射实现文字高亮:
不需要写一行脚本,不需要 XPath,不需要定位元素。你只需要说人话。为什么它能冲到 9000 star?
2倍。跨境电商进出口突破千亿元,全球枢纽功能进一步凸显。江苏机电产品出口表现突出,占全省出口总值超七成。
三、第二站:VIEWEXPORT — 外部工具链噩梦 既然平台原生命令靠不住,那就把工作外包出去。
三、分清安装包和源码:别点错那个绿色按钮 GitHub 新手最容易踩的坑,就是那个绿色的 Code 按钮。