feat: 支持多模型提供商 embedding

This commit is contained in:
2026-04-01 13:38:33 +08:00
parent bcbe6eba78
commit 2e4a0a89f1
9 changed files with 631 additions and 447 deletions

View File

@@ -1081,7 +1081,7 @@ func syncCircuitBreakerStateToDistributed(ctx context.Context, resourceName, sta
}
// 使用common/redis中的Lock方法获取分布式锁
success, err := redis.Lock(ctx, lockKey, lockTimeout, func(ctx context.Context) error {
success, err := utils.Lock(ctx, lockKey, lockTimeout, func(ctx context.Context) error {
// 设置熔断器状态
_, err := redisClient.Do(ctx, "SETEX", stateKey, ttl, state)
if err != nil {
@@ -1335,7 +1335,7 @@ func resetSingleResource(r *ghttp.Request, resourceName string) error {
if redisClient != nil {
lockKey := "circuit_breaker:" + resourceName + ":lock"
// 使用较短的锁超时时间
success, err := redis.Lock(r.GetCtx(), lockKey, int64(3), func(ctx context.Context) error {
success, err := utils.Lock(r.GetCtx(), lockKey, int64(3), func(ctx context.Context) error {
_, err := redisClient.Del(ctx, "circuit_breaker:"+resourceName+":state")
if err != nil {
g.Log().Warningf(ctx, "清除分布式熔断状态失败: %s, error: %v", resourceName, err)