(feat)Support for managing large models with Dify #1830;2、add user access token; #1829; 3、support change password #1824 (#1839)

This commit is contained in:
zhaodongsheng
2024-10-22 13:58:58 +08:00
committed by GitHub
parent bdb20ca462
commit 0ddcdf93ec
34 changed files with 1341 additions and 45 deletions

View File

@@ -23,6 +23,23 @@ declare namespace API {
access?: 'user' | 'guest' | 'admin';
};
export interface UserItem {
id: number;
name: string;
displayName: string;
email: string;
}
export interface UserAccessToken {
createDate: string;
expireDate: string;
expireTime: number;
id: number;
name: string;
token: string;
userName: string;
}
export type LoginStateType = {
status?: 'ok' | 'error';
type?: string;

View File

@@ -20,3 +20,31 @@ export function saveSystemConfig(data: any): Promise<any> {
data,
});
}
export function changePassword(data: { newPassword: string; oldPassword: string }): Promise<any> {
return request(`${process.env.AUTH_API_BASE_URL}user/resetPassword`, {
method: 'post',
data: {
newPassword: data.newPassword,
password: data.oldPassword,
},
});
}
// 获取用户accessTokens
export async function getUserAccessTokens(): Promise<Result<API.UserItem[]>> {
return request.get(`${process.env.AUTH_API_BASE_URL}user/getUserTokens`);
}
export function generateAccessToken(data: { expireTime: number; name: string }): Promise<any> {
return request(`${process.env.AUTH_API_BASE_URL}user/generateToken`, {
method: 'post',
data,
});
}
export function removeAccessToken(id: number): Promise<any> {
return request(`${process.env.AUTH_API_BASE_URL}user/deleteUserToken?tokenId=${id}`, {
method: 'post',
});
}