You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
// TODO: 未来所有核心路由需要迁移到 trpc, 部分不需要迁移的则走 webapi
/* 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 ( {
proxy : '/webapi/proxy' ,
oauth : '/api/auth' ,
// agent markets
assistantStore : '/api/assistant/store' ,
assistant : ( identifier : string ) = > withBasePath ( ` /api/assistant/ ${ identifier } ` ) ,
// plugins
gateway : '/api/plugin/gateway' ,
pluginStore : '/api/plugin/store' ,
// chat
chat : ( provider : string ) = > withBasePath ( ` /api/chat/ ${ provider } ` ) ,
chatModels : ( provider : string ) = > withBasePath ( ` /api/chat/models/ ${ provider } ` ) ,
// trace
trace : '/api/trace' ,
// image
images : '/api/text-to-image/openai' ,
// STT
stt : '/webapi/stt/openai' ,
// TTS
tts : '/webapi/tts/openai' ,
edge : '/webapi/tts/edge' ,
microsoft : '/webapi/tts/microsoft' ,
} ) ;