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.

46 lines (34 loc) 1.07 kB
/* eslint-disable sort-keys-fix/sort-keys-fix */ import { transform } from 'lodash-es'; import { withBasePath } from '@/utils/basePath'; const mapWithBasePath = <T extends object>(apis: T): T => { return transform(apis, (result, value, key) => { if (typeof value === 'string') { // @ts-ignore result[key] = withBasePath(value); } else { result[key] = value; } }); }; export const API_ENDPOINTS = mapWithBasePath({ oauth: '/api/auth', proxy: '/webapi/proxy', // plugins gateway: '/webapi/plugin/gateway', // trace trace: '/webapi/trace', // chat chat: (provider: string) => withBasePath(`/webapi/chat/${provider}`), // models models: (provider: string) => withBasePath(`/webapi/models/${provider}`), modelPull: (provider: string) => withBasePath(`/webapi/models/${provider}/pull`), // image images: (provider: string) => `/webapi/text-to-image/${provider}`, // STT stt: '/webapi/stt/openai', // TTS tts: '/webapi/tts/openai', edge: '/webapi/tts/edge', microsoft: '/webapi/tts/microsoft', });