UNPKG

@lobehub/chat

Version:

Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.

35 lines (26 loc) 869 B
import { NextResponse } from 'next/server'; import { DEFAULT_LANG } from '@/const/locale'; import { PluginStore } from '@/server/modules/PluginStore'; export const runtime = 'edge'; export const GET = async (req: Request) => { try { const locale = new URL(req.url).searchParams.get('locale'); const pluginStore = new PluginStore(); let res: Response; res = await fetch(pluginStore.getPluginIndexUrl(locale as any)); if (res.status === 404) { res = await fetch(pluginStore.getPluginIndexUrl(DEFAULT_LANG)); } const data = await res.json(); return NextResponse.json(data); } catch (e) { console.error(e); return new Response(`failed to fetch agent market index`, { headers: { 'Access-Control-Allow-Origin': '*', 'Content-Type': 'application/json', }, status: 500, }); } };