Skip to content

Commit 867b490

Browse files
authored
Merge pull request #116 from guanweiwang/main
feat: 添加用户界面
2 parents bdfa4f8 + 4c3864f commit 867b490

File tree

18 files changed

+510
-102
lines changed

18 files changed

+510
-102
lines changed

ui/api-templates/http-client.ejs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ export enum ContentType {
4040
const redirectToLogin = () => {
4141
const redirectAfterLogin = encodeURIComponent(location.href);
4242
const search = `redirect=${redirectAfterLogin}`;
43-
const pathname = '/login';
43+
const pathname = location.pathname.startsWith('/user')
44+
? '/user/login'
45+
: '/login';
4446
window.location.href = `${pathname}?${search}`;
4547
};
4648

ui/src/api/UserDashboard.ts

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/* eslint-disable */
2+
/* tslint:disable */
3+
// @ts-nocheck
4+
/*
5+
* ---------------------------------------------------------------
6+
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
7+
* ## ##
8+
* ## AUTHOR: acacode ##
9+
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
10+
* ---------------------------------------------------------------
11+
*/
12+
13+
import request, { ContentType, RequestParams } from "./httpClient";
14+
import {
15+
DomainUserEvent,
16+
DomainUserHeatmapResp,
17+
DomainUserStat,
18+
GetUserDashboardEventsParams,
19+
GetUserDashboardStatParams,
20+
WebResp,
21+
} from "./types";
22+
23+
/**
24+
* @description 获取用户事件
25+
*
26+
* @tags User Dashboard
27+
* @name GetUserDashboardEvents
28+
* @summary 获取用户事件
29+
* @request GET:/api/v1/user/dashboard/events
30+
* @response `200` `(WebResp & {
31+
data?: (DomainUserEvent)[],
32+
33+
})` OK
34+
* @response `401` `string` Unauthorized
35+
*/
36+
37+
export const getUserDashboardEvents = (
38+
query: GetUserDashboardEventsParams,
39+
params: RequestParams = {},
40+
) =>
41+
request<
42+
WebResp & {
43+
data?: DomainUserEvent[];
44+
}
45+
>({
46+
path: `/api/v1/user/dashboard/events`,
47+
method: "GET",
48+
query: query,
49+
type: ContentType.Json,
50+
format: "json",
51+
...params,
52+
});
53+
54+
/**
55+
* @description 用户热力图
56+
*
57+
* @tags User Dashboard
58+
* @name GetUserDashboardHeatmap
59+
* @summary 用户热力图
60+
* @request GET:/api/v1/user/dashboard/heatmap
61+
* @response `200` `(WebResp & {
62+
data?: DomainUserHeatmapResp,
63+
64+
})` OK
65+
* @response `401` `string` Unauthorized
66+
*/
67+
68+
export const getUserDashboardHeatmap = (params: RequestParams = {}) =>
69+
request<
70+
WebResp & {
71+
data?: DomainUserHeatmapResp;
72+
}
73+
>({
74+
path: `/api/v1/user/dashboard/heatmap`,
75+
method: "GET",
76+
type: ContentType.Json,
77+
format: "json",
78+
...params,
79+
});
80+
81+
/**
82+
* @description 获取用户统计信息
83+
*
84+
* @tags User Dashboard
85+
* @name GetUserDashboardStat
86+
* @summary 获取用户统计信息
87+
* @request GET:/api/v1/user/dashboard/stat
88+
* @response `200` `(WebResp & {
89+
data?: DomainUserStat,
90+
91+
})` OK
92+
* @response `401` `string` Unauthorized
93+
*/
94+
95+
export const getUserDashboardStat = (
96+
query: GetUserDashboardStatParams,
97+
params: RequestParams = {},
98+
) =>
99+
request<
100+
WebResp & {
101+
data?: DomainUserStat;
102+
}
103+
>({
104+
path: `/api/v1/user/dashboard/stat`,
105+
method: "GET",
106+
query: query,
107+
type: ContentType.Json,
108+
format: "json",
109+
...params,
110+
});

ui/src/api/UserManage.ts

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/* eslint-disable */
2+
/* tslint:disable */
3+
// @ts-nocheck
4+
/*
5+
* ---------------------------------------------------------------
6+
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
7+
* ## ##
8+
* ## AUTHOR: acacode ##
9+
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
10+
* ---------------------------------------------------------------
11+
*/
12+
13+
import request, { ContentType, RequestParams } from "./httpClient";
14+
import { DomainProfileUpdateReq, DomainUser, WebResp } from "./types";
15+
16+
/**
17+
* @description 获取用户信息
18+
*
19+
* @tags User Manage
20+
* @name GetUserProfile
21+
* @summary 获取用户信息
22+
* @request GET:/api/v1/user/profile
23+
* @response `200` `(WebResp & {
24+
data?: DomainUser,
25+
26+
})` OK
27+
* @response `401` `WebResp` Unauthorized
28+
*/
29+
30+
export const getUserProfile = (params: RequestParams = {}) =>
31+
request<
32+
WebResp & {
33+
data?: DomainUser;
34+
}
35+
>({
36+
path: `/api/v1/user/profile`,
37+
method: "GET",
38+
type: ContentType.Json,
39+
format: "json",
40+
...params,
41+
});
42+
43+
/**
44+
* @description 更新用户信息
45+
*
46+
* @tags User Manage
47+
* @name PutUserUpdateProfile
48+
* @summary 更新用户信息
49+
* @request PUT:/api/v1/user/profile
50+
* @response `200` `(WebResp & {
51+
data?: DomainUser,
52+
53+
})` OK
54+
* @response `401` `WebResp` Unauthorized
55+
*/
56+
57+
export const putUserUpdateProfile = (
58+
req: DomainProfileUpdateReq,
59+
params: RequestParams = {},
60+
) =>
61+
request<
62+
WebResp & {
63+
data?: DomainUser;
64+
}
65+
>({
66+
path: `/api/v1/user/profile`,
67+
method: "PUT",
68+
body: req,
69+
type: ContentType.Json,
70+
format: "json",
71+
...params,
72+
});

ui/src/api/UserRecord.ts

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
/* eslint-disable */
2+
/* tslint:disable */
3+
// @ts-nocheck
4+
/*
5+
* ---------------------------------------------------------------
6+
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
7+
* ## ##
8+
* ## AUTHOR: acacode ##
9+
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
10+
* ---------------------------------------------------------------
11+
*/
12+
13+
import request, { ContentType, RequestParams } from "./httpClient";
14+
import {
15+
DomainChatInfo,
16+
DomainCompletionInfo,
17+
DomainListChatRecordResp,
18+
DomainListCompletionRecordResp,
19+
GetUserChatInfoParams,
20+
GetUserCompletionInfoParams,
21+
GetUserListChatRecordParams,
22+
GetUserListCompletionRecordParams,
23+
WebResp,
24+
} from "./types";
25+
26+
/**
27+
* @description 获取对话内容
28+
*
29+
* @tags User Record
30+
* @name GetUserChatInfo
31+
* @summary 获取对话内容
32+
* @request GET:/api/v1/user/chat/info
33+
* @response `200` `(WebResp & {
34+
data?: DomainChatInfo,
35+
36+
})` OK
37+
* @response `401` `string` Unauthorized
38+
*/
39+
40+
export const getUserChatInfo = (
41+
query: GetUserChatInfoParams,
42+
params: RequestParams = {},
43+
) =>
44+
request<
45+
WebResp & {
46+
data?: DomainChatInfo;
47+
}
48+
>({
49+
path: `/api/v1/user/chat/info`,
50+
method: "GET",
51+
query: query,
52+
type: ContentType.Json,
53+
format: "json",
54+
...params,
55+
});
56+
57+
/**
58+
* @description 获取用户对话记录
59+
*
60+
* @tags User Record
61+
* @name GetUserListChatRecord
62+
* @summary 获取用户对话记录
63+
* @request GET:/api/v1/user/chat/record
64+
* @response `200` `(WebResp & {
65+
data?: DomainListChatRecordResp,
66+
67+
})` OK
68+
* @response `401` `string` Unauthorized
69+
*/
70+
71+
export const getUserListChatRecord = (
72+
query: GetUserListChatRecordParams,
73+
params: RequestParams = {},
74+
) =>
75+
request<
76+
WebResp & {
77+
data?: DomainListChatRecordResp;
78+
}
79+
>({
80+
path: `/api/v1/user/chat/record`,
81+
method: "GET",
82+
query: query,
83+
type: ContentType.Json,
84+
format: "json",
85+
...params,
86+
});
87+
88+
/**
89+
* @description 获取补全内容
90+
*
91+
* @tags User Record
92+
* @name GetUserCompletionInfo
93+
* @summary 获取补全内容
94+
* @request GET:/api/v1/user/completion/info
95+
* @response `200` `(WebResp & {
96+
data?: DomainCompletionInfo,
97+
98+
})` OK
99+
* @response `401` `string` Unauthorized
100+
*/
101+
102+
export const getUserCompletionInfo = (
103+
query: GetUserCompletionInfoParams,
104+
params: RequestParams = {},
105+
) =>
106+
request<
107+
WebResp & {
108+
data?: DomainCompletionInfo;
109+
}
110+
>({
111+
path: `/api/v1/user/completion/info`,
112+
method: "GET",
113+
query: query,
114+
type: ContentType.Json,
115+
format: "json",
116+
...params,
117+
});
118+
119+
/**
120+
* @description 获取补全记录
121+
*
122+
* @tags User Record
123+
* @name GetUserListCompletionRecord
124+
* @summary 获取补全记录
125+
* @request GET:/api/v1/user/completion/record
126+
* @response `200` `(WebResp & {
127+
data?: DomainListCompletionRecordResp,
128+
129+
})` OK
130+
* @response `401` `string` Unauthorized
131+
*/
132+
133+
export const getUserListCompletionRecord = (
134+
query: GetUserListCompletionRecordParams,
135+
params: RequestParams = {},
136+
) =>
137+
request<
138+
WebResp & {
139+
data?: DomainListCompletionRecordResp;
140+
}
141+
>({
142+
path: `/api/v1/user/completion/record`,
143+
method: "GET",
144+
query: query,
145+
type: ContentType.Json,
146+
format: "json",
147+
...params,
148+
});

ui/src/api/httpClient.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ export enum ContentType {
6161
const redirectToLogin = () => {
6262
const redirectAfterLogin = encodeURIComponent(location.href);
6363
const search = `redirect=${redirectAfterLogin}`;
64-
const pathname = "/login";
64+
const pathname = location.pathname.startsWith("/user")
65+
? "/user/login"
66+
: "/login";
6567
window.location.href = `${pathname}?${search}`;
6668
};
6769

ui/src/api/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@ export * from './Dashboard'
44
export * from './Model'
55
export * from './OpenAiv1'
66
export * from './User'
7+
export * from './UserDashboard'
8+
export * from './UserManage'
9+
export * from './UserRecord'
710
export * from './types'
811

0 commit comments

Comments
 (0)