lobe-chat

Форк
0
47 строк · 1.1 Кб
1
/* eslint-disable sort-keys-fix/sort-keys-fix */
2
import { transform } from 'lodash-es';
3

4
import { withBasePath } from '@/utils/basePath';
5

6
const mapWithBasePath = <T extends object>(apis: T): T => {
7
  return transform(apis, (result, value, key) => {
8
    if (typeof value === 'string') {
9
      // @ts-ignore
10
      result[key] = withBasePath(value);
11
    } else {
12
      result[key] = value;
13
    }
14
  });
15
};
16

17
export const API_ENDPOINTS = mapWithBasePath({
18
  oauth: '/api/auth',
19

20
  proxy: '/webapi/proxy',
21

22
  // assistant
23
  assistantStore: '/webapi/assistant/store',
24
  assistant: (identifier: string) => withBasePath(`/webapi/assistant/${identifier}`),
25

26
  // plugins
27
  gateway: '/webapi/plugin/gateway',
28
  pluginStore: '/webapi/plugin/store',
29

30
  // trace
31
  trace: '/webapi/trace',
32

33
  // chat
34
  chat: (provider: string) => withBasePath(`/webapi/chat/${provider}`),
35
  chatModels: (provider: string) => withBasePath(`/webapi/chat/models/${provider}`),
36

37
  // image
38
  images: (provider: string) => `/webapi/text-to-image/${provider}`,
39

40
  // STT
41
  stt: '/webapi/stt/openai',
42

43
  // TTS
44
  tts: '/webapi/tts/openai',
45
  edge: '/webapi/tts/edge',
46
  microsoft: '/webapi/tts/microsoft',
47
});
48

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.