Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -18,14 +18,13 @@ system_prompt += (
|
|
18 |
"'I'm not sure about that. Let me connect you with a human agent.'"
|
19 |
)
|
20 |
|
21 |
-
# Initialize OpenAI client with
|
22 |
-
client = OpenAI(
|
23 |
-
|
24 |
-
|
25 |
-
)
|
26 |
|
27 |
# Optional: Secret token for webhook auth, set in environment variables
|
28 |
-
|
29 |
|
30 |
@app.post("/ask")
|
31 |
async def ask(
|
|
|
18 |
"'I'm not sure about that. Let me connect you with a human agent.'"
|
19 |
)
|
20 |
|
21 |
+
# Initialize OpenAI client with your API key
|
22 |
+
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
23 |
+
# Set custom base URL if provided, else default to official endpoint
|
24 |
+
client.api_base = os.getenv("OPENAI_API_BASE", "https://fast.typegpt.net/v1")
|
|
|
25 |
|
26 |
# Optional: Secret token for webhook auth, set in environment variables
|
27 |
+
WEBHOOK_SECRET_TOKEN = os.getenv("WEBHOOK_SECRET_TOKEN")
|
28 |
|
29 |
@app.post("/ask")
|
30 |
async def ask(
|