mirror of
https://github.com/luckyyzh/pi-agent-integrated.git
synced 2026-10-03 02:59:35 +00:00
19 lines
614 B
TypeScript
19 lines
614 B
TypeScript
import { ModelRuntime } from "@earendil-works/pi-coding-agent";
|
|
import { invalidateModelsCache } from "@/lib/models-cache";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export async function POST(
|
|
_req: Request,
|
|
{ params }: { params: Promise<{ provider: string }> }
|
|
) {
|
|
const { provider } = await params;
|
|
const modelRuntime = await ModelRuntime.create();
|
|
if (!modelRuntime.getProvider(provider)?.auth.oauth) {
|
|
return Response.json({ error: `Unknown provider: ${provider}` }, { status: 400 });
|
|
}
|
|
await modelRuntime.logout(provider);
|
|
invalidateModelsCache();
|
|
return Response.json({ ok: true });
|
|
}
|