Spaces:
Runtime error
Runtime error
Upload pages/api/generate.js with huggingface_hub
Browse files- pages/api/generate.js +0 -4
pages/api/generate.js
CHANGED
|
@@ -13,9 +13,6 @@ export default async function handler(req, res) {
|
|
| 13 |
|
| 14 |
try {
|
| 15 |
// Production-grade AI Inference Call
|
| 16 |
-
// This connects to Hugging Face Inference API (or configured OpenAI)
|
| 17 |
-
// Ensure HF_TOKEN or OPENAI_API_KEY is set in environment variables
|
| 18 |
-
|
| 19 |
const systemPrompt = `You are an expert Full-Stack AI Engineer.
|
| 20 |
Context:
|
| 21 |
- Voice: ${voiceMatrix}
|
|
@@ -54,7 +51,6 @@ export default async function handler(req, res) {
|
|
| 54 |
aiResponse = response.data[0]?.generated_text || "No response generated from model.";
|
| 55 |
} else {
|
| 56 |
// Fallback / Mock Response for environments without API Keys configured
|
| 57 |
-
// In a real production env, this block should be removed or replaced with a strict error.
|
| 58 |
throw new Error("AI Service Unavailable: HF_TOKEN not configured in environment variables.");
|
| 59 |
}
|
| 60 |
|
|
|
|
| 13 |
|
| 14 |
try {
|
| 15 |
// Production-grade AI Inference Call
|
|
|
|
|
|
|
|
|
|
| 16 |
const systemPrompt = `You are an expert Full-Stack AI Engineer.
|
| 17 |
Context:
|
| 18 |
- Voice: ${voiceMatrix}
|
|
|
|
| 51 |
aiResponse = response.data[0]?.generated_text || "No response generated from model.";
|
| 52 |
} else {
|
| 53 |
// Fallback / Mock Response for environments without API Keys configured
|
|
|
|
| 54 |
throw new Error("AI Service Unavailable: HF_TOKEN not configured in environment variables.");
|
| 55 |
}
|
| 56 |
|