mirror of
http://88.130.71.182:3000/BlitTech/contexta_be.git
synced 2026-06-12 23:23:21 +00:00
fixed bugs
This commit is contained in:
150
app/config.py
150
app/config.py
@@ -1,5 +1,6 @@
|
||||
from pydantic_settings import BaseSettings
|
||||
from typing import Optional, List
|
||||
from typing import List, Optional
|
||||
import os
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
@@ -52,12 +53,121 @@ class Settings(BaseSettings):
|
||||
|
||||
settings = Settings()
|
||||
|
||||
# Plan limits
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
# MODEL CATALOG — Single source of truth for all model metadata
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
# To add a new model:
|
||||
# 1. Add it here with name/provider/badge/description
|
||||
# 2. Add its model_id → provider mapping in MODEL_PROVIDERS
|
||||
# 3. Add it to the appropriate plan(s) in PLAN_LIMITS
|
||||
# That's it — the frontend loads everything from GET /api/v1/models/available
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
MODEL_CATALOG = {
|
||||
# ── Free tier (Fireworks - lightweight) ────────────────────────────────────
|
||||
"accounts/fireworks/models/kimi-k2-instruct-0905": {
|
||||
"name": "Kimi K2",
|
||||
"provider": "Fireworks AI",
|
||||
"badge": "Free",
|
||||
"description": "Free model for building and testing chatbots",
|
||||
},
|
||||
|
||||
# ── Starter tier (Fireworks - powerful) ────────────────────────────────────
|
||||
"accounts/fireworks/models/llama-v3p1-70b-instruct": {
|
||||
"name": "Llama 3.1 70B",
|
||||
"provider": "Fireworks AI",
|
||||
"badge": "Fast",
|
||||
"description": "Fast open-source model, great for most tasks",
|
||||
},
|
||||
"accounts/fireworks/models/mixtral-8x7b-instruct": {
|
||||
"name": "Mixtral 8x7B",
|
||||
"provider": "Fireworks AI",
|
||||
"badge": "Balanced",
|
||||
"description": "Balanced speed and quality",
|
||||
},
|
||||
"accounts/fireworks/models/qwen2p5-72b-instruct": {
|
||||
"name": "Qwen 2.5 72B",
|
||||
"provider": "Fireworks AI",
|
||||
"badge": "Multilingual",
|
||||
"description": "Excellent multilingual capabilities",
|
||||
},
|
||||
|
||||
# ── Pro tier (Premium providers) ───────────────────────────────────────────
|
||||
"gpt-4o": {
|
||||
"name": "GPT-4o",
|
||||
"provider": "OpenAI",
|
||||
"badge": "Powerful",
|
||||
"description": "Most capable OpenAI model",
|
||||
},
|
||||
"gpt-4-turbo": {
|
||||
"name": "GPT-4 Turbo",
|
||||
"provider": "OpenAI",
|
||||
"badge": "Smart",
|
||||
"description": "Fast and capable with large context",
|
||||
},
|
||||
"gpt-3.5-turbo": {
|
||||
"name": "GPT-3.5 Turbo",
|
||||
"provider": "OpenAI",
|
||||
"badge": "Efficient",
|
||||
"description": "Cost-effective for simpler tasks",
|
||||
},
|
||||
"claude-3-5-sonnet-20241022": {
|
||||
"name": "Claude 3.5 Sonnet",
|
||||
"provider": "Anthropic",
|
||||
"badge": "Reasoning",
|
||||
"description": "Excellent at analysis and reasoning",
|
||||
},
|
||||
"claude-3-opus-20240229": {
|
||||
"name": "Claude 3 Opus",
|
||||
"provider": "Anthropic",
|
||||
"badge": "Advanced",
|
||||
"description": "Most capable Anthropic model",
|
||||
},
|
||||
"gemini-1.5-pro": {
|
||||
"name": "Gemini 1.5 Pro",
|
||||
"provider": "Google",
|
||||
"badge": "Long Context",
|
||||
"description": "Handles very long documents well",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
# ─── Model ID → LLM provider mapping (used by llm_client.py for routing) ─────
|
||||
|
||||
MODEL_PROVIDERS = {
|
||||
"accounts/fireworks/models/kimi-k2-instruct-0905": "fireworks",
|
||||
"accounts/fireworks/models/llama-v3p1-70b-instruct": "fireworks",
|
||||
"accounts/fireworks/models/mixtral-8x7b-instruct": "fireworks",
|
||||
"accounts/fireworks/models/qwen2p5-72b-instruct": "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 model per plan (pre-selected in the frontend) ────────────────────
|
||||
|
||||
DEFAULT_MODELS = {
|
||||
"free": "accounts/fireworks/models/kimi-k2-instruct-0905",
|
||||
"starter": "accounts/fireworks/models/llama-v3p1-70b-instruct",
|
||||
"pro": "gpt-4o",
|
||||
"enterprise": "gpt-4o",
|
||||
}
|
||||
|
||||
|
||||
# ─── Plan limits ──────────────────────────────────────────────────────────────
|
||||
|
||||
PLAN_LIMITS = {
|
||||
"free": {
|
||||
"max_chatbots": 999999, # unlimited creation
|
||||
"max_published": 0, # cannot publish
|
||||
"models": [],
|
||||
"max_chatbots": 999999, # unlimited creation
|
||||
"max_published": 0, # cannot publish
|
||||
"models": [
|
||||
"accounts/fireworks/models/kimi-k2-instruct-0905",
|
||||
],
|
||||
"conversations_limit": 999999, # unlimited preview
|
||||
"code_export": False,
|
||||
"features": ["preview_mode", "testing"],
|
||||
@@ -67,8 +177,9 @@ PLAN_LIMITS = {
|
||||
"max_published": 1,
|
||||
"models": [
|
||||
"accounts/fireworks/models/kimi-k2-instruct-0905",
|
||||
"accounts/fireworks/models/deepseek-v3p2",
|
||||
"accounts/fireworks/models/glm-4p7",
|
||||
"accounts/fireworks/models/llama-v3p1-70b-instruct",
|
||||
"accounts/fireworks/models/mixtral-8x7b-instruct",
|
||||
"accounts/fireworks/models/qwen2p5-72b-instruct",
|
||||
],
|
||||
"conversations_limit": 5000,
|
||||
"code_export": False,
|
||||
@@ -79,7 +190,8 @@ PLAN_LIMITS = {
|
||||
"max_published": 3,
|
||||
"models": [
|
||||
"accounts/fireworks/models/kimi-k2-instruct-0905",
|
||||
"accounts/fireworks/models/deepseek-v3p2",
|
||||
"accounts/fireworks/models/llama-v3p1-70b-instruct",
|
||||
"accounts/fireworks/models/mixtral-8x7b-instruct",
|
||||
"gpt-4o",
|
||||
"gpt-4-turbo",
|
||||
"gpt-3.5-turbo",
|
||||
@@ -101,27 +213,9 @@ PLAN_LIMITS = {
|
||||
"enterprise": {
|
||||
"max_chatbots": 999999,
|
||||
"max_published": 999999,
|
||||
"models": ["*"],
|
||||
"models": ["*"], # resolves to all MODEL_CATALOG keys
|
||||
"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",
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user