-
Notifications
You must be signed in to change notification settings - Fork 678
/
Copy pathsystem.ts
53 lines (42 loc) · 1.39 KB
/
system.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import axios from 'axios';
import {
AskLogAggregation,
ConfigModel,
CredentialsModel,
LogFilterOptions,
OpenaiWebAccountsCheckResponse,
RequestLogAggregation,
SystemInfo,
} from '@/types/schema';
import ApiUrl from './url';
export function getSystemInfoApi() {
return axios.get<SystemInfo>(ApiUrl.SystemInfo);
}
export function getRequestStatisticsApi(granularity: number) {
return axios.get<RequestLogAggregation[]>(ApiUrl.SystemRequestStatistics, {
params: { granularity },
});
}
export function getAskStatisticsApi(granularity: number) {
return axios.get<AskLogAggregation[]>(ApiUrl.SystemAskStatistics, {
params: { granularity },
});
}
export function getSystemConfig() {
return axios.get<ConfigModel>(ApiUrl.SystemConfig);
}
export function updateSystemConfig(config: ConfigModel) {
return axios.put<ConfigModel>(ApiUrl.SystemConfig, config);
}
export function getSystemCredentials() {
return axios.get<CredentialsModel>(ApiUrl.SystemCredentials);
}
export function updateSystemCredentials(credentials: CredentialsModel) {
return axios.put<CredentialsModel>(ApiUrl.SystemCredentials, credentials);
}
export function runActionSyncOpenaiWebConversations() {
return axios.post(ApiUrl.SystemActionSyncOpenaiWebConversations);
}
export function SystemCheckOpenaiWebAccount() {
return axios.get<OpenaiWebAccountsCheckResponse>(ApiUrl.SystemCheckOpenaiWebAccount);
}