mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-19 00:22:14 +03:00
7532b558c7
* feat: add user user identity table * feat: add user openai api key input * feat: add encryption missing message * chore: log more details about 422 errors * docs(API): update api creation path * feat: use user openai key if defined
26 lines
662 B
TypeScript
26 lines
662 B
TypeScript
import { AxiosInstance } from "axios";
|
|
import { UUID } from "crypto";
|
|
|
|
export type UserIdentityUpdatableProperties = {
|
|
openai_api_key?: string | null;
|
|
};
|
|
|
|
export type UserIdentity = {
|
|
openai_api_key?: string | null;
|
|
user_id: UUID;
|
|
};
|
|
|
|
export const updateUserIdentity = async (
|
|
userUpdatableProperties: UserIdentityUpdatableProperties,
|
|
axiosInstance: AxiosInstance
|
|
): Promise<UserIdentity> =>
|
|
axiosInstance.put(`/user/identity`, userUpdatableProperties);
|
|
|
|
export const getUserIdentity = async (
|
|
axiosInstance: AxiosInstance
|
|
): Promise<UserIdentity> => {
|
|
const { data } = await axiosInstance.get<UserIdentity>(`/user/identity`);
|
|
|
|
return data;
|
|
};
|