Files
9router/src/app/api/providers/[id]/test/route.js
T
BiuBiu_HuandClaude Opus 4.5 d14c18f77f refactor: rename provider to alicode (Aliyun Coding)
Rename alicloud to alicode to clearly indicate Aliyun's Coding Plan service.

- Provider ID: alicode (short for Aliyun Coding)
- Model format: alicode/qwen3.5-plus
- Simplified mapping - no more bidirectional aliases

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-26 08:05:05 +08:00

24 lines
725 B
JavaScript

import { NextResponse } from "next/server";
import { testSingleConnection } from "./testUtils.js";
// POST /api/providers/[id]/test - Test connection
export async function POST(request, { params }) {
try {
const { id } = await params;
const result = await testSingleConnection(id);
if (result.error === "Connection not found") {
return NextResponse.json({ error: "Connection not found" }, { status: 404 });
}
return NextResponse.json({
valid: result.valid,
error: result.error,
refreshed: result.refreshed || false,
});
} catch (error) {
console.log("Error testing connection:", error);
return NextResponse.json({ error: "Test failed" }, { status: 500 });
}
}