Skip to content

Commit cb4b1c9

Browse files
feat: application
1 parent 4de998d commit cb4b1c9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1090
-505
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import { Result } from '@/request/Result'
2+
import { get, post, del, put } from '@/request/index'
3+
4+
import { type Ref } from 'vue'
5+
6+
const prefix = '/application'
7+
8+
/**
9+
* API_KEY列表
10+
* @param 参数 application_id
11+
*/
12+
const getAPIKey: (application_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = (
13+
application_id,
14+
loading
15+
) => {
16+
return get(`${prefix}/${application_id}/api_key`, undefined, loading)
17+
}
18+
19+
/**
20+
* 新增API_KEY
21+
* @param 参数 application_id
22+
*/
23+
const postAPIKey: (application_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = (
24+
application_id,
25+
loading
26+
) => {
27+
return post(`${prefix}/${application_id}/api_key`, {}, undefined, loading)
28+
}
29+
30+
/**
31+
* 删除API_KEY
32+
* @param 参数 application_id api_key_id
33+
*/
34+
const delAPIKey: (
35+
application_id: String,
36+
api_key_id: String,
37+
loading?: Ref<boolean>
38+
) => Promise<Result<boolean>> = (application_id, api_key_id, loading) => {
39+
return del(`${prefix}/${application_id}/api_key/${api_key_id}`, undefined, undefined, loading)
40+
}
41+
42+
/**
43+
* 修改API_KEY
44+
* @param 参数 application_id,api_key_id
45+
* data {
46+
* is_active: boolean
47+
* }
48+
*/
49+
const putAPIKey: (
50+
application_id: string,
51+
api_key_id: String,
52+
data: any,
53+
loading?: Ref<boolean>
54+
) => Promise<Result<any>> = (application_id, api_key_id, data, loading) => {
55+
return put(`${prefix}/${application_id}/api_key/${api_key_id}`, data, undefined, loading)
56+
}
57+
58+
/**
59+
* 统计
60+
* @param 参数 application_id, data
61+
*/
62+
const getStatistics: (
63+
application_id: string,
64+
data: any,
65+
loading?: Ref<boolean>
66+
) => Promise<Result<any>> = (application_id, data, loading) => {
67+
return get(`${prefix}/${application_id}/statistics/chat_record_aggregate_trend`, data, loading)
68+
}
69+
70+
/**
71+
* 修改应用icon
72+
* @param 参数 application_id
73+
* data: file
74+
*/
75+
const putAppIcon: (
76+
application_id: string,
77+
data: any,
78+
loading?: Ref<boolean>
79+
) => Promise<Result<any>> = (application_id, data, loading) => {
80+
return put(`${prefix}/${application_id}/edit_icon`, data, undefined, loading)
81+
}
82+
83+
export default {
84+
getAPIKey,
85+
postAPIKey,
86+
delAPIKey,
87+
putAPIKey,
88+
getStatistics,
89+
putAppIcon
90+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { Result } from '@/request/Result'
2+
import { get, put } from '@/request/index'
3+
import { type Ref } from 'vue'
4+
5+
const prefix = '/application'
6+
7+
/**
8+
* 替换社区版-获取AccessToken
9+
* @param 参数 application_id
10+
*/
11+
const getAccessToken: (application_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = (
12+
application_id,
13+
loading
14+
) => {
15+
return get(`${prefix}/${application_id}/setting`, undefined, loading)
16+
}
17+
18+
/**
19+
* 替换社区版-修改AccessToken
20+
* @param 参数 application_id
21+
* data {
22+
* "show_source": boolean,
23+
* "show_history": boolean,
24+
* "draggable": boolean,
25+
* "show_guide": boolean,
26+
* "avatar": file,
27+
* "float_icon": file,
28+
* }
29+
*/
30+
const putAccessToken: (
31+
application_id: string,
32+
data: any,
33+
loading?: Ref<boolean>
34+
) => Promise<Result<any>> = (application_id, data, loading) => {
35+
return put(`${prefix}/${application_id}/setting`, data, undefined, loading)
36+
}
37+
38+
export default {
39+
getAccessToken,
40+
putAccessToken
41+
}

0 commit comments

Comments
 (0)