qt-human 2.3.7-alpha → 2.3.9-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -110,12 +110,12 @@ speak(text: string, callback?: Function, opt?: {[key: string]: any}): Promise<bo
110
110
  - `opt`: 可选配置,如 `{ split: false }` 控制是否分段
111
111
  - 返回值: Promise<boolean> - 说话是否成功
112
112
 
113
- ### ask
113
+ ### askStream
114
114
 
115
115
  进行 AI 问答
116
116
 
117
117
  ```typescript
118
- ask(params: QuanTe.API.AskParams, callback: (msgs: IResultData<QuanTe.API.ChatMessage[]>) => void): Promise<QuanTe.Result<QuanTe.API.AskResponse>>
118
+ askStream(params: QuanTe.API.AskParams, callback: (msgs: IResultData<QuanTe.API.ChatMessage[]>) => void): Promise<QuanTe.Result<QuanTe.API.AskResponse>>
119
119
  ```
120
120
 
121
121
  - `params`: 问答参数
@@ -170,10 +170,9 @@ muteAction(isMute: boolean = true)
170
170
  开始录音转文本
171
171
 
172
172
  ```typescript
173
- startVoice2Text(callback: (data: QuanTe.Recorder.Voice2Text) => void): Promise<QuanTe.Result<QuanTe.Recorder.PermissionResult>>
173
+ startVoice2Text(): Promise<QuanTe.Result<QuanTe.Recorder.PermissionResult>>
174
174
  ```
175
175
 
176
- - `callback`: 回调函数,接收语音转文本结果
177
176
  - 返回值: Promise<QuanTe.Result<QuanTe.Recorder.PermissionResult>>
178
177
 
179
178
  ### stopVoice2Text
@@ -181,9 +180,10 @@ startVoice2Text(callback: (data: QuanTe.Recorder.Voice2Text) => void): Promise<Q
181
180
  结束录音转文本
182
181
 
183
182
  ```typescript
184
- stopVoice2Text(): Promise<QuanTe.Result<null>>
183
+ stopVoice2Text(callback: (data: QuanTe.Recorder.Voice2Text) => void): Promise<QuanTe.Result<null>>
185
184
  ```
186
185
 
186
+ - `callback`: 回调函数,接收语音转文本结果
187
187
  - 返回值: Promise<QuanTe.Result<null>>
188
188
 
189
189
  ### stop
@@ -397,7 +397,7 @@ human.setCharacter('characterId');
397
397
  human.speak('你好,我是数字人');
398
398
 
399
399
  // AI问答
400
- human.ask({
400
+ human.askStream({
401
401
  // 请求id,非必填
402
402
  reqId: 'abcdefg',
403
403
  message: [{ role: 'user', content: '你好' }]
@@ -414,12 +414,12 @@ human.muteAudio(true); // 静音
414
414
  human.muteAudio(false); // 取消静音
415
415
 
416
416
  // 开始录音
417
- human.startVoice2Text((data: QuanTe.Recorder.Voice2Text) => {
417
+ human.startVoice2Text()
418
+ // 结束录音语音转文本
419
+ human.stopVoice2Text((data: QuanTe.Recorder.Voice2Text) => {
418
420
  // 语音转文本内容
419
421
  console.log(data)
420
422
  })
421
- // 结束录音语音转文本
422
- human.stopVoice2Text()
423
423
 
424
424
  // 通过 audio 和 bs 数据驱动数字人说话
425
425
  human.speakByAudioShapes(['https://xxx/audio.wav', 'https://xxx/audio2.wav'], [[[...52个数据],[...52个数据]], [[...52个数据]]])
@@ -476,13 +476,16 @@ human.on(EmitEvent.HUMAN_READY, () => {
476
476
  ## 数字人授权接口
477
477
 
478
478
  ### 接口说明
479
+
479
480
  获取数字人访问令牌(token),用于初始化 Human 对象。
480
481
 
481
482
  ### 请求信息
483
+
482
484
  - 请求方式:POST
483
485
  - 接口地址:`https://ai.quantekeji.com/platform-api/human-auth/get-token`
484
486
 
485
487
  ### 请求参数
488
+
486
489
  ```typescript
487
490
  {
488
491
  // 应用秘钥(不要将秘钥保存在前端)
@@ -497,6 +500,7 @@ human.on(EmitEvent.HUMAN_READY, () => {
497
500
  ```
498
501
 
499
502
  ### 响应参数
503
+
500
504
  ```typescript
501
505
  {
502
506
  // 状态码:0 表示成功
@@ -510,7 +514,7 @@ human.on(EmitEvent.HUMAN_READY, () => {
510
514
  }
511
515
  ```
512
516
 
513
- ### 使用示例
517
+ ### 代码使用示例
514
518
 
515
519
  ```typescript
516
520
  // 使用 axios 发起请求
@@ -538,13 +542,10 @@ async function getToken() {
538
542
  }
539
543
  ```
540
544
 
541
- ### 注意事项
545
+ ### 授权接口注意事项
546
+
542
547
  1. secretKey 是敏感信息,不要在前端代码中直接存储,在 [qtworld](https://ai.quantekeji.com/platform/login) 平台个人中心获取
543
548
  2. visitorId 需要保证唯一性,建议使用用户ID或其他唯一标识
544
549
  3. token 有效期通常为 2 小时,过期后需要重新获取
545
550
  4. 建议在服务端调用此接口,避免暴露 secretKey
546
551
  5. 获取到 token 后,请妥善保存,用于初始化 Human 对象
547
-
548
-
549
-
550
-