refactor: Use librechat-data-provider app-wide 🔄 (#1326)

* chore: bump vite, vitejs/plugin-react, mark client package as esm, move react-query as a peer dep in data-provider

* chore: import changes due to new data-provider export strategy, also fix type imports where applicable

* chore: export react-query services as separate to avoid react dependencies in /api/

* chore: suppress sourcemap warnings and polyfill node:path which is used by filenamify
TODO: replace filenamify with an alternative and REMOVE polyfill

* chore: /api/ changes to support `librechat-data-provider`

* refactor: rewrite Dockerfile.multi in light of /api/ changes to support `librechat-data-provider`

* chore: remove volume mapping to node_modules directories in default compose file

* chore: remove schemas from /api/ as is no longer needed with use of `librechat-data-provider`

* fix(ci): jest `librechat-data-provider/react-query` module resolution
This commit is contained in:
Danny Avila 2023-12-11 14:48:40 -05:00 committed by GitHub
parent d4c846b543
commit df1dfa7d46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
97 changed files with 1831 additions and 1343 deletions

View file

@ -3,13 +3,7 @@ export * from './types';
export * from './types/assistants';
export * from './types/files';
export * from './types/mutations';
/*
* react query
* TODO: move to client, or move schemas/types to their own package
*/
export * from './react-query-service';
export * from './keys';
export * from './assistants';
/* api call helpers */
export * from './headers-helpers';
export { default as request } from './request';

View file

@ -5,9 +5,9 @@ import type {
QueryObserverResult,
UseInfiniteQueryOptions,
} from '@tanstack/react-query';
import * as t from './types/assistants';
import * as dataService from './data-service';
import { QueryKeys } from './keys';
import * as t from '../types/assistants';
import * as dataService from '../data-service';
import { QueryKeys } from '../keys';
/**
* Hook for listing all assistants, with optional parameters provided for pagination and sorting

View file

@ -0,0 +1,2 @@
export * from './react-query-service';
export * from './assistants';

View file

@ -6,12 +6,12 @@ import {
UseMutationResult,
QueryObserverResult,
} from '@tanstack/react-query';
import * as t from './types';
import * as s from './schemas';
import * as m from './types/mutations';
import * as dataService from './data-service';
import request from './request';
import { QueryKeys } from './keys';
import * as t from '../types';
import * as s from '../schemas';
import * as m from '../types/mutations';
import * as dataService from '../data-service';
import request from '../request';
import { QueryKeys } from '../keys';
export const useAbortRequestWithMessage = (): UseMutationResult<
void,
@ -292,20 +292,6 @@ export const useCreatePresetMutation = (): UseMutationResult<
});
};
export const useUpdatePresetMutation = (): UseMutationResult<
s.TPreset,
unknown,
s.TPreset,
unknown
> => {
const queryClient = useQueryClient();
return useMutation((payload: s.TPreset) => dataService.updatePreset(payload), {
onSuccess: () => {
queryClient.invalidateQueries([QueryKeys.presets]);
},
});
};
export const useDeletePresetMutation = (): UseMutationResult<
m.PresetDeleteResponse,
unknown,

View file

@ -107,6 +107,8 @@ export const openAIModels = [
'gpt-4-0314',
];
export const visionModels = ['gpt-4-vision', 'llava-13b'];
export const eModelEndpointSchema = z.nativeEnum(EModelEndpoint);
export const tPluginAuthConfigSchema = z.object({

View file

@ -1,13 +1,10 @@
import OpenAI from 'openai';
import type { UseMutationResult } from '@tanstack/react-query';
import type { TResPlugin, TMessage, TConversation, TEndpointOption } from './schemas';
export type TOpenAIMessage = OpenAI.Chat.ChatCompletionMessageParam;
export type TOpenAIFunction = OpenAI.Chat.ChatCompletionCreateParams.Function;
export type TOpenAIFunctionCall = OpenAI.Chat.ChatCompletionCreateParams.FunctionCallOption;
export type TMutation = UseMutationResult<unknown>;
export * from './schemas';
export type TMessages = TMessage[];
@ -127,7 +124,7 @@ export type TConfig = {
export type TModelsConfig = Record<string, string[]>;
export type TEndpointsConfig = Record<string, TConfig>;
export type TEndpointsConfig = Record<string, TConfig | null>;
export type TUpdateTokenCountResponse = {
count: number;