Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -26,13 +26,18 @@ CONTENT_TYPE_EVENT_STREAM = 'text/event-stream'
|
|
26 |
_BASE_URL = "https://chat.notdiamond.ai"
|
27 |
_API_BASE_URL = "https://spuckhogycrxcbomznwo.supabase.co"
|
28 |
_USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36'
|
29 |
-
_PASTE_API_URL = "https://page.zhoudan.icu/api/paste/b40v96oX"
|
30 |
|
31 |
-
# 从环境变量获取API
|
32 |
API_KEY = os.getenv('API_KEY')
|
|
|
|
|
|
|
33 |
if not API_KEY:
|
34 |
raise ValueError("API_KEY environment variable must be set")
|
35 |
|
|
|
|
|
|
|
36 |
app = Flask(__name__)
|
37 |
logging.basicConfig(level=logging.INFO)
|
38 |
logger = logging.getLogger(__name__)
|
@@ -461,7 +466,7 @@ def get_auth_credentials():
|
|
461 |
'accept': '*/*',
|
462 |
'accept-language': 'zh-CN,zh;q=0.9',
|
463 |
'user-agent': _USER_AGENT,
|
464 |
-
'x-password':
|
465 |
}
|
466 |
response = session.get(_PASTE_API_URL, headers=headers)
|
467 |
if response.status_code == 200:
|
|
|
26 |
_BASE_URL = "https://chat.notdiamond.ai"
|
27 |
_API_BASE_URL = "https://spuckhogycrxcbomznwo.supabase.co"
|
28 |
_USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36'
|
|
|
29 |
|
30 |
+
# 从环境变量获取API密钥和特定URL
|
31 |
API_KEY = os.getenv('API_KEY')
|
32 |
+
_PASTE_API_URL = os.getenv('PASTE_API_URL')
|
33 |
+
_PASTE_API_PASSWORD = os.getenv('PASTE_API_PASSWORD')
|
34 |
+
|
35 |
if not API_KEY:
|
36 |
raise ValueError("API_KEY environment variable must be set")
|
37 |
|
38 |
+
if not _PASTE_API_URL:
|
39 |
+
raise ValueError("PASTE_API_URL environment variable must be set")
|
40 |
+
|
41 |
app = Flask(__name__)
|
42 |
logging.basicConfig(level=logging.INFO)
|
43 |
logger = logging.getLogger(__name__)
|
|
|
466 |
'accept': '*/*',
|
467 |
'accept-language': 'zh-CN,zh;q=0.9',
|
468 |
'user-agent': _USER_AGENT,
|
469 |
+
'x-password': _PASTE_API_PASSWORD
|
470 |
}
|
471 |
response = session.get(_PASTE_API_URL, headers=headers)
|
472 |
if response.status_code == 200:
|