feat: add logging for voice list retrieval from cache and fix loading option text
This commit is contained in:
@@ -117,6 +117,8 @@ func (c *Client) ListVoices(ctx context.Context, locale string) ([]models.Voice,
|
|||||||
// 检查缓存是否有效
|
// 检查缓存是否有效
|
||||||
c.voicesCacheMu.RLock()
|
c.voicesCacheMu.RLock()
|
||||||
if !c.voicesCacheExpiry.IsZero() && time.Now().Before(c.voicesCacheExpiry) && len(c.voicesCache) > 0 {
|
if !c.voicesCacheExpiry.IsZero() && time.Now().Before(c.voicesCacheExpiry) && len(c.voicesCache) > 0 {
|
||||||
|
// 从缓存中获取
|
||||||
|
log.Println("ListVoices 从缓存中获取语音列表: ", len(c.voicesCache), "个", "剩余时间:", c.voicesCacheExpiry.Sub(time.Now()))
|
||||||
voices := c.voicesCache
|
voices := c.voicesCache
|
||||||
c.voicesCacheMu.RUnlock()
|
c.voicesCacheMu.RUnlock()
|
||||||
|
|
||||||
@@ -135,6 +137,7 @@ func (c *Client) ListVoices(ctx context.Context, locale string) ([]models.Voice,
|
|||||||
c.voicesCacheMu.RUnlock()
|
c.voicesCacheMu.RUnlock()
|
||||||
|
|
||||||
// 缓存无效,需要从API获取
|
// 缓存无效,需要从API获取
|
||||||
|
log.Println("ListVoices, 缓存未命中,从API获取语音列表")
|
||||||
endpoint, err := c.getEndpoint(ctx)
|
endpoint, err := c.getEndpoint(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -947,7 +947,7 @@
|
|||||||
<label for="style" class="mb-1 font-semibold text-slate-700">风格:</label>
|
<label for="style" class="mb-1 font-semibold text-slate-700">风格:</label>
|
||||||
<select id="style"
|
<select id="style"
|
||||||
class="p-2 border border-slate-300 rounded-md bg-white/90 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition">
|
class="p-2 border border-slate-300 rounded-md bg-white/90 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition">
|
||||||
<option value="loading">加载<EFBFBD><EFBFBD><EFBFBD>...</option>
|
<option value="loading">加载中...</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user