Update config.py
Browse files4 unmodified lines5678910111213141516171819204 unmodified lines252627282930313233343536373839404142434445464748495051525354555657585960614 unmodified linesdef get_env(key: str, default: str = "") -> str:val = os.getenv(key, default)return val.strip() if isinstance(val, str) else defaultBAI_API_KEY = get_env("BAI_API_KEY", "")BAI_URL = get_env("BAI_URL", "https://api.b.ai/v1/chat/completions")MODEL_NAME = get_env("MODEL_NAME", "deepseek-v4-flash-vision-exp")TAVILY_API_KEY = get_env("TAVILY_API_KEY", "")REDIRECT_URI = get_env("REDIRECT_URI", "")SUPABASE_URL = get_env("SUPABASE_URL", "")SUPABASE_KEY = get_env("SUPABASE_KEY", "")GOOGLE_FULL_SCOPES = ("https://mail.google.com/ "4 unmodified lines"https://www.googleapis.com/auth/userinfo.profile")def get_oauth_config(service: str) -> dict:svc_key = service.lower().strip()if svc_key in ["google", "gmail", "calendar", "drive"]:return {"client_id": get_env("GOOGLE_CLIENT_ID", ""),"client_secret": get_env("GOOGLE_CLIENT_SECRET", ""),"auth_url": "https://accounts.google.com/o/oauth2/auth","token_url": "https://oauth2.googleapis.com/token","scope": GOOGLE_FULL_SCOPES}elif svc_key == "notion":return {"client_id": get_env("NOTION_CLIENT_ID", ""),"client_secret": get_env("NOTION_CLIENT_SECRET", ""),"auth_url": "https://api.notion.com/v1/oauth/authorize","token_url": "https://api.notion.com/v1/oauth/token","extra_params": {"owner": "user", "response_type": "code"}}elif svc_key == "github":return {"client_id": get_env("GITHUB_CLIENT_ID", ""),"client_secret": get_env("GITHUB_CLIENT_SECRET", ""),"auth_url": "https://github.com/login/oauth/authorize","token_url": "https://github.com/login/oauth/access_token","scope": "repo workflow gist read:org read:user user:email delete_repo"}return {"client_id": get_env("GOOGLE_CLIENT_ID", ""),"client_secret": get_env("GOOGLE_CLIENT_SECRET", ""),"auth_url": "https://accounts.google.com/o/oauth2/auth","token_url": "https://oauth2.googleapis.com/token","scope": GOOGLE_FULL_SCOPES4 unmodified lines567891011121314151617181920212223244 unmodified lines293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273744 unmodified linesdef get_env(key: str, default: str = "") -> str:val = os.getenv(key, default)if val is None:return defaultval_str = str(val).strip()return val_str if val_str else defaultBAI_API_KEY = get_env("BAI_API_KEY", "")BAI_URL = get_env("BAI_URL", "https://api.b.ai/v1/chat/completions")MODEL_NAME = get_env("MODEL_NAME", "deepseek-v4-flash-vision-exp")TAVILY_API_KEY = get_env("TAVILY_API_KEY", "")SUPABASE_URL = get_env("SUPABASE_URL", "https://mdrilsichwkkmgfbudql.supabase.co")SUPABASE_KEY = get_env("SUPABASE_KEY", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im1kcmlsc2ljaHdra21nZmJ1ZHFsIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODcyMjc5NDQsImV4cCI6MjEwMjgwMzk0NH0.fIWKHdzPHnwMuidLuXrMqeDl2kRXC8Dx6Grw61iMuPg")REDIRECT_URI = "https://hongtyyuqu-server-text-model-omni-4-8-clade.hf.space/auth/callback"GOOGLE_FULL_SCOPES = ("https://mail.google.com/ "4 unmodified lines"https://www.googleapis.com/auth/userinfo.profile")GOOGLE_CLIENT_ID = get_env("GOOGLE_CLIENT_ID", "365289707414-af77dijs63o06l14h9ni40kr1ftojcki.apps.googleusercontent.com")GOOGLE_CLIENT_SECRET = get_env("GOOGLE_CLIENT_SECRET", "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")NOTION_CLIENT_ID = get_env("NOTION_CLIENT_ID", "3b8d872b-594c-81b8-b5a3-003798f224bc")NOTION_CLIENT_SECRET = get_env("NOTION_CLIENT_SECRET", "secret_loaJl6Euy6rYx6cHkJUIZhFKCD9nUO0KlQMleECWFME")GITHUB_CLIENT_ID = get_env("GITHUB_CLIENT_ID", "Ov23li5J8HZnM80qoKUm")GITHUB_CLIENT_SECRET = get_env("GITHUB_CLIENT_SECRET", "ec8548ef297ed59d8372e5bc549d8ed9adc996f7")def get_oauth_config(service: str) -> dict:svc_key = service.lower().strip()if svc_key in ["google", "gmail", "calendar", "drive"]:return {"client_id": GOOGLE_CLIENT_ID,"client_secret": GOOGLE_CLIENT_SECRET,"auth_url": "https://accounts.google.com/o/oauth2/auth","token_url": "https://oauth2.googleapis.com/token","scope": GOOGLE_FULL_SCOPES}elif svc_key == "notion":return {"client_id": NOTION_CLIENT_ID,"client_secret": NOTION_CLIENT_SECRET,"auth_url": "https://api.notion.com/v1/oauth/authorize","token_url": "https://api.notion.com/v1/oauth/token","extra_params": {"owner": "user", "response_type": "code"}}elif svc_key == "github":return {"client_id": GITHUB_CLIENT_ID,"client_secret": GITHUB_CLIENT_SECRET,"auth_url": "https://github.com/login/oauth/authorize","token_url": "https://github.com/login/oauth/access_token","scope": "repo workflow gist read:org read:user user:email delete_repo"}return {"client_id": GOOGLE_CLIENT_ID,"client_secret": GOOGLE_CLIENT_SECRET,"auth_url": "https://accounts.google.com/o/oauth2/auth","token_url": "https://oauth2.googleapis.com/token","scope": GOOGLE_FULL_SCOPES
config.py+25-12