New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

metro-agent

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metro-agent

Metro Agent

latest
npmnpm
Version
0.2.18
Version published
Weekly downloads
52
5100%
Maintainers
1
Weekly downloads
 
Created
Source

metro-agent

// tts服务
const ttsClient = {
  tts: async ({ text }) => {
    return ttsServe(text)
  }
}

new MetroAgent({
  // tts
  ttsClient,
  // [选填] tts播放结束状态更新延迟,毫秒
  ttsDelay: 100,
  // 是否开启流式
  stream: false,
  // openai baseURL
  baseURL: 'https://dashscope.aliyuncs.com/compatible-mode/v1',
  // openai model
  model: 'qwq-32b',
  // openai apiKey
  apiKey: 'Bearer $DASHSCOPE_API_KEY',
  // 音频转文本实时接口(ws)
  asrWsUrl: '/api/ws',
  // 唤醒词
  wakeupWord: ['小爱同学'],
  // 休眠词
  dormancyWord: ['再见'],
  // 唤醒后欢迎词,配置tts服务后自动调用
  welcomeWord: '你好,我在。',
  // 休眠后提示词,配置tts服务后自动调用
  goodbyeWord: '好的,再见。',
  // [选用] 支持重写openai fetch
  fetch: async (url, options) => {
    if (url.includes("/chat/completions")) {
      return fetch('/xxxx/chat-completions', options);
    }
  },
  // 唤醒超时
  wakeTimeout: 20 * 1000,
  // 向ws发送数据
  onSend: (client, sample) => {},
  // 唤醒后回调
  onWake: (welcomeWord) => {},
  // 休眠后回调
  onDormancy: (dormancyWord) => {},
  // asr转换后消息回调
  onMessage: (data, wakeStatus, ttsStatus) => {},
  // 开始调用模型回调
  onStart: () => {},
  // 模型流式回调
  onStream: (chunk) => {},
  // 模型调用完成回调
  onCompleted: (res) => {},
  // [选填] 录音数据处理回调,默认使用:https://github.com/modelscope/FunASR/blob/main/runtime/docs/SDK_advanced_guide_offline_en_zh.md#Html%E7%BD%91%E9%A1%B5%E7%89%88
  onRecProcess: (buffer, powerLevel, bufferDuration, bufferSampleRate) => {},
  // 部分状态变化回调
  onChange: () => {},
  // 音频波形回调
  onAudioWaveform: (powerLevel: number) => {},
  // 错误回调
  onError: (error) => {}
})

相关资源

https://github.com/modelscope/FunASR

https://github.com/xiangyuecn/Recorder

Keywords

Agent

FAQs

Package last updated on 12 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts