mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-01-06 17:28:15 +08:00
(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:
@@ -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;
|
||||
|
||||
@@ -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',
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user