2
import { transform } from 'lodash-es';
4
import { withBasePath } from '@/utils/basePath';
6
const mapWithBasePath = <T extends object>(apis: T): T => {
7
return transform(apis, (result, value, key) => {
8
if (typeof value === 'string') {
10
result[key] = withBasePath(value);
17
export const API_ENDPOINTS = mapWithBasePath({
20
proxy: '/webapi/proxy',
23
assistantStore: '/webapi/assistant/store',
24
assistant: (identifier: string) => withBasePath(`/webapi/assistant/${identifier}`),
27
gateway: '/webapi/plugin/gateway',
28
pluginStore: '/webapi/plugin/store',
31
trace: '/webapi/trace',
34
chat: (provider: string) => withBasePath(`/webapi/chat/${provider}`),
35
chatModels: (provider: string) => withBasePath(`/webapi/chat/models/${provider}`),
38
images: (provider: string) => `/webapi/text-to-image/${provider}`,
41
stt: '/webapi/stt/openai',
44
tts: '/webapi/tts/openai',
45
edge: '/webapi/tts/edge',
46
microsoft: '/webapi/tts/microsoft',