feat: spaces redesign, model selector, auth fixes
Spaces: - Perplexity-like UI with collaboration features - Space detail page with threads/members tabs - Invite members via email, role management - New space creation with icon/color picker Model selector: - Added Ollama client for free Auto model - GooSeek 1.0 via Timeweb (tariff-based) - Frontend model dropdown in ChatInput Auth & Infrastructure: - Fixed auth-svc missing from Dockerfile.all - Removed duplicate ratelimit_tiered.go (conflict) - Added Redis to api-gateway for rate limiting - Fixed Next.js proxy for local development UI improvements: - Redesigned login button in sidebar (gradient) - Settings page with tabs (account/billing/prefs) - Auth pages visual refresh Made-with: Cursor
This commit is contained in:
@@ -144,6 +144,7 @@ type TieredRateLimitConfig struct {
|
||||
RedisClient *redis.Client
|
||||
KeyPrefix string
|
||||
Tiers map[string]TierConfig
|
||||
DefaultTier string
|
||||
GetTierFunc func(*fiber.Ctx) string
|
||||
KeyFunc func(*fiber.Ctx) string
|
||||
}
|
||||
@@ -157,16 +158,31 @@ func TieredRateLimit(cfg TieredRateLimitConfig) fiber.Handler {
|
||||
if cfg.KeyPrefix == "" {
|
||||
cfg.KeyPrefix = "ratelimit:tiered"
|
||||
}
|
||||
if cfg.DefaultTier == "" {
|
||||
cfg.DefaultTier = "free"
|
||||
}
|
||||
if cfg.GetTierFunc == nil {
|
||||
cfg.GetTierFunc = func(c *fiber.Ctx) string { return "default" }
|
||||
cfg.GetTierFunc = func(c *fiber.Ctx) string {
|
||||
tier := GetUserTier(c)
|
||||
if tier == "" {
|
||||
return cfg.DefaultTier
|
||||
}
|
||||
return tier
|
||||
}
|
||||
}
|
||||
if cfg.KeyFunc == nil {
|
||||
cfg.KeyFunc = func(c *fiber.Ctx) string { return c.IP() }
|
||||
cfg.KeyFunc = func(c *fiber.Ctx) string {
|
||||
userID := GetUserID(c)
|
||||
if userID != "" {
|
||||
return "user:" + userID
|
||||
}
|
||||
return "ip:" + c.IP()
|
||||
}
|
||||
}
|
||||
|
||||
defaultTier := TierConfig{Max: 60, Window: time.Minute}
|
||||
if _, ok := cfg.Tiers["default"]; !ok {
|
||||
cfg.Tiers["default"] = defaultTier
|
||||
defaultTierCfg := TierConfig{Max: 60, Window: time.Minute}
|
||||
if _, ok := cfg.Tiers[cfg.DefaultTier]; !ok {
|
||||
cfg.Tiers[cfg.DefaultTier] = defaultTierCfg
|
||||
}
|
||||
|
||||
return func(c *fiber.Ctx) error {
|
||||
@@ -174,7 +190,7 @@ func TieredRateLimit(cfg TieredRateLimitConfig) fiber.Handler {
|
||||
tier := cfg.GetTierFunc(c)
|
||||
tierCfg, ok := cfg.Tiers[tier]
|
||||
if !ok {
|
||||
tierCfg = cfg.Tiers["default"]
|
||||
tierCfg = cfg.Tiers[cfg.DefaultTier]
|
||||
}
|
||||
|
||||
key := fmt.Sprintf("%s:%s:%s", cfg.KeyPrefix, tier, cfg.KeyFunc(c))
|
||||
|
||||
Reference in New Issue
Block a user