Spaces:
Running
Running
🐛 fix issue with default token
Browse files- app/api/ask/route.ts +2 -3
app/api/ask/route.ts
CHANGED
|
@@ -63,7 +63,7 @@ export async function POST(request: NextRequest) {
|
|
| 63 |
? authHeaders.get("x-forwarded-for")?.split(",")[1].trim()
|
| 64 |
: authHeaders.get("x-forwarded-for");
|
| 65 |
|
| 66 |
-
if (!token) {
|
| 67 |
ipAddresses.set(ip, (ipAddresses.get(ip) || 0) + 1);
|
| 68 |
if (ipAddresses.get(ip) > MAX_REQUESTS_PER_IP) {
|
| 69 |
return NextResponse.json(
|
|
@@ -103,7 +103,6 @@ export async function POST(request: NextRequest) {
|
|
| 103 |
try {
|
| 104 |
const client = new InferenceClient(token);
|
| 105 |
|
| 106 |
-
// Use light prompt for MiniMax model
|
| 107 |
const systemPrompt = selectedModel.value.includes('MiniMax')
|
| 108 |
? INITIAL_SYSTEM_PROMPT_LIGHT
|
| 109 |
: INITIAL_SYSTEM_PROMPT;
|
|
@@ -246,7 +245,7 @@ export async function PUT(request: NextRequest) {
|
|
| 246 |
? authHeaders.get("x-forwarded-for")?.split(",")[1].trim()
|
| 247 |
: authHeaders.get("x-forwarded-for");
|
| 248 |
|
| 249 |
-
if (!token) {
|
| 250 |
ipAddresses.set(ip, (ipAddresses.get(ip) || 0) + 1);
|
| 251 |
if (ipAddresses.get(ip) > MAX_REQUESTS_PER_IP) {
|
| 252 |
return NextResponse.json(
|
|
|
|
| 63 |
? authHeaders.get("x-forwarded-for")?.split(",")[1].trim()
|
| 64 |
: authHeaders.get("x-forwarded-for");
|
| 65 |
|
| 66 |
+
if (!token || token === "null" || token === "") {
|
| 67 |
ipAddresses.set(ip, (ipAddresses.get(ip) || 0) + 1);
|
| 68 |
if (ipAddresses.get(ip) > MAX_REQUESTS_PER_IP) {
|
| 69 |
return NextResponse.json(
|
|
|
|
| 103 |
try {
|
| 104 |
const client = new InferenceClient(token);
|
| 105 |
|
|
|
|
| 106 |
const systemPrompt = selectedModel.value.includes('MiniMax')
|
| 107 |
? INITIAL_SYSTEM_PROMPT_LIGHT
|
| 108 |
: INITIAL_SYSTEM_PROMPT;
|
|
|
|
| 245 |
? authHeaders.get("x-forwarded-for")?.split(",")[1].trim()
|
| 246 |
: authHeaders.get("x-forwarded-for");
|
| 247 |
|
| 248 |
+
if (!token || token === "null" || token === "") {
|
| 249 |
ipAddresses.set(ip, (ipAddresses.get(ip) || 0) + 1);
|
| 250 |
if (ipAddresses.get(ip) > MAX_REQUESTS_PER_IP) {
|
| 251 |
return NextResponse.json(
|