mirror of
http://88.130.71.182:3000/BlitTech/contexta_be.git
synced 2026-06-12 23:23:21 +00:00
128 lines
3.4 KiB
Python
128 lines
3.4 KiB
Python
from pydantic_settings import BaseSettings
|
|
from typing import Optional, List
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
# App
|
|
app_env: str = "development"
|
|
app_secret_key: str = "dev-secret-key"
|
|
allowed_origins: str = "http://localhost:5173,http://localhost:3000"
|
|
|
|
# Supabase
|
|
supabase_url: str = ""
|
|
supabase_anon_key: str = ""
|
|
supabase_service_role_key: str = ""
|
|
|
|
# Qdrant
|
|
qdrant_url: str = "http://localhost:6333"
|
|
qdrant_api_key: Optional[str] = None
|
|
|
|
# LLM Providers
|
|
openai_api_key: Optional[str] = None
|
|
anthropic_api_key: Optional[str] = None
|
|
google_api_key: Optional[str] = None
|
|
fireworks_api_key: Optional[str] = None
|
|
|
|
# Embeddings
|
|
embedding_model: str = "text-embedding-3-small"
|
|
|
|
# Stripe
|
|
stripe_secret_key: str = ""
|
|
stripe_webhook_secret: str = ""
|
|
stripe_starter_price_id: str = ""
|
|
stripe_pro_price_id: str = ""
|
|
|
|
# Redis
|
|
redis_url: str = "redis://localhost:6379"
|
|
|
|
# Sentry
|
|
sentry_dsn: Optional[str] = None
|
|
|
|
# Files
|
|
max_file_size_mb: int = 50
|
|
|
|
@property
|
|
def allowed_origins_list(self) -> List[str]:
|
|
return [o.strip() for o in self.allowed_origins.split(",")]
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = False
|
|
|
|
|
|
settings = Settings()
|
|
|
|
# Plan limits
|
|
PLAN_LIMITS = {
|
|
"free": {
|
|
"max_chatbots": 999999, # unlimited creation
|
|
"max_published": 0, # cannot publish
|
|
"models": [],
|
|
"conversations_limit": 999999, # unlimited preview
|
|
"code_export": False,
|
|
"features": ["preview_mode", "testing"],
|
|
},
|
|
"starter": {
|
|
"max_chatbots": 999999,
|
|
"max_published": 1,
|
|
"models": [
|
|
"accounts/fireworks/models/kimi-k2-instruct-0905",
|
|
"accounts/fireworks/models/deepseek-v3p2",
|
|
"accounts/fireworks/models/glm-4p7",
|
|
],
|
|
"conversations_limit": 5000,
|
|
"code_export": False,
|
|
"features": ["marketplace", "analytics", "branding"],
|
|
},
|
|
"pro": {
|
|
"max_chatbots": 3,
|
|
"max_published": 3,
|
|
"models": [
|
|
"accounts/fireworks/models/kimi-k2-instruct-0905",
|
|
"accounts/fireworks/models/deepseek-v3p2",
|
|
"gpt-4o",
|
|
"gpt-4-turbo",
|
|
"gpt-3.5-turbo",
|
|
"claude-3-5-sonnet-20241022",
|
|
"claude-3-opus-20240229",
|
|
"gemini-1.5-pro",
|
|
],
|
|
"conversations_limit": 20000,
|
|
"code_export": True,
|
|
"features": [
|
|
"marketplace",
|
|
"code_export",
|
|
"advanced_analytics",
|
|
"priority_support",
|
|
"custom_domain",
|
|
"ab_testing",
|
|
],
|
|
},
|
|
"enterprise": {
|
|
"max_chatbots": 999999,
|
|
"max_published": 999999,
|
|
"models": ["*"],
|
|
"conversations_limit": 999999,
|
|
"code_export": True,
|
|
"features": ["*"],
|
|
},
|
|
}
|
|
|
|
MODEL_PROVIDERS = {
|
|
"accounts/fireworks/models/kimi-k2-instruct-0905": "fireworks",
|
|
"accounts/fireworks/models/deepseek-v3p2": "fireworks",
|
|
"accounts/fireworks/models/glm-4p7": "fireworks",
|
|
"gpt-4o": "openai",
|
|
"gpt-4-turbo": "openai",
|
|
"gpt-3.5-turbo": "openai",
|
|
"claude-3-5-sonnet-20241022": "anthropic",
|
|
"claude-3-opus-20240229": "anthropic",
|
|
"gemini-1.5-pro": "google",
|
|
}
|
|
|
|
DEFAULT_MODELS = {
|
|
"starter": "accounts/fireworks/models/kimi-k2-instruct-0905",
|
|
"pro": "gpt-4o",
|
|
"enterprise": "gpt-4o",
|
|
}
|