feat: improve API key validation and enhance error handling in TTS service

This commit is contained in:
王锦强
2025-03-11 21:35:37 +08:00
parent 3356e267db
commit 7958e56bdf
3 changed files with 241 additions and 141 deletions

View File

@@ -95,7 +95,7 @@ func (c *Client) getEndpoint(ctx context.Context) (map[string]interface{}, error
// 更新缓存
c.endpointMu.Lock()
c.endpoint = endpoint
c.endpointExpiry = time.Now().Add(30 * time.Minute) // 令牌有效期通常是1小时提前刷新
c.endpointExpiry = time.Now().Add(5 * time.Minute)
c.endpointMu.Unlock()
return endpoint, nil