mirror of
https://github.com/luckyyzh/pi-agent-integrated.git
synced 2026-10-03 11:09:34 +00:00
feat: integrate Pi backend and Pi Web
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
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 });
|
||||
}
|
||||
Reference in New Issue
Block a user