@dofe/infra-clients 0.1.1
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/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/agentx/agentx-client.module.d.ts +10 -0
- package/dist/internal/agentx/agentx-client.module.d.ts.map +1 -0
- package/dist/internal/agentx/agentx-client.module.js +38 -0
- package/dist/internal/agentx/agentx-client.module.js.map +1 -0
- package/dist/internal/agentx/agentx-client.service.d.ts +570 -0
- package/dist/internal/agentx/agentx-client.service.d.ts.map +1 -0
- package/dist/internal/agentx/agentx-client.service.js +912 -0
- package/dist/internal/agentx/agentx-client.service.js.map +1 -0
- package/dist/internal/agentx/agentx-file-client.service.d.ts +48 -0
- package/dist/internal/agentx/agentx-file-client.service.d.ts.map +1 -0
- package/dist/internal/agentx/agentx-file-client.service.js +276 -0
- package/dist/internal/agentx/agentx-file-client.service.js.map +1 -0
- package/dist/internal/agentx/index.d.ts +9 -0
- package/dist/internal/agentx/index.d.ts.map +1 -0
- package/dist/internal/agentx/index.js +27 -0
- package/dist/internal/agentx/index.js.map +1 -0
- package/dist/internal/agentx/interfaces/file.interface.d.ts +21 -0
- package/dist/internal/agentx/interfaces/file.interface.d.ts.map +1 -0
- package/dist/internal/agentx/interfaces/file.interface.js +22 -0
- package/dist/internal/agentx/interfaces/file.interface.js.map +1 -0
- package/dist/internal/agentx/interfaces/task.interface.d.ts +74 -0
- package/dist/internal/agentx/interfaces/task.interface.d.ts.map +1 -0
- package/dist/internal/agentx/interfaces/task.interface.js +16 -0
- package/dist/internal/agentx/interfaces/task.interface.js.map +1 -0
- package/dist/internal/ai/index.d.ts +3 -0
- package/dist/internal/ai/index.d.ts.map +1 -0
- package/dist/internal/ai/index.js +19 -0
- package/dist/internal/ai/index.js.map +1 -0
- package/dist/internal/ai/risk-detection.client.d.ts +74 -0
- package/dist/internal/ai/risk-detection.client.d.ts.map +1 -0
- package/dist/internal/ai/risk-detection.client.js +224 -0
- package/dist/internal/ai/risk-detection.client.js.map +1 -0
- package/dist/internal/ai/risk-detection.module.d.ts +3 -0
- package/dist/internal/ai/risk-detection.module.d.ts.map +1 -0
- package/dist/internal/ai/risk-detection.module.js +35 -0
- package/dist/internal/ai/risk-detection.module.js.map +1 -0
- package/dist/internal/ai-provider/ai-provider.client.d.ts +81 -0
- package/dist/internal/ai-provider/ai-provider.client.d.ts.map +1 -0
- package/dist/internal/ai-provider/ai-provider.client.js +435 -0
- package/dist/internal/ai-provider/ai-provider.client.js.map +1 -0
- package/dist/internal/ai-provider/ai-provider.module.d.ts +3 -0
- package/dist/internal/ai-provider/ai-provider.module.d.ts.map +1 -0
- package/dist/internal/ai-provider/ai-provider.module.js +28 -0
- package/dist/internal/ai-provider/ai-provider.module.js.map +1 -0
- package/dist/internal/ai-provider/index.d.ts +4 -0
- package/dist/internal/ai-provider/index.d.ts.map +1 -0
- package/dist/internal/ai-provider/index.js +8 -0
- package/dist/internal/ai-provider/index.js.map +1 -0
- package/dist/internal/channel-verify/channel-verify.client.d.ts +31 -0
- package/dist/internal/channel-verify/channel-verify.client.d.ts.map +1 -0
- package/dist/internal/channel-verify/channel-verify.client.js +150 -0
- package/dist/internal/channel-verify/channel-verify.client.js.map +1 -0
- package/dist/internal/channel-verify/index.d.ts +5 -0
- package/dist/internal/channel-verify/index.d.ts.map +1 -0
- package/dist/internal/channel-verify/index.js +26 -0
- package/dist/internal/channel-verify/index.js.map +1 -0
- package/dist/internal/complexity-classifier/complexity-classifier.module.d.ts +3 -0
- package/dist/internal/complexity-classifier/complexity-classifier.module.d.ts.map +1 -0
- package/dist/internal/complexity-classifier/complexity-classifier.module.js +30 -0
- package/dist/internal/complexity-classifier/complexity-classifier.module.js.map +1 -0
- package/dist/internal/complexity-classifier/complexity-classifier.service.d.ts +57 -0
- package/dist/internal/complexity-classifier/complexity-classifier.service.d.ts.map +1 -0
- package/dist/internal/complexity-classifier/complexity-classifier.service.js +285 -0
- package/dist/internal/complexity-classifier/complexity-classifier.service.js.map +1 -0
- package/dist/internal/complexity-classifier/complexity-classifier.types.d.ts +78 -0
- package/dist/internal/complexity-classifier/complexity-classifier.types.d.ts.map +1 -0
- package/dist/internal/complexity-classifier/complexity-classifier.types.js +20 -0
- package/dist/internal/complexity-classifier/complexity-classifier.types.js.map +1 -0
- package/dist/internal/complexity-classifier/index.d.ts +7 -0
- package/dist/internal/complexity-classifier/index.d.ts.map +1 -0
- package/dist/internal/complexity-classifier/index.js +25 -0
- package/dist/internal/complexity-classifier/index.js.map +1 -0
- package/dist/internal/crypt/crypt-client.service.spec.d.ts +2 -0
- package/dist/internal/crypt/crypt-client.service.spec.d.ts.map +1 -0
- package/dist/internal/crypt/crypt-client.service.spec.js +17 -0
- package/dist/internal/crypt/crypt-client.service.spec.js.map +1 -0
- package/dist/internal/crypt/crypt.client.d.ts +10 -0
- package/dist/internal/crypt/crypt.client.d.ts.map +1 -0
- package/dist/internal/crypt/crypt.client.js +78 -0
- package/dist/internal/crypt/crypt.client.js.map +1 -0
- package/dist/internal/crypt/crypt.module.d.ts +3 -0
- package/dist/internal/crypt/crypt.module.d.ts.map +1 -0
- package/dist/internal/crypt/crypt.module.js +23 -0
- package/dist/internal/crypt/crypt.module.js.map +1 -0
- package/dist/internal/crypt/index.d.ts +3 -0
- package/dist/internal/crypt/index.d.ts.map +1 -0
- package/dist/internal/crypt/index.js +19 -0
- package/dist/internal/crypt/index.js.map +1 -0
- package/dist/internal/email/dto/email.dto.d.ts +62 -0
- package/dist/internal/email/dto/email.dto.d.ts.map +1 -0
- package/dist/internal/email/dto/email.dto.js +50 -0
- package/dist/internal/email/dto/email.dto.js.map +1 -0
- package/dist/internal/email/index.d.ts +10 -0
- package/dist/internal/email/index.d.ts.map +1 -0
- package/dist/internal/email/index.js +29 -0
- package/dist/internal/email/index.js.map +1 -0
- package/dist/internal/email/sendcloud.client.d.ts +103 -0
- package/dist/internal/email/sendcloud.client.d.ts.map +1 -0
- package/dist/internal/email/sendcloud.client.js +336 -0
- package/dist/internal/email/sendcloud.client.js.map +1 -0
- package/dist/internal/exchange-rate/exchange-rate.client.d.ts +49 -0
- package/dist/internal/exchange-rate/exchange-rate.client.d.ts.map +1 -0
- package/dist/internal/exchange-rate/exchange-rate.client.js +166 -0
- package/dist/internal/exchange-rate/exchange-rate.client.js.map +1 -0
- package/dist/internal/exchange-rate/exchange-rate.module.d.ts +3 -0
- package/dist/internal/exchange-rate/exchange-rate.module.d.ts.map +1 -0
- package/dist/internal/exchange-rate/exchange-rate.module.js +23 -0
- package/dist/internal/exchange-rate/exchange-rate.module.js.map +1 -0
- package/dist/internal/exchange-rate/index.d.ts +3 -0
- package/dist/internal/exchange-rate/index.d.ts.map +1 -0
- package/dist/internal/exchange-rate/index.js +19 -0
- package/dist/internal/exchange-rate/index.js.map +1 -0
- package/dist/internal/file-cdn/dto/file-cdn.dto.d.ts +78 -0
- package/dist/internal/file-cdn/dto/file-cdn.dto.d.ts.map +1 -0
- package/dist/internal/file-cdn/dto/file-cdn.dto.js +70 -0
- package/dist/internal/file-cdn/dto/file-cdn.dto.js.map +1 -0
- package/dist/internal/file-cdn/file-cdn-client.service.spec.d.ts +2 -0
- package/dist/internal/file-cdn/file-cdn-client.service.spec.d.ts.map +1 -0
- package/dist/internal/file-cdn/file-cdn-client.service.spec.js +17 -0
- package/dist/internal/file-cdn/file-cdn-client.service.spec.js.map +1 -0
- package/dist/internal/file-cdn/file-cdn.client.d.ts +283 -0
- package/dist/internal/file-cdn/file-cdn.client.d.ts.map +1 -0
- package/dist/internal/file-cdn/file-cdn.client.js +526 -0
- package/dist/internal/file-cdn/file-cdn.client.js.map +1 -0
- package/dist/internal/file-cdn/file-cdn.module.d.ts +3 -0
- package/dist/internal/file-cdn/file-cdn.module.d.ts.map +1 -0
- package/dist/internal/file-cdn/file-cdn.module.js +32 -0
- package/dist/internal/file-cdn/file-cdn.module.js.map +1 -0
- package/dist/internal/file-cdn/index.d.ts +35 -0
- package/dist/internal/file-cdn/index.d.ts.map +1 -0
- package/dist/internal/file-cdn/index.js +54 -0
- package/dist/internal/file-cdn/index.js.map +1 -0
- package/dist/internal/file-storage/config/file.config.d.ts +12 -0
- package/dist/internal/file-storage/config/file.config.d.ts.map +1 -0
- package/dist/internal/file-storage/config/file.config.js +15 -0
- package/dist/internal/file-storage/config/file.config.js.map +1 -0
- package/dist/internal/file-storage/dto/file.dto.d.ts +163 -0
- package/dist/internal/file-storage/dto/file.dto.d.ts.map +1 -0
- package/dist/internal/file-storage/dto/file.dto.js +98 -0
- package/dist/internal/file-storage/dto/file.dto.js.map +1 -0
- package/dist/internal/file-storage/file-gcs.client.d.ts +33 -0
- package/dist/internal/file-storage/file-gcs.client.d.ts.map +1 -0
- package/dist/internal/file-storage/file-gcs.client.js +118 -0
- package/dist/internal/file-storage/file-gcs.client.js.map +1 -0
- package/dist/internal/file-storage/file-qiniu.client.d.ts +199 -0
- package/dist/internal/file-storage/file-qiniu.client.d.ts.map +1 -0
- package/dist/internal/file-storage/file-qiniu.client.js +526 -0
- package/dist/internal/file-storage/file-qiniu.client.js.map +1 -0
- package/dist/internal/file-storage/file-s3.client.d.ts +158 -0
- package/dist/internal/file-storage/file-s3.client.d.ts.map +1 -0
- package/dist/internal/file-storage/file-s3.client.js +865 -0
- package/dist/internal/file-storage/file-s3.client.js.map +1 -0
- package/dist/internal/file-storage/file-storage.interface.d.ts +38 -0
- package/dist/internal/file-storage/file-storage.interface.d.ts.map +1 -0
- package/dist/internal/file-storage/file-storage.interface.js +3 -0
- package/dist/internal/file-storage/file-storage.interface.js.map +1 -0
- package/dist/internal/file-storage/file-tos.client.d.ts +109 -0
- package/dist/internal/file-storage/file-tos.client.d.ts.map +1 -0
- package/dist/internal/file-storage/file-tos.client.js +630 -0
- package/dist/internal/file-storage/file-tos.client.js.map +1 -0
- package/dist/internal/file-storage/file-us3.client.d.ts +30 -0
- package/dist/internal/file-storage/file-us3.client.d.ts.map +1 -0
- package/dist/internal/file-storage/file-us3.client.js +129 -0
- package/dist/internal/file-storage/file-us3.client.js.map +1 -0
- package/dist/internal/file-storage/index.d.ts +15 -0
- package/dist/internal/file-storage/index.d.ts.map +1 -0
- package/dist/internal/file-storage/index.js +37 -0
- package/dist/internal/file-storage/index.js.map +1 -0
- package/dist/internal/health-check/health-check.client.d.ts +37 -0
- package/dist/internal/health-check/health-check.client.d.ts.map +1 -0
- package/dist/internal/health-check/health-check.client.js +142 -0
- package/dist/internal/health-check/health-check.client.js.map +1 -0
- package/dist/internal/health-check/health-check.module.d.ts +3 -0
- package/dist/internal/health-check/health-check.module.d.ts.map +1 -0
- package/dist/internal/health-check/health-check.module.js +33 -0
- package/dist/internal/health-check/health-check.module.js.map +1 -0
- package/dist/internal/health-check/index.d.ts +6 -0
- package/dist/internal/health-check/index.d.ts.map +1 -0
- package/dist/internal/health-check/index.js +11 -0
- package/dist/internal/health-check/index.js.map +1 -0
- package/dist/internal/ip-info/dto/ip-info.dto.d.ts +16 -0
- package/dist/internal/ip-info/dto/ip-info.dto.d.ts.map +1 -0
- package/dist/internal/ip-info/dto/ip-info.dto.js +3 -0
- package/dist/internal/ip-info/dto/ip-info.dto.js.map +1 -0
- package/dist/internal/ip-info/index.d.ts +4 -0
- package/dist/internal/ip-info/index.d.ts.map +1 -0
- package/dist/internal/ip-info/index.js +20 -0
- package/dist/internal/ip-info/index.js.map +1 -0
- package/dist/internal/ip-info/ip-info.client.d.ts +16 -0
- package/dist/internal/ip-info/ip-info.client.d.ts.map +1 -0
- package/dist/internal/ip-info/ip-info.client.js +77 -0
- package/dist/internal/ip-info/ip-info.client.js.map +1 -0
- package/dist/internal/ip-info/ip-info.module.d.ts +3 -0
- package/dist/internal/ip-info/ip-info.module.d.ts.map +1 -0
- package/dist/internal/ip-info/ip-info.module.js +28 -0
- package/dist/internal/ip-info/ip-info.module.js.map +1 -0
- package/dist/internal/mlflow/mlflow.client.d.ts +44 -0
- package/dist/internal/mlflow/mlflow.client.d.ts.map +1 -0
- package/dist/internal/mlflow/mlflow.client.js +184 -0
- package/dist/internal/mlflow/mlflow.client.js.map +1 -0
- package/dist/internal/mlflow/mlflow.module.d.ts +3 -0
- package/dist/internal/mlflow/mlflow.module.d.ts.map +1 -0
- package/dist/internal/mlflow/mlflow.module.js +23 -0
- package/dist/internal/mlflow/mlflow.module.js.map +1 -0
- package/dist/internal/model-research-proxy/anthropic-proxy-research.client.d.ts +52 -0
- package/dist/internal/model-research-proxy/anthropic-proxy-research.client.d.ts.map +1 -0
- package/dist/internal/model-research-proxy/anthropic-proxy-research.client.js +174 -0
- package/dist/internal/model-research-proxy/anthropic-proxy-research.client.js.map +1 -0
- package/dist/internal/model-research-proxy/anthropic-proxy-research.client.spec.d.ts +2 -0
- package/dist/internal/model-research-proxy/anthropic-proxy-research.client.spec.d.ts.map +1 -0
- package/dist/internal/model-research-proxy/anthropic-proxy-research.client.spec.js +145 -0
- package/dist/internal/model-research-proxy/anthropic-proxy-research.client.spec.js.map +1 -0
- package/dist/internal/model-research-proxy/anthropic-proxy-research.module.d.ts +3 -0
- package/dist/internal/model-research-proxy/anthropic-proxy-research.module.d.ts.map +1 -0
- package/dist/internal/model-research-proxy/anthropic-proxy-research.module.js +30 -0
- package/dist/internal/model-research-proxy/anthropic-proxy-research.module.js.map +1 -0
- package/dist/internal/model-research-proxy/index.d.ts +6 -0
- package/dist/internal/model-research-proxy/index.d.ts.map +1 -0
- package/dist/internal/model-research-proxy/index.js +24 -0
- package/dist/internal/model-research-proxy/index.js.map +1 -0
- package/dist/internal/model-verify/index.d.ts +4 -0
- package/dist/internal/model-verify/index.d.ts.map +1 -0
- package/dist/internal/model-verify/index.js +26 -0
- package/dist/internal/model-verify/index.js.map +1 -0
- package/dist/internal/model-verify/model-verify.client.d.ts +77 -0
- package/dist/internal/model-verify/model-verify.client.d.ts.map +1 -0
- package/dist/internal/model-verify/model-verify.client.js +324 -0
- package/dist/internal/model-verify/model-verify.client.js.map +1 -0
- package/dist/internal/ocr/dto/ocr.dto.d.ts +76 -0
- package/dist/internal/ocr/dto/ocr.dto.d.ts.map +1 -0
- package/dist/internal/ocr/dto/ocr.dto.js +48 -0
- package/dist/internal/ocr/dto/ocr.dto.js.map +1 -0
- package/dist/internal/ocr/index.d.ts +4 -0
- package/dist/internal/ocr/index.d.ts.map +1 -0
- package/dist/internal/ocr/index.js +20 -0
- package/dist/internal/ocr/index.js.map +1 -0
- package/dist/internal/ocr/ocr.client.d.ts +39 -0
- package/dist/internal/ocr/ocr.client.d.ts.map +1 -0
- package/dist/internal/ocr/ocr.client.js +112 -0
- package/dist/internal/ocr/ocr.client.js.map +1 -0
- package/dist/internal/ocr/ocr.module.d.ts +3 -0
- package/dist/internal/ocr/ocr.module.d.ts.map +1 -0
- package/dist/internal/ocr/ocr.module.js +28 -0
- package/dist/internal/ocr/ocr.module.js.map +1 -0
- package/dist/internal/openai/index.d.ts +3 -0
- package/dist/internal/openai/index.d.ts.map +1 -0
- package/dist/internal/openai/index.js +19 -0
- package/dist/internal/openai/index.js.map +1 -0
- package/dist/internal/openai/openai.client.d.ts +36 -0
- package/dist/internal/openai/openai.client.d.ts.map +1 -0
- package/dist/internal/openai/openai.client.js +112 -0
- package/dist/internal/openai/openai.client.js.map +1 -0
- package/dist/internal/openai/openai.module.d.ts +3 -0
- package/dist/internal/openai/openai.module.d.ts.map +1 -0
- package/dist/internal/openai/openai.module.js +30 -0
- package/dist/internal/openai/openai.module.js.map +1 -0
- package/dist/internal/openclaw/docker-exec.service.d.ts +132 -0
- package/dist/internal/openclaw/docker-exec.service.d.ts.map +1 -0
- package/dist/internal/openclaw/docker-exec.service.js +544 -0
- package/dist/internal/openclaw/docker-exec.service.js.map +1 -0
- package/dist/internal/openclaw/index.d.ts +14 -0
- package/dist/internal/openclaw/index.d.ts.map +1 -0
- package/dist/internal/openclaw/index.js +32 -0
- package/dist/internal/openclaw/index.js.map +1 -0
- package/dist/internal/openclaw/openclaw-agent-coordination.client.d.ts +73 -0
- package/dist/internal/openclaw/openclaw-agent-coordination.client.d.ts.map +1 -0
- package/dist/internal/openclaw/openclaw-agent-coordination.client.js +249 -0
- package/dist/internal/openclaw/openclaw-agent-coordination.client.js.map +1 -0
- package/dist/internal/openclaw/openclaw-context-status.client.d.ts +66 -0
- package/dist/internal/openclaw/openclaw-context-status.client.d.ts.map +1 -0
- package/dist/internal/openclaw/openclaw-context-status.client.js +164 -0
- package/dist/internal/openclaw/openclaw-context-status.client.js.map +1 -0
- package/dist/internal/openclaw/openclaw-cron.client.d.ts +61 -0
- package/dist/internal/openclaw/openclaw-cron.client.d.ts.map +1 -0
- package/dist/internal/openclaw/openclaw-cron.client.js +416 -0
- package/dist/internal/openclaw/openclaw-cron.client.js.map +1 -0
- package/dist/internal/openclaw/openclaw-gateway.client.d.ts +41 -0
- package/dist/internal/openclaw/openclaw-gateway.client.d.ts.map +1 -0
- package/dist/internal/openclaw/openclaw-gateway.client.js +175 -0
- package/dist/internal/openclaw/openclaw-gateway.client.js.map +1 -0
- package/dist/internal/openclaw/openclaw-skill-sync.client.d.ts +222 -0
- package/dist/internal/openclaw/openclaw-skill-sync.client.d.ts.map +1 -0
- package/dist/internal/openclaw/openclaw-skill-sync.client.js +720 -0
- package/dist/internal/openclaw/openclaw-skill-sync.client.js.map +1 -0
- package/dist/internal/openclaw/openclaw.client.d.ts +602 -0
- package/dist/internal/openclaw/openclaw.client.d.ts.map +1 -0
- package/dist/internal/openclaw/openclaw.client.js +3062 -0
- package/dist/internal/openclaw/openclaw.client.js.map +1 -0
- package/dist/internal/openclaw/openclaw.module.d.ts +3 -0
- package/dist/internal/openclaw/openclaw.module.d.ts.map +1 -0
- package/dist/internal/openclaw/openclaw.module.js +62 -0
- package/dist/internal/openclaw/openclaw.module.js.map +1 -0
- package/dist/internal/openclaw/skill-translation.service.d.ts +39 -0
- package/dist/internal/openclaw/skill-translation.service.d.ts.map +1 -0
- package/dist/internal/openclaw/skill-translation.service.js +217 -0
- package/dist/internal/openclaw/skill-translation.service.js.map +1 -0
- package/dist/internal/openclaw/types/cron.types.d.ts +112 -0
- package/dist/internal/openclaw/types/cron.types.d.ts.map +1 -0
- package/dist/internal/openclaw/types/cron.types.js +9 -0
- package/dist/internal/openclaw/types/cron.types.js.map +1 -0
- package/dist/internal/openspeech/index.d.ts +35 -0
- package/dist/internal/openspeech/index.d.ts.map +1 -0
- package/dist/internal/openspeech/index.js +56 -0
- package/dist/internal/openspeech/index.js.map +1 -0
- package/dist/internal/openspeech/openspeech.client.d.ts +304 -0
- package/dist/internal/openspeech/openspeech.client.d.ts.map +1 -0
- package/dist/internal/openspeech/openspeech.client.js +405 -0
- package/dist/internal/openspeech/openspeech.client.js.map +1 -0
- package/dist/internal/openspeech/openspeech.factory.d.ts +247 -0
- package/dist/internal/openspeech/openspeech.factory.d.ts.map +1 -0
- package/dist/internal/openspeech/openspeech.factory.js +406 -0
- package/dist/internal/openspeech/openspeech.factory.js.map +1 -0
- package/dist/internal/openspeech/openspeech.module.d.ts +45 -0
- package/dist/internal/openspeech/openspeech.module.d.ts.map +1 -0
- package/dist/internal/openspeech/openspeech.module.js +68 -0
- package/dist/internal/openspeech/openspeech.module.js.map +1 -0
- package/dist/internal/openspeech/providers/aliyun.provider.d.ts +125 -0
- package/dist/internal/openspeech/providers/aliyun.provider.d.ts.map +1 -0
- package/dist/internal/openspeech/providers/aliyun.provider.js +274 -0
- package/dist/internal/openspeech/providers/aliyun.provider.js.map +1 -0
- package/dist/internal/openspeech/providers/base.provider.d.ts +98 -0
- package/dist/internal/openspeech/providers/base.provider.d.ts.map +1 -0
- package/dist/internal/openspeech/providers/base.provider.js +87 -0
- package/dist/internal/openspeech/providers/base.provider.js.map +1 -0
- package/dist/internal/openspeech/providers/index.d.ts +10 -0
- package/dist/internal/openspeech/providers/index.d.ts.map +1 -0
- package/dist/internal/openspeech/providers/index.js +26 -0
- package/dist/internal/openspeech/providers/index.js.map +1 -0
- package/dist/internal/openspeech/providers/volcengine-streaming.provider.d.ts +291 -0
- package/dist/internal/openspeech/providers/volcengine-streaming.provider.d.ts.map +1 -0
- package/dist/internal/openspeech/providers/volcengine-streaming.provider.js +1358 -0
- package/dist/internal/openspeech/providers/volcengine-streaming.provider.js.map +1 -0
- package/dist/internal/openspeech/providers/volcengine.provider.d.ts +144 -0
- package/dist/internal/openspeech/providers/volcengine.provider.d.ts.map +1 -0
- package/dist/internal/openspeech/providers/volcengine.provider.js +337 -0
- package/dist/internal/openspeech/providers/volcengine.provider.js.map +1 -0
- package/dist/internal/openspeech/types.d.ts +408 -0
- package/dist/internal/openspeech/types.d.ts.map +1 -0
- package/dist/internal/openspeech/types.js +11 -0
- package/dist/internal/openspeech/types.js.map +1 -0
- package/dist/internal/provider-verify/index.d.ts +6 -0
- package/dist/internal/provider-verify/index.d.ts.map +1 -0
- package/dist/internal/provider-verify/index.js +24 -0
- package/dist/internal/provider-verify/index.js.map +1 -0
- package/dist/internal/provider-verify/provider-verify.client.d.ts +55 -0
- package/dist/internal/provider-verify/provider-verify.client.d.ts.map +1 -0
- package/dist/internal/provider-verify/provider-verify.client.js +284 -0
- package/dist/internal/provider-verify/provider-verify.client.js.map +1 -0
- package/dist/internal/provider-verify/provider-verify.module.d.ts +3 -0
- package/dist/internal/provider-verify/provider-verify.module.d.ts.map +1 -0
- package/dist/internal/provider-verify/provider-verify.module.js +28 -0
- package/dist/internal/provider-verify/provider-verify.module.js.map +1 -0
- package/dist/internal/routing-llm/index.d.ts +7 -0
- package/dist/internal/routing-llm/index.d.ts.map +1 -0
- package/dist/internal/routing-llm/index.js +25 -0
- package/dist/internal/routing-llm/index.js.map +1 -0
- package/dist/internal/routing-llm/interfaces/routing-llm.interface.d.ts +88 -0
- package/dist/internal/routing-llm/interfaces/routing-llm.interface.d.ts.map +1 -0
- package/dist/internal/routing-llm/interfaces/routing-llm.interface.js +64 -0
- package/dist/internal/routing-llm/interfaces/routing-llm.interface.js.map +1 -0
- package/dist/internal/routing-llm/routing-llm.client.d.ts +32 -0
- package/dist/internal/routing-llm/routing-llm.client.d.ts.map +1 -0
- package/dist/internal/routing-llm/routing-llm.client.js +275 -0
- package/dist/internal/routing-llm/routing-llm.client.js.map +1 -0
- package/dist/internal/routing-llm/routing-llm.module.d.ts +3 -0
- package/dist/internal/routing-llm/routing-llm.module.d.ts.map +1 -0
- package/dist/internal/routing-llm/routing-llm.module.js +28 -0
- package/dist/internal/routing-llm/routing-llm.module.js.map +1 -0
- package/dist/internal/sms/dto/sms.dto.d.ts +156 -0
- package/dist/internal/sms/dto/sms.dto.d.ts.map +1 -0
- package/dist/internal/sms/dto/sms.dto.js +78 -0
- package/dist/internal/sms/dto/sms.dto.js.map +1 -0
- package/dist/internal/sms/index.d.ts +14 -0
- package/dist/internal/sms/index.d.ts.map +1 -0
- package/dist/internal/sms/index.js +37 -0
- package/dist/internal/sms/index.js.map +1 -0
- package/dist/internal/sms/sms-aliyun.client.d.ts +19 -0
- package/dist/internal/sms/sms-aliyun.client.d.ts.map +1 -0
- package/dist/internal/sms/sms-aliyun.client.js +74 -0
- package/dist/internal/sms/sms-aliyun.client.js.map +1 -0
- package/dist/internal/sms/sms-http.client.d.ts +21 -0
- package/dist/internal/sms/sms-http.client.d.ts.map +1 -0
- package/dist/internal/sms/sms-http.client.js +76 -0
- package/dist/internal/sms/sms-http.client.js.map +1 -0
- package/dist/internal/sms/sms-tencent.client.d.ts +18 -0
- package/dist/internal/sms/sms-tencent.client.d.ts.map +1 -0
- package/dist/internal/sms/sms-tencent.client.js +76 -0
- package/dist/internal/sms/sms-tencent.client.js.map +1 -0
- package/dist/internal/sms/sms-volcengine.client.d.ts +29 -0
- package/dist/internal/sms/sms-volcengine.client.d.ts.map +1 -0
- package/dist/internal/sms/sms-volcengine.client.js +124 -0
- package/dist/internal/sms/sms-volcengine.client.js.map +1 -0
- package/dist/internal/sms/sms-zxjc.client.d.ts +18 -0
- package/dist/internal/sms/sms-zxjc.client.d.ts.map +1 -0
- package/dist/internal/sms/sms-zxjc.client.js +40 -0
- package/dist/internal/sms/sms-zxjc.client.js.map +1 -0
- package/dist/internal/sse/index.d.ts +3 -0
- package/dist/internal/sse/index.d.ts.map +1 -0
- package/dist/internal/sse/index.js +19 -0
- package/dist/internal/sse/index.js.map +1 -0
- package/dist/internal/sse/sse-client.service.spec.d.ts +2 -0
- package/dist/internal/sse/sse-client.service.spec.d.ts.map +1 -0
- package/dist/internal/sse/sse-client.service.spec.js +17 -0
- package/dist/internal/sse/sse-client.service.spec.js.map +1 -0
- package/dist/internal/sse/sse.client.d.ts +63 -0
- package/dist/internal/sse/sse.client.d.ts.map +1 -0
- package/dist/internal/sse/sse.client.js +304 -0
- package/dist/internal/sse/sse.client.js.map +1 -0
- package/dist/internal/sse/sse.module.d.ts +3 -0
- package/dist/internal/sse/sse.module.d.ts.map +1 -0
- package/dist/internal/sse/sse.module.js +30 -0
- package/dist/internal/sse/sse.module.js.map +1 -0
- package/dist/internal/third-party-sse/index.d.ts +3 -0
- package/dist/internal/third-party-sse/index.d.ts.map +1 -0
- package/dist/internal/third-party-sse/index.js +19 -0
- package/dist/internal/third-party-sse/index.js.map +1 -0
- package/dist/internal/third-party-sse/third-party-sse.client.d.ts +14 -0
- package/dist/internal/third-party-sse/third-party-sse.client.d.ts.map +1 -0
- package/dist/internal/third-party-sse/third-party-sse.client.js +63 -0
- package/dist/internal/third-party-sse/third-party-sse.client.js.map +1 -0
- package/dist/internal/third-party-sse/third-party-sse.module.d.ts +3 -0
- package/dist/internal/third-party-sse/third-party-sse.module.d.ts.map +1 -0
- package/dist/internal/third-party-sse/third-party-sse.module.js +23 -0
- package/dist/internal/third-party-sse/third-party-sse.module.js.map +1 -0
- package/dist/internal/third-party-sse/third-party-sse.service.spec.d.ts +2 -0
- package/dist/internal/third-party-sse/third-party-sse.service.spec.d.ts.map +1 -0
- package/dist/internal/third-party-sse/third-party-sse.service.spec.js +17 -0
- package/dist/internal/third-party-sse/third-party-sse.service.spec.js.map +1 -0
- package/dist/internal/verify/index.d.ts +3 -0
- package/dist/internal/verify/index.d.ts.map +1 -0
- package/dist/internal/verify/index.js +19 -0
- package/dist/internal/verify/index.js.map +1 -0
- package/dist/internal/verify/verify.client.d.ts +12 -0
- package/dist/internal/verify/verify.client.d.ts.map +1 -0
- package/dist/internal/verify/verify.client.js +57 -0
- package/dist/internal/verify/verify.client.js.map +1 -0
- package/dist/internal/verify/verify.module.d.ts +3 -0
- package/dist/internal/verify/verify.module.d.ts.map +1 -0
- package/dist/internal/verify/verify.module.js +23 -0
- package/dist/internal/verify/verify.module.js.map +1 -0
- package/dist/internal/volcengine-tts/dto/tts.dto.d.ts +52 -0
- package/dist/internal/volcengine-tts/dto/tts.dto.d.ts.map +1 -0
- package/dist/internal/volcengine-tts/dto/tts.dto.js +59 -0
- package/dist/internal/volcengine-tts/dto/tts.dto.js.map +1 -0
- package/dist/internal/volcengine-tts/index.d.ts +4 -0
- package/dist/internal/volcengine-tts/index.d.ts.map +1 -0
- package/dist/internal/volcengine-tts/index.js +20 -0
- package/dist/internal/volcengine-tts/index.js.map +1 -0
- package/dist/internal/volcengine-tts/volcengine-tts.client.d.ts +104 -0
- package/dist/internal/volcengine-tts/volcengine-tts.client.d.ts.map +1 -0
- package/dist/internal/volcengine-tts/volcengine-tts.client.js +690 -0
- package/dist/internal/volcengine-tts/volcengine-tts.client.js.map +1 -0
- package/dist/internal/volcengine-tts/volcengine-tts.module.d.ts +3 -0
- package/dist/internal/volcengine-tts/volcengine-tts.module.d.ts.map +1 -0
- package/dist/internal/volcengine-tts/volcengine-tts.module.js +34 -0
- package/dist/internal/volcengine-tts/volcengine-tts.module.js.map +1 -0
- package/dist/internal/wechat/index.d.ts +3 -0
- package/dist/internal/wechat/index.d.ts.map +1 -0
- package/dist/internal/wechat/index.js +19 -0
- package/dist/internal/wechat/index.js.map +1 -0
- package/dist/internal/wechat/wechat-client.service.spec.d.ts +2 -0
- package/dist/internal/wechat/wechat-client.service.spec.d.ts.map +1 -0
- package/dist/internal/wechat/wechat-client.service.spec.js +17 -0
- package/dist/internal/wechat/wechat-client.service.spec.js.map +1 -0
- package/dist/internal/wechat/wechat.client.d.ts +3 -0
- package/dist/internal/wechat/wechat.client.d.ts.map +1 -0
- package/dist/internal/wechat/wechat.client.js +17 -0
- package/dist/internal/wechat/wechat.client.js.map +1 -0
- package/dist/internal/wechat/wechat.module.d.ts +3 -0
- package/dist/internal/wechat/wechat.module.d.ts.map +1 -0
- package/dist/internal/wechat/wechat.module.js +21 -0
- package/dist/internal/wechat/wechat.module.js.map +1 -0
- package/dist/plugin/decorators/inject-client.decorator.d.ts +40 -0
- package/dist/plugin/decorators/inject-client.decorator.d.ts.map +1 -0
- package/dist/plugin/decorators/inject-client.decorator.js +63 -0
- package/dist/plugin/decorators/inject-client.decorator.js.map +1 -0
- package/dist/plugin/index.d.ts +14 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +34 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/interceptors/http-logging.interceptor.d.ts +51 -0
- package/dist/plugin/interceptors/http-logging.interceptor.d.ts.map +1 -0
- package/dist/plugin/interceptors/http-logging.interceptor.js +84 -0
- package/dist/plugin/interceptors/http-logging.interceptor.js.map +1 -0
- package/dist/plugin/interfaces/client.interface.d.ts +80 -0
- package/dist/plugin/interfaces/client.interface.d.ts.map +1 -0
- package/dist/plugin/interfaces/client.interface.js +8 -0
- package/dist/plugin/interfaces/client.interface.js.map +1 -0
- package/dist/plugin/utils/retry.util.d.ts +49 -0
- package/dist/plugin/utils/retry.util.d.ts.map +1 -0
- package/dist/plugin/utils/retry.util.js +110 -0
- package/dist/plugin/utils/retry.util.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,690 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.VolcengineTtsClient = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const config_1 = require("@nestjs/config");
|
|
18
|
+
const axios_1 = require("@nestjs/axios");
|
|
19
|
+
const nest_winston_1 = require("nest-winston");
|
|
20
|
+
const winston_1 = require("winston");
|
|
21
|
+
const rxjs_1 = require("rxjs");
|
|
22
|
+
const tos_sdk_1 = require("@volcengine/tos-sdk");
|
|
23
|
+
const music_metadata_1 = require("music-metadata");
|
|
24
|
+
const openapi_1 = require("@volcengine/openapi");
|
|
25
|
+
const infra_common_1 = require("@dofe/infra-common");
|
|
26
|
+
const infra_common_2 = require("@dofe/infra-common");
|
|
27
|
+
const infra_shared_services_1 = require("@dofe/infra-shared-services");
|
|
28
|
+
const infra_utils_1 = require("@dofe/infra-utils");
|
|
29
|
+
/**
|
|
30
|
+
* Volcengine TTS服务
|
|
31
|
+
* 基于字节跳动TTS API实现语音合成功能
|
|
32
|
+
*/
|
|
33
|
+
const hotList = [
|
|
34
|
+
'ICL_zh_male_BV144_paoxiaoge_v1_tob',
|
|
35
|
+
'zh_male_sunwukong_mars_bigtts',
|
|
36
|
+
'zh_male_xionger_mars_bigtts',
|
|
37
|
+
'zh_male_zhubajie_mars_bigtts',
|
|
38
|
+
];
|
|
39
|
+
let VolcengineTtsClient = class VolcengineTtsClient {
|
|
40
|
+
configService;
|
|
41
|
+
httpService;
|
|
42
|
+
fileApi;
|
|
43
|
+
logger;
|
|
44
|
+
ttsConfig;
|
|
45
|
+
ttsUrl;
|
|
46
|
+
tosClient = null;
|
|
47
|
+
cloudUrl = '';
|
|
48
|
+
constructor(configService, httpService, fileApi, logger) {
|
|
49
|
+
this.configService = configService;
|
|
50
|
+
this.httpService = httpService;
|
|
51
|
+
this.fileApi = fileApi;
|
|
52
|
+
this.logger = logger;
|
|
53
|
+
const config = (0, infra_common_1.getKeysConfig)()?.tts;
|
|
54
|
+
// console.log('techwu config', config);
|
|
55
|
+
if (!config || !config.volcengine) {
|
|
56
|
+
throw new infra_common_2.FeatureNotConfiguredError('tts', 'keys.tts');
|
|
57
|
+
}
|
|
58
|
+
const volcengineConfig = config.volcengine;
|
|
59
|
+
const storageConfig = (0, infra_common_1.getKeysConfig)()?.storage?.tos;
|
|
60
|
+
// 从 buckets 配置中读取 TOS bucket 信息
|
|
61
|
+
const bucketConfigs = this.configService.getOrThrow('buckets');
|
|
62
|
+
const tosBucket = bucketConfigs.find((b) => b.vendor === 'tos' && b.bucket === volcengineConfig.bucket);
|
|
63
|
+
if (!tosBucket) {
|
|
64
|
+
throw new Error(`TOS bucket "${volcengineConfig.bucket}" not found in buckets configuration`);
|
|
65
|
+
}
|
|
66
|
+
if (!storageConfig ||
|
|
67
|
+
!storageConfig.accessKey ||
|
|
68
|
+
!storageConfig.secretKey) {
|
|
69
|
+
throw new Error('TOS storage credentials not found in keys/config.json');
|
|
70
|
+
}
|
|
71
|
+
// 构建 TOS 配置
|
|
72
|
+
const tosConfig = {
|
|
73
|
+
region: tosBucket.region || 'cn-shanghai',
|
|
74
|
+
endpoint: this.extractTosEndpoint(tosBucket.tosEndpoint || tosBucket.endpoint),
|
|
75
|
+
bucket: tosBucket.bucket,
|
|
76
|
+
accessKeyId: storageConfig.accessKey,
|
|
77
|
+
accessKeySecret: storageConfig.secretKey,
|
|
78
|
+
};
|
|
79
|
+
this.ttsConfig = {
|
|
80
|
+
endpoint: volcengineConfig.endpoint ||
|
|
81
|
+
'https://openspeech.bytedance.com/api/v3/tts/unidirectional',
|
|
82
|
+
apiKey: volcengineConfig.apiKey || '',
|
|
83
|
+
resourceId: volcengineConfig.resourceId || '',
|
|
84
|
+
region: volcengineConfig.region || 'cn-shanghai',
|
|
85
|
+
accessKey: volcengineConfig.accessKey || '',
|
|
86
|
+
secretKey: volcengineConfig.secretKey || '',
|
|
87
|
+
tos: tosConfig,
|
|
88
|
+
};
|
|
89
|
+
this.ttsUrl = this.ttsConfig.endpoint;
|
|
90
|
+
this.validateConfiguration();
|
|
91
|
+
this.initializeTOS();
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* 从 endpoint URL 中提取 TOS endpoint 域名
|
|
95
|
+
* 例如: https://tos-s3-cn-shanghai.volces.com -> tos-s3-cn-shanghai.volces.com
|
|
96
|
+
*/
|
|
97
|
+
extractTosEndpoint(endpointUrl) {
|
|
98
|
+
if (!endpointUrl) {
|
|
99
|
+
return 'tos-cn-shanghai.volces.com';
|
|
100
|
+
}
|
|
101
|
+
// 移除协议前缀
|
|
102
|
+
return endpointUrl.replace(/^https?:\/\//, '').replace(/\/$/, '');
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* 初始化火山云TOS客户端
|
|
106
|
+
*/
|
|
107
|
+
initializeTOS() {
|
|
108
|
+
if (!this.ttsConfig.tos) {
|
|
109
|
+
this.logger.warn('火山云TOS配置未提供,云存储功能将无法使用');
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
const { region, endpoint, bucket, accessKeyId, accessKeySecret } = this.ttsConfig.tos;
|
|
114
|
+
if (!accessKeyId || !accessKeySecret) {
|
|
115
|
+
this.logger.warn('火山云TOS配置不完整,云存储功能可能无法使用');
|
|
116
|
+
this.tosClient = null;
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
this.cloudUrl = `https://${bucket}.${endpoint}`;
|
|
120
|
+
this.tosClient = new tos_sdk_1.TosClient({
|
|
121
|
+
region,
|
|
122
|
+
endpoint,
|
|
123
|
+
accessKeyId,
|
|
124
|
+
accessKeySecret,
|
|
125
|
+
});
|
|
126
|
+
if (infra_utils_1.environmentUtil.isProduction()) {
|
|
127
|
+
this.logger.info('VolcengineTtsClient module initialized TOS client', {
|
|
128
|
+
region,
|
|
129
|
+
endpoint,
|
|
130
|
+
bucket,
|
|
131
|
+
accessKeyId,
|
|
132
|
+
accessKeySecret,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
this.logger.debug('VolcengineTtsClient module initialized TOS client', {
|
|
137
|
+
region,
|
|
138
|
+
endpoint,
|
|
139
|
+
bucket,
|
|
140
|
+
accessKeyId,
|
|
141
|
+
accessKeySecret,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
this.logger.error(`火山云TOS客户端初始化失败: ${error.message}`);
|
|
147
|
+
this.tosClient = null;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* 验证配置信息
|
|
152
|
+
*/
|
|
153
|
+
validateConfiguration() {
|
|
154
|
+
const missingVars = [];
|
|
155
|
+
if (!this.ttsConfig.apiKey) {
|
|
156
|
+
missingVars.push('apiKey');
|
|
157
|
+
}
|
|
158
|
+
if (!this.ttsConfig.resourceId) {
|
|
159
|
+
missingVars.push('resourceId');
|
|
160
|
+
}
|
|
161
|
+
if (missingVars.length > 0) {
|
|
162
|
+
this.logger.warn(`缺少TTS配置项: ${missingVars.join(', ')}`);
|
|
163
|
+
this.logger.warn('TTS服务可能无法正常工作,请检查配置文件');
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
if (infra_utils_1.environmentUtil.isProduction()) {
|
|
167
|
+
this.logger.info('TTS configuration validated successfully');
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* 安全解析JSON数据
|
|
173
|
+
*/
|
|
174
|
+
safeJsonParse(jsonString) {
|
|
175
|
+
try {
|
|
176
|
+
return JSON.parse(jsonString);
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
this.logger.debug(`JSON解析失败: ${error.message}, 数据: ${jsonString.substring(0, 50)}...`);
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* 获取音频时长(毫秒)
|
|
185
|
+
*/
|
|
186
|
+
async getAudioDuration(audioData) {
|
|
187
|
+
try {
|
|
188
|
+
const metadata = await (0, music_metadata_1.parseBuffer)(audioData, {
|
|
189
|
+
mimeType: 'audio/mpeg',
|
|
190
|
+
});
|
|
191
|
+
return (metadata.format.duration || 0) * 1000; // 转换为毫秒
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
this.logger.warn(`获取音频时长失败: ${error.message}`);
|
|
195
|
+
return 0;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* 直接上传音频数据到火山云TOS
|
|
200
|
+
*/
|
|
201
|
+
async uploadAudioToCloud(audioData, fileName) {
|
|
202
|
+
try {
|
|
203
|
+
this.logger.info(`开始上传音频数据到火山云TOS: ${fileName}`);
|
|
204
|
+
if (!this.tosClient || !this.ttsConfig.tos) {
|
|
205
|
+
throw new Error('火山云TOS客户端未初始化');
|
|
206
|
+
}
|
|
207
|
+
// 生成TOS对象键
|
|
208
|
+
const objectKey = `tts/${Date.now()}/${fileName}`;
|
|
209
|
+
// 上传到火山云TOS
|
|
210
|
+
await this.tosClient.putObject({
|
|
211
|
+
bucket: this.ttsConfig.tos.bucket,
|
|
212
|
+
key: objectKey,
|
|
213
|
+
body: audioData,
|
|
214
|
+
contentType: 'audio/mpeg',
|
|
215
|
+
});
|
|
216
|
+
return {
|
|
217
|
+
success: true,
|
|
218
|
+
cloudUrl: `${this.cloudUrl}/${objectKey}`,
|
|
219
|
+
s3Uri: `tos://${this.ttsConfig.tos.bucket}/${objectKey}`,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
this.logger.error(`上传音频数据到火山云TOS失败: ${error.message}`);
|
|
224
|
+
return {
|
|
225
|
+
success: false,
|
|
226
|
+
error: error.message,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* 语音合成主方法
|
|
232
|
+
*/
|
|
233
|
+
async textToSpeech(request) {
|
|
234
|
+
try {
|
|
235
|
+
// 构建请求头
|
|
236
|
+
const headers = this.buildHeaders();
|
|
237
|
+
// 构建请求体
|
|
238
|
+
const payload = {
|
|
239
|
+
req_params: {
|
|
240
|
+
text: request.text,
|
|
241
|
+
model: 'seed-tts-1.1',
|
|
242
|
+
speaker: request.speaker ||
|
|
243
|
+
(await this.getRandomVoice('🔥热门推荐')).voice.id ||
|
|
244
|
+
'zh_male_beijingxiaoye_emo_v2_mars_bigtts',
|
|
245
|
+
additions: JSON.stringify({
|
|
246
|
+
disable_markdown_filter: true,
|
|
247
|
+
enable_language_detector: true,
|
|
248
|
+
enable_latex_tn: true,
|
|
249
|
+
disable_default_bit_rate: true,
|
|
250
|
+
max_length_to_filter_parenthesis: 0,
|
|
251
|
+
cache_config: {
|
|
252
|
+
text_type: 1,
|
|
253
|
+
use_cache: true,
|
|
254
|
+
},
|
|
255
|
+
post_process: {
|
|
256
|
+
pitch: request.pitch || 0,
|
|
257
|
+
},
|
|
258
|
+
}),
|
|
259
|
+
audio_params: {
|
|
260
|
+
format: 'mp3',
|
|
261
|
+
sample_rate: 32000,
|
|
262
|
+
speech_rate: request.speech_rate || 0,
|
|
263
|
+
loudness_rate: request.loudness_rate || 0,
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
};
|
|
267
|
+
// 执行TTS请求
|
|
268
|
+
const result = await this.executeTtsRequest(headers, payload);
|
|
269
|
+
this.logger.info(`TTS合成完成,云存储URL: ${result.audio}`);
|
|
270
|
+
return { ...result, text: request.text };
|
|
271
|
+
}
|
|
272
|
+
catch (error) {
|
|
273
|
+
this.logger.error(`TTS合成失败: ${error.message}`, error.stack);
|
|
274
|
+
return {
|
|
275
|
+
success: false,
|
|
276
|
+
error: error.message,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* 构建请求头
|
|
282
|
+
*/
|
|
283
|
+
buildHeaders() {
|
|
284
|
+
return {
|
|
285
|
+
'x-api-key': this.ttsConfig.apiKey,
|
|
286
|
+
'X-Api-Resource-Id': this.ttsConfig.resourceId,
|
|
287
|
+
Connection: 'keep-alive',
|
|
288
|
+
'Content-Type': 'application/json',
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* 执行TTS请求
|
|
293
|
+
*/
|
|
294
|
+
async executeTtsRequest(headers, payload) {
|
|
295
|
+
try {
|
|
296
|
+
this.logger.info('发送TTS请求到字节跳动API');
|
|
297
|
+
const response = await (0, rxjs_1.firstValueFrom)(this.httpService.post(this.ttsUrl, payload, {
|
|
298
|
+
headers,
|
|
299
|
+
responseType: 'stream',
|
|
300
|
+
}));
|
|
301
|
+
// 获取日志ID
|
|
302
|
+
const logId = response.headers['x-tt-logid'];
|
|
303
|
+
this.logger.info(`请求日志ID: ${logId}`);
|
|
304
|
+
// 处理流式响应
|
|
305
|
+
return await this.processStreamResponse(response.data, logId);
|
|
306
|
+
}
|
|
307
|
+
catch (error) {
|
|
308
|
+
this.logger.error(`TTS API请求失败: ${error.message}`);
|
|
309
|
+
if (error.response) {
|
|
310
|
+
this.logger.error('响应状态:', error.response.status);
|
|
311
|
+
this.logger.error('响应头:', error.response.headers);
|
|
312
|
+
this.logger.error('响应数据:', error.response.data);
|
|
313
|
+
}
|
|
314
|
+
throw new common_1.BadGatewayException(`TTS API请求失败: ${error.message}`);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* 处理流式响应
|
|
319
|
+
*/
|
|
320
|
+
async processStreamResponse(stream, logId) {
|
|
321
|
+
return new Promise((resolve, reject) => {
|
|
322
|
+
let audioData = Buffer.alloc(0);
|
|
323
|
+
let totalAudioSize = 0;
|
|
324
|
+
let hasError = false;
|
|
325
|
+
let errorMessage = '';
|
|
326
|
+
let buffer = ''; // 用于缓存不完整的数据
|
|
327
|
+
stream.on('data', (chunk) => {
|
|
328
|
+
try {
|
|
329
|
+
// 将新数据添加到缓冲区
|
|
330
|
+
buffer += chunk.toString();
|
|
331
|
+
// 按行分割数据
|
|
332
|
+
const lines = buffer.split('\n');
|
|
333
|
+
// 保留最后一个可能不完整的行
|
|
334
|
+
buffer = lines.pop() || '';
|
|
335
|
+
for (const line of lines) {
|
|
336
|
+
if (!line.trim())
|
|
337
|
+
continue;
|
|
338
|
+
const data = this.safeJsonParse(line);
|
|
339
|
+
if (!data) {
|
|
340
|
+
continue;
|
|
341
|
+
}
|
|
342
|
+
// 处理音频数据
|
|
343
|
+
if (data.code === 0 && data.data) {
|
|
344
|
+
const audioChunk = Buffer.from(data.data, 'base64');
|
|
345
|
+
audioData = Buffer.concat([audioData, audioChunk]);
|
|
346
|
+
totalAudioSize += audioChunk.length;
|
|
347
|
+
continue;
|
|
348
|
+
}
|
|
349
|
+
// 处理句子信息
|
|
350
|
+
if (data.code === 0 && data.sentence) {
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
353
|
+
// 处理完成信号
|
|
354
|
+
if (data.code === 20000000) {
|
|
355
|
+
this.logger.info('TTS合成完成');
|
|
356
|
+
break;
|
|
357
|
+
}
|
|
358
|
+
// 处理错误
|
|
359
|
+
if (data.code > 0) {
|
|
360
|
+
hasError = true;
|
|
361
|
+
errorMessage = data.message || `错误码: ${data.code}`;
|
|
362
|
+
this.logger.error(`TTS API错误: ${errorMessage}`);
|
|
363
|
+
break;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
catch (parseError) {
|
|
368
|
+
this.logger.error(`解析响应数据失败: ${parseError.message}`);
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
stream.on('end', async () => {
|
|
372
|
+
this.logger.info(`流式响应结束,总音频大小: ${totalAudioSize} bytes`);
|
|
373
|
+
// 处理缓冲区中剩余的数据
|
|
374
|
+
if (buffer.trim()) {
|
|
375
|
+
this.logger.debug(`处理缓冲区剩余数据: ${buffer.substring(0, 100)}...`);
|
|
376
|
+
const data = this.safeJsonParse(buffer);
|
|
377
|
+
if (data) {
|
|
378
|
+
// 处理音频数据
|
|
379
|
+
if (data.code === 0 && data.data) {
|
|
380
|
+
const audioChunk = Buffer.from(data.data, 'base64');
|
|
381
|
+
audioData = Buffer.concat([audioData, audioChunk]);
|
|
382
|
+
totalAudioSize += audioChunk.length;
|
|
383
|
+
this.logger.debug(`收到缓冲区音频数据块,大小: ${audioChunk.length} bytes`);
|
|
384
|
+
}
|
|
385
|
+
// 处理完成信号
|
|
386
|
+
if (data.code === 20000000) {
|
|
387
|
+
this.logger.info('TTS合成完成(缓冲区)');
|
|
388
|
+
}
|
|
389
|
+
// 处理错误
|
|
390
|
+
if (data.code > 0) {
|
|
391
|
+
hasError = true;
|
|
392
|
+
errorMessage = data.message || `错误码: ${data.code}`;
|
|
393
|
+
this.logger.error(`TTS API错误(缓冲区): ${errorMessage}`);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
if (hasError) {
|
|
398
|
+
this.logger.error(`TTS处理过程中发生错误: ${errorMessage}`);
|
|
399
|
+
resolve({
|
|
400
|
+
success: false,
|
|
401
|
+
error: errorMessage,
|
|
402
|
+
});
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
if (audioData.length === 0) {
|
|
406
|
+
this.logger.warn('未收到任何音频数据');
|
|
407
|
+
resolve({
|
|
408
|
+
success: false,
|
|
409
|
+
error: '未收到音频数据',
|
|
410
|
+
});
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
this.logger.info(`准备上传音频数据到云存储,大小: ${audioData.length} bytes`);
|
|
414
|
+
// 生成文件名
|
|
415
|
+
const fileName = `tts_${Date.now()}_${logId || 'unknown'}.mp3`;
|
|
416
|
+
const audioDuration = await this.getAudioDuration(audioData);
|
|
417
|
+
// 直接上传到云存储
|
|
418
|
+
this.uploadAudioToCloud(audioData, fileName)
|
|
419
|
+
.then((cloudResult) => {
|
|
420
|
+
if (cloudResult.success) {
|
|
421
|
+
this.logger.info('音频数据上传到云存储成功');
|
|
422
|
+
resolve({
|
|
423
|
+
success: true,
|
|
424
|
+
audio: cloudResult.cloudUrl,
|
|
425
|
+
duration: audioDuration,
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
else {
|
|
429
|
+
this.logger.error(`云存储上传失败: ${cloudResult.error}`);
|
|
430
|
+
resolve({
|
|
431
|
+
success: false,
|
|
432
|
+
error: cloudResult.error,
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
})
|
|
436
|
+
.catch((error) => {
|
|
437
|
+
this.logger.error(`云存储上传异常: ${error.message}`);
|
|
438
|
+
resolve({
|
|
439
|
+
success: false,
|
|
440
|
+
error: error.message,
|
|
441
|
+
});
|
|
442
|
+
});
|
|
443
|
+
});
|
|
444
|
+
stream.on('error', (error) => {
|
|
445
|
+
this.logger.error(`流处理错误: ${error.message}`);
|
|
446
|
+
reject(error);
|
|
447
|
+
});
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* 获取音色列表
|
|
452
|
+
*/
|
|
453
|
+
async getVoiceList() {
|
|
454
|
+
const result = await this.voiceList();
|
|
455
|
+
// 统计总的声音数量
|
|
456
|
+
let totalVoices = 0;
|
|
457
|
+
const voiceIds = new Set();
|
|
458
|
+
result.forEach((category) => {
|
|
459
|
+
category.groups.forEach((group) => {
|
|
460
|
+
// 统计声音ID
|
|
461
|
+
group.items.forEach((item) => {
|
|
462
|
+
voiceIds.add(item.id);
|
|
463
|
+
totalVoices++;
|
|
464
|
+
});
|
|
465
|
+
});
|
|
466
|
+
});
|
|
467
|
+
return result;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* 随机获取一个音色
|
|
471
|
+
*/
|
|
472
|
+
async getRandomVoice(category, gender) {
|
|
473
|
+
const voiceData = await this.voiceList();
|
|
474
|
+
// 如果指定了分类,先过滤出该分类的数据
|
|
475
|
+
let filteredData = voiceData;
|
|
476
|
+
if (category) {
|
|
477
|
+
filteredData = voiceData.filter((item) => item.Category === category);
|
|
478
|
+
if (filteredData.length === 0) {
|
|
479
|
+
throw new Error(`未找到分类 "${category}" 的音色数据`);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
// 收集所有可用的音色
|
|
483
|
+
const allVoices = [];
|
|
484
|
+
filteredData.forEach((categoryItem) => {
|
|
485
|
+
categoryItem.groups.forEach((group) => {
|
|
486
|
+
// 如果指定了性别,只收集该性别的音色
|
|
487
|
+
if (gender && group.gender_type !== gender) {
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
allVoices.push({
|
|
491
|
+
...group,
|
|
492
|
+
category: categoryItem.Category,
|
|
493
|
+
});
|
|
494
|
+
});
|
|
495
|
+
});
|
|
496
|
+
if (allVoices.length === 0) {
|
|
497
|
+
throw new Error('没有可用的音色数据');
|
|
498
|
+
}
|
|
499
|
+
// 随机选择一个性别分组
|
|
500
|
+
const randomGroup = allVoices[Math.floor(Math.random() * allVoices.length)];
|
|
501
|
+
// 从该分组中随机选择一个音色
|
|
502
|
+
const randomVoice = randomGroup.items[Math.floor(Math.random() * randomGroup.items.length)];
|
|
503
|
+
return {
|
|
504
|
+
category: randomGroup.category,
|
|
505
|
+
gender_title: randomGroup.gender_title,
|
|
506
|
+
gender_type: randomGroup.gender_type,
|
|
507
|
+
voice: randomVoice,
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* 获取音色列表(原始数据)
|
|
512
|
+
*/
|
|
513
|
+
async voiceList() {
|
|
514
|
+
const list = await this.volcengineApi({
|
|
515
|
+
params: {
|
|
516
|
+
Action: 'ListBigModelTTSTimbres',
|
|
517
|
+
Version: '2025-05-20',
|
|
518
|
+
},
|
|
519
|
+
body: {},
|
|
520
|
+
method: 'POST',
|
|
521
|
+
Service: 'speech_saas_prod',
|
|
522
|
+
}).then((res) => {
|
|
523
|
+
return res.Result?.Timbres ?? [];
|
|
524
|
+
});
|
|
525
|
+
// 用于存储按分类和性别分组的数据
|
|
526
|
+
const categoryMap = new Map();
|
|
527
|
+
// 遍历所有声音数据
|
|
528
|
+
list.forEach((speaker) => {
|
|
529
|
+
const speakerId = speaker.SpeakerID;
|
|
530
|
+
speaker.TimbreInfos.forEach((timbre) => {
|
|
531
|
+
const gender = timbre.Gender;
|
|
532
|
+
const speakerName = timbre.SpeakerName;
|
|
533
|
+
// 检查是否包含"多语种"分类,如果有则跳过整个声音
|
|
534
|
+
const hasMultiLanguage = timbre.Categories.some((categoryInfo) => categoryInfo.Category === '多语种');
|
|
535
|
+
if (hasMultiLanguage) {
|
|
536
|
+
return; // 跳过包含"多语种"分类的声音
|
|
537
|
+
}
|
|
538
|
+
// 遍历每个声音的分类
|
|
539
|
+
timbre.Categories.forEach((categoryInfo) => {
|
|
540
|
+
const category = categoryInfo.Category;
|
|
541
|
+
// 如果分类不存在,创建新的分类,并初始化男女两个性别分组
|
|
542
|
+
if (!categoryMap.has(category)) {
|
|
543
|
+
categoryMap.set(category, {
|
|
544
|
+
Category: category,
|
|
545
|
+
groups: [
|
|
546
|
+
{
|
|
547
|
+
gender_title: '女声',
|
|
548
|
+
gender_type: 'female',
|
|
549
|
+
items: [],
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
gender_title: '男声',
|
|
553
|
+
gender_type: 'male',
|
|
554
|
+
items: [],
|
|
555
|
+
},
|
|
556
|
+
],
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
const categoryData = categoryMap.get(category);
|
|
560
|
+
// 根据性别找到对应的分组
|
|
561
|
+
const genderGroup = categoryData.groups.find((group) => (gender === '女' && group.gender_type === 'female') ||
|
|
562
|
+
(gender === '男' && group.gender_type === 'male'));
|
|
563
|
+
if (genderGroup) {
|
|
564
|
+
// 遍历情感信息,获取演示URL
|
|
565
|
+
timbre.Emotions.forEach((emotion) => {
|
|
566
|
+
// 检查是否已存在相同的声音项(避免重复)
|
|
567
|
+
const existingItem = genderGroup.items.find((item) => item.id === speakerId && item.voice_url === emotion.DemoURL);
|
|
568
|
+
if (!existingItem) {
|
|
569
|
+
genderGroup.items.push({
|
|
570
|
+
id: speakerId,
|
|
571
|
+
name: speakerName,
|
|
572
|
+
voice_url: emotion.DemoURL,
|
|
573
|
+
emotion: emotion.Emotion,
|
|
574
|
+
emotion_type: emotion.EmotionType,
|
|
575
|
+
demo_text: emotion.DemoText,
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
});
|
|
582
|
+
});
|
|
583
|
+
// 转换为数组格式
|
|
584
|
+
const result = Array.from(categoryMap.values());
|
|
585
|
+
// 创建热门分组
|
|
586
|
+
const hotGroup = this.createHotGroup(list);
|
|
587
|
+
// 将热门分组添加到结果数组的开头
|
|
588
|
+
return [hotGroup, ...result];
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* 创建热门分组
|
|
592
|
+
*/
|
|
593
|
+
createHotGroup(list) {
|
|
594
|
+
const hotItems = [];
|
|
595
|
+
// 遍历所有声音数据,筛选出热门音色
|
|
596
|
+
list.forEach((speaker) => {
|
|
597
|
+
const speakerId = speaker.SpeakerID;
|
|
598
|
+
speaker.TimbreInfos.forEach((timbre) => {
|
|
599
|
+
const gender = timbre.Gender;
|
|
600
|
+
const speakerName = timbre.SpeakerName;
|
|
601
|
+
// 检查是否包含"多语种"分类,如果有则跳过
|
|
602
|
+
const hasMultiLanguage = timbre.Categories.some((categoryInfo) => categoryInfo.Category === '多语种');
|
|
603
|
+
if (hasMultiLanguage) {
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
// 检查是否在热门列表中
|
|
607
|
+
const isHot = hotList.includes(speakerId);
|
|
608
|
+
if (!isHot) {
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
// 遍历情感信息,获取演示URL
|
|
612
|
+
timbre.Emotions.forEach((emotion) => {
|
|
613
|
+
// 检查是否已存在相同的声音项(避免重复)
|
|
614
|
+
const existingItem = hotItems.find((item) => item.id === speakerId && item.voice_url === emotion.DemoURL);
|
|
615
|
+
if (!existingItem) {
|
|
616
|
+
hotItems.push({
|
|
617
|
+
id: speakerId,
|
|
618
|
+
name: speakerName,
|
|
619
|
+
voice_url: emotion.DemoURL,
|
|
620
|
+
emotion: emotion.Emotion,
|
|
621
|
+
emotion_type: emotion.EmotionType,
|
|
622
|
+
demo_text: emotion.DemoText,
|
|
623
|
+
gender: gender === '女' ? 'female' : 'male',
|
|
624
|
+
gender_title: gender === '女' ? '女声' : '男声',
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
});
|
|
629
|
+
});
|
|
630
|
+
// 按照 hotList 的顺序排序热门音色
|
|
631
|
+
const sortedHotItems = hotItems.sort((a, b) => {
|
|
632
|
+
const indexA = hotList.indexOf(a.id);
|
|
633
|
+
const indexB = hotList.indexOf(b.id);
|
|
634
|
+
return indexA - indexB;
|
|
635
|
+
});
|
|
636
|
+
return {
|
|
637
|
+
Category: '🔥热门推荐',
|
|
638
|
+
groups: [
|
|
639
|
+
{
|
|
640
|
+
gender_title: '热门音色',
|
|
641
|
+
gender_type: 'hot',
|
|
642
|
+
items: sortedHotItems,
|
|
643
|
+
},
|
|
644
|
+
],
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* 调用火山引擎 API
|
|
649
|
+
*/
|
|
650
|
+
async volcengineApi({ body = {}, params, method = 'POST', Service, }) {
|
|
651
|
+
const baseUrl = 'https://open.volcengineapi.com';
|
|
652
|
+
const openApiRequestData = {
|
|
653
|
+
region: this.ttsConfig.region,
|
|
654
|
+
method,
|
|
655
|
+
params: params,
|
|
656
|
+
headers: {},
|
|
657
|
+
body: JSON.stringify(body),
|
|
658
|
+
};
|
|
659
|
+
const signer = new openapi_1.Signer(openApiRequestData, Service);
|
|
660
|
+
// 签名
|
|
661
|
+
signer.addAuthorization({
|
|
662
|
+
accessKeyId: this.ttsConfig.accessKey,
|
|
663
|
+
secretKey: this.ttsConfig.secretKey,
|
|
664
|
+
});
|
|
665
|
+
try {
|
|
666
|
+
const response = await (0, rxjs_1.firstValueFrom)(this.httpService.request({
|
|
667
|
+
url: baseUrl,
|
|
668
|
+
headers: openApiRequestData.headers,
|
|
669
|
+
params: openApiRequestData.params,
|
|
670
|
+
method: openApiRequestData.method,
|
|
671
|
+
data: body,
|
|
672
|
+
}));
|
|
673
|
+
return response.data;
|
|
674
|
+
}
|
|
675
|
+
catch (error) {
|
|
676
|
+
this.logger.error(`火山引擎API调用失败: ${error.message}`);
|
|
677
|
+
return undefined;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
};
|
|
681
|
+
exports.VolcengineTtsClient = VolcengineTtsClient;
|
|
682
|
+
exports.VolcengineTtsClient = VolcengineTtsClient = __decorate([
|
|
683
|
+
(0, common_1.Injectable)(),
|
|
684
|
+
__param(3, (0, common_1.Inject)(nest_winston_1.WINSTON_MODULE_PROVIDER)),
|
|
685
|
+
__metadata("design:paramtypes", [config_1.ConfigService,
|
|
686
|
+
axios_1.HttpService,
|
|
687
|
+
infra_shared_services_1.FileStorageService,
|
|
688
|
+
winston_1.Logger])
|
|
689
|
+
], VolcengineTtsClient);
|
|
690
|
+
//# sourceMappingURL=volcengine-tts.client.js.map
|