test24 / api /config.py
Niansuh's picture
Update api/config.py
d94491c verified
raw
history blame
2.06 kB
import os
from dotenv import load_dotenv
load_dotenv()
# Base URL and Common Headers for Editee
BASE_URL = "https://editee.com"
common_headers = {
'accept': 'application/json, text/plain, */*',
'accept-language': 'en-US,en;q=0.9',
'cache-control': 'no-cache',
'origin': BASE_URL,
'pragma': 'no-cache',
'priority': 'u=1, i',
'sec-ch-ua': '"Chromium";v="129", "Not=A?Brand";v="8"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Linux"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-origin',
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36',
}
# Header Configurations for Editee API Calls
def get_headers_api_chat(referer_url):
return {**common_headers, 'Content-Type': 'application/json', 'Referer': referer_url}
def get_headers_chat(chat_url, next_action, next_router_state_tree):
return {
**common_headers,
'Accept': 'text/x-component',
'Content-Type': 'text/plain;charset=UTF-8',
'Referer': chat_url,
'next-action': next_action,
'next-router-state-tree': next_router_state_tree,
'next-url': '/',
}
# Application Secret for Authentication
APP_SECRET = os.getenv("APP_SECRET")
# Default Model
default_model = 'claude'
# Supported Models
models = ['claude', 'gpt4', 'gemini', 'mistrallarge']
# Model Aliases
model_aliases = {
"claude-3.5-sonnet": "claude",
"gpt-4o": "gpt4",
"gemini-pro": "gemini",
"mistral-large": "mistrallarge",
}
# Allowed Models with ID and Name
ALLOWED_MODELS = [
{"id": "claude", "name": "Claude"},
{"id": "gpt4", "name": "GPT-4"},
{"id": "gemini", "name": "Gemini"},
{"id": "mistrallarge", "name": "Mistral Large"},
]
# Mapping from model IDs to their canonical names
MODEL_MAPPING = {
"claude": "claude",
"gpt4": "gpt4",
"gemini": "gemini",
"mistrallarge": "mistrallarge",
}
# Removed MODEL_PREFIXES, MODEL_REFERERS, and AGENT_MODE as per user instruction