forked from OtterMind/Chat2DB
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.ts
More file actions
91 lines (81 loc) · 2.24 KB
/
Copy pathconfig.ts
File metadata and controls
91 lines (81 loc) · 2.24 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import { IAiConfig } from '@/typings';
import createRequest from './base';
export interface ILatestVersion {
/**
* 桌面
*/
desktop: boolean;
/**
* 新版本
*/
version: string;
/**
* 热更新包地址,可用来判断是否热更新
*/
hotUpgradeUrl: null | string;
/**
* 用户选择的是手动更新还是自动更新
*/
type: 'manual' | 'auto';
/**
* 是否需要更新
*/
needUpdate?: boolean;
/**
* 下载地址
*/
downloadLink?: null | string;
/**
* 更新日志
*/
updateLog?: null | string;
/**
* 白名单,用于测试
*/
whiteList?: null | string;
}
const getSystemConfig = createRequest<{ code: string }, { code: string; content: string }>(
'/api/config/system_config/:code',
{ errorLevel: false },
);
const setSystemConfig = createRequest<{ code: string; content: string }, void>('/api/config/system_config', {
errorLevel: 'toast',
method: 'post',
});
const getAiSystemConfig = createRequest<{ aiSqlSource?: string }, IAiConfig>('/api/config/system_config/ai', {
errorLevel: false,
});
const setAiSystemConfig = createRequest<IAiConfig, void>('/api/config/system_config/ai', {
errorLevel: 'toast',
method: 'post',
});
const getAiWhiteAccess = createRequest<{ apiKey: string }, boolean>('/api/ai/embedding/white/check', {
method: 'get',
});
// 检测仪更新获取最新的版本信息,如果返回结果为null,说明没有更新
const getLatestVersion = createRequest<{ currentVersion: string }, ILatestVersion>('/api/system/get_latest_version', {
method: 'get',
});
// 检测最新的包后端是否下载成功
const isUpdateSuccess = createRequest<{ version: string }, boolean>('/api/system/is_update_success', {
method: 'get',
});
// 告诉后端下载最新的包
const updateDesktopVersion = createRequest<ILatestVersion, boolean>('/api/system/update_desktop_version', {
method: 'post',
});
// 告诉后端下载最新的包
const setAppUpdateType = createRequest<ILatestVersion['type'], boolean>('/api/system/set_update_type', {
method: 'post',
});
export default {
getSystemConfig,
setSystemConfig,
getAiSystemConfig,
setAiSystemConfig,
getAiWhiteAccess,
getLatestVersion,
isUpdateSuccess,
updateDesktopVersion,
setAppUpdateType
};