mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-12 03:33:33 +08:00
Go: add stats (#17061)
### Summary Add LLM token stats framework --------- Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -84,7 +84,7 @@ func (h *ChatHandler) ChatAudioSpeech(c *gin.Context) {
|
||||
if seg == "" {
|
||||
continue
|
||||
}
|
||||
resp, err := driver.AudioSpeech(&modelName, &seg, apiConfig, &modelModule.TTSConfig{Format: "mp3"})
|
||||
resp, err := driver.AudioSpeech(&modelName, &seg, apiConfig, &modelModule.TTSConfig{Format: "mp3"}, nil)
|
||||
if err != nil {
|
||||
common.Warn("chat TTS synthesis failed",
|
||||
zap.Int("segmentIndex", i),
|
||||
@@ -234,7 +234,7 @@ func (h *ChatHandler) ChatAudioTranscription(c *gin.Context) {
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := driver.TranscribeAudioWithSender(&modelName, &tmpPath, apiConfig, &modelModule.ASRConfig{}, sender); err != nil {
|
||||
if err = driver.TranscribeAudioWithSender(&modelName, &tmpPath, apiConfig, &modelModule.ASRConfig{}, nil, sender); err != nil {
|
||||
errEvent := map[string]interface{}{"event": "error", "text": err.Error()}
|
||||
data, _ := json.Marshal(errEvent)
|
||||
_, _ = c.Writer.WriteString(fmt.Sprintf("data: %s\n\n", data))
|
||||
@@ -252,7 +252,7 @@ func (h *ChatHandler) ChatAudioTranscription(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := driver.TranscribeAudio(&modelName, &tmpPath, apiConfig, &modelModule.ASRConfig{})
|
||||
resp, err := driver.TranscribeAudio(&modelName, &tmpPath, apiConfig, &modelModule.ASRConfig{}, nil)
|
||||
if err != nil {
|
||||
common.ErrorWithCode(c, common.CodeServerError, err.Error())
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user