Skip to content

Commit

Permalink
update close ws-client conn
Browse files Browse the repository at this point in the history
  • Loading branch information
devinyf committed Jun 6, 2024
1 parent c27267d commit 216adb4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion example/paraformer/realtime/speech2text.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func main() {

// 等待语音识别结果输出
time.Sleep(5 * time.Second)
// 手动关闭语音识别
// 关闭语音识别连接
if err := cli.CloseSpeechToTextGeneration(); err != nil {
panic(err)
}
Expand Down
8 changes: 7 additions & 1 deletion tongyiclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,13 @@ func (q *TongyiClient) CloseSpeechToTextGeneration() error {
return errors.New("wsCli is nil")
}

return paraformer.CloseRecognitionClient(q.wsCli)
if err := paraformer.CloseRecognitionClient(q.wsCli); err != nil {
return err
}

q.wsCli = nil

return nil
}

func (q *TongyiClient) CreateEmbedding(ctx context.Context, r *embedding.Request) ([][]float64, int, error) {
Expand Down

0 comments on commit 216adb4

Please sign in to comment.