1- import { Result } from '@/request/Result'
2- import { get , post , postStream , del , put , request , download , exportFile } from '@/request/index'
3- import type { pageRequest } from '@/api/type/common'
4- import type { ApplicationFormType } from '@/api/type/application'
5- import { type Ref } from 'vue'
1+ import { Result } from '@/request/Result'
2+ import { get , post , postStream , del , put , request , download , exportFile } from '@/request/index'
3+ import type { pageRequest } from '@/api/type/common'
4+ import type { ApplicationFormType } from '@/api/type/application'
5+ import { type Ref } from 'vue'
66
77const prefix = '/system/resource/application'
88
9- /**
10- * 获取全部应用
11- * @param 参数
12- */
13- const getAllApplication : ( param ?: any , loading ?: Ref < boolean > ) => Promise < Result < any [ ] > > = (
14- param ,
15- loading ,
16- ) => {
17- return get ( `${ prefix } ` , param , loading )
18- }
199
2010/**
2111 * 获取分页应用
@@ -31,17 +21,6 @@ const getApplication: (
3121 return get ( `${ prefix } /${ page . current_page } /${ page . page_size } ` , param , loading )
3222}
3323
34- /**
35- * 创建应用
36- * @param 参数
37- */
38- const postApplication : (
39- data : ApplicationFormType ,
40- loading ?: Ref < boolean > ,
41- ) => Promise < Result < any > > = ( data , loading ) => {
42- return post ( `${ prefix } ` , data , undefined , loading )
43- }
44-
4524/**
4625 * 修改应用
4726 * @param 参数
@@ -86,19 +65,6 @@ const getAccessToken: (application_id: string, loading?: Ref<boolean>) => Promis
8665) => {
8766 return get ( `${ prefix } /${ application_id } /access_token` , undefined , loading )
8867}
89- /**
90- * 获取应用设置
91- * @param application_id 应用id
92- * @param loading 加载器
93- * @returns
94- */
95- const getApplicationSetting : (
96- application_id : string ,
97- loading ?: Ref < boolean > ,
98- ) => Promise < Result < any > > = ( application_id , loading ) => {
99- return get ( `${ prefix } /${ application_id } /setting` , undefined , loading )
100- }
101-
10268/**
10369 * 修改AccessToken
10470 * @param 参数 application_id
@@ -115,55 +81,119 @@ const putAccessToken: (
11581}
11682
11783/**
118- * 导出应用
84+ * 统计
85+ * @param 参数 application_id, data
11986 */
120-
121- const exportApplication = (
87+ const getStatistics : (
12288 application_id : string ,
123- application_name : string ,
89+ data : any ,
12490 loading ?: Ref < boolean > ,
91+ ) => Promise < Result < any > > = ( application_id , data , loading ) => {
92+ return get ( `${ prefix } /${ application_id } /application_stats` , data , loading )
93+ }
94+ /**
95+ * 打开调试对话id
96+ * @param application_id 应用id
97+ * @param loading 加载器
98+ * @returns
99+ */
100+ const open : ( application_id : string , loading ?: Ref < boolean > ) => Promise < Result < string > > = (
101+ application_id ,
102+ loading ,
125103) => {
126- return exportFile (
127- application_name + '.mk' ,
128- `${ prefix } /${ application_id } /export` ,
129- undefined ,
130- loading ,
131- )
104+ return get ( `${ prefix } /${ application_id } /open` , { } , loading )
132105}
133106
134107/**
135- * 导入应用
108+ * 应用发布
109+ * @param application_id
110+ * @param loading
111+ * @returns
136112 */
137- const importApplication : ( data : any , loading ?: Ref < boolean > ) => Promise < Result < any > > = (
113+ const publish : (
114+ application_id : string ,
115+ data : any ,
116+ loading ?: Ref < boolean > ,
117+ ) => Promise < Result < any > > = ( application_id , data , loading ) => {
118+ return put ( `${ prefix } /${ application_id } /publish` , data , { } , loading )
119+ }
120+
121+ /**
122+ *
123+ * @param application_id
124+ * @param data
125+ * @param loading
126+ * @returns
127+ */
128+ const playDemoText : ( application_id : string , data : any , loading ?: Ref < boolean > ) => Promise < any > = (
129+ application_id ,
138130 data ,
139131 loading ,
140132) => {
141- return post ( `${ prefix } /import` , data , undefined , loading )
133+ return download ( `${ prefix } /${ application_id } /play_demo_text` , 'post' , data , undefined , loading )
142134}
143135
144136/**
145- * 统计
146- * @param 参数 application_id, data
137+ * 文本转语音
147138 */
148- const getStatistics : (
149- application_id : string ,
139+ const postTextToSpeech : (
140+ application_id : String ,
150141 data : any ,
151142 loading ?: Ref < boolean > ,
152143) => Promise < Result < any > > = ( application_id , data , loading ) => {
153- return get ( `${ prefix } /${ application_id } /application_stats ` , data , loading )
144+ return download ( `${ prefix } /${ application_id } /text_to_speech ` , 'post' , data , undefined , loading )
154145}
155146/**
156- * 打开调试对话id
147+ * 语音转文本
148+ */
149+ const speechToText : (
150+ application_id : String ,
151+ data : any ,
152+ loading ?: Ref < boolean > ,
153+ ) => Promise < Result < any > > = ( application_id , data , loading ) => {
154+ return post ( `${ prefix } /${ application_id } /speech_to_text` , data , undefined , loading )
155+ }
156+
157+ /**
158+ * 获取应用设置
157159 * @param application_id 应用id
158160 * @param loading 加载器
159161 * @returns
160162 */
161- const open : ( application_id : string , loading ?: Ref < boolean > ) => Promise < Result < string > > = (
162- application_id ,
163+ const getApplicationSetting : (
164+ application_id : string ,
165+ loading ?: Ref < boolean > ,
166+ ) => Promise < Result < any > > = ( application_id , loading ) => {
167+ return get ( `${ prefix } /${ application_id } /setting` , undefined , loading )
168+ }
169+
170+ /**
171+ * 导出应用
172+ */
173+
174+ const exportApplication = (
175+ application_id : string ,
176+ application_name : string ,
177+ loading ?: Ref < boolean > ,
178+ ) => {
179+ return exportFile (
180+ application_name + '.mk' ,
181+ `${ prefix } /${ application_id } /export` ,
182+ undefined ,
183+ loading ,
184+ )
185+ }
186+
187+ /**
188+ * 导入应用
189+ */
190+ const importApplication : ( data : any , loading ?: Ref < boolean > ) => Promise < Result < any > > = (
191+ data ,
163192 loading ,
164193) => {
165- return get ( `${ prefix } /${ application_id } /open ` , { } , loading )
194+ return post ( `${ prefix } /import ` , data , undefined , loading )
166195}
196+
167197/**
168198 * 对话
169199 * @param 参数
@@ -218,67 +248,6 @@ const updatePlatformConfig: (
218248) => Promise < Result < any > > = ( application_id , type , data , loading ) => {
219249 return post ( `${ prefix } /${ application_id } /platform/${ type } ` , data , undefined , loading )
220250}
221- /**
222- * 应用发布
223- * @param application_id
224- * @param loading
225- * @returns
226- */
227- const publish : (
228- application_id : string ,
229- data : any ,
230- loading ?: Ref < boolean > ,
231- ) => Promise < Result < any > > = ( application_id , data , loading ) => {
232- return put ( `${ prefix } /${ application_id } /publish` , data , { } , loading )
233- }
234-
235- /**
236- *
237- * @param application_id
238- * @param data
239- * @param loading
240- * @returns
241- */
242- const playDemoText : ( application_id : string , data : any , loading ?: Ref < boolean > ) => Promise < any > = (
243- application_id ,
244- data ,
245- loading ,
246- ) => {
247- return download (
248- `${ prefix } /${ application_id } /play_demo_text` ,
249- 'post' ,
250- data ,
251- undefined ,
252- loading ,
253- )
254- }
255-
256- /**
257- * 文本转语音
258- */
259- const postTextToSpeech : (
260- application_id : String ,
261- data : any ,
262- loading ?: Ref < boolean > ,
263- ) => Promise < Result < any > > = ( application_id , data , loading ) => {
264- return download (
265- `${ prefix } /${ application_id } /text_to_speech` ,
266- 'post' ,
267- data ,
268- undefined ,
269- loading ,
270- )
271- }
272- /**
273- * 语音转文本
274- */
275- const speechToText : (
276- application_id : String ,
277- data : any ,
278- loading ?: Ref < boolean > ,
279- ) => Promise < Result < any > > = ( application_id , data , loading ) => {
280- return post ( `${ prefix } /${ application_id } /speech_to_text` , data , undefined , loading )
281- }
282251
283252/**
284253 * mcp 节点
@@ -291,9 +260,7 @@ const getMcpTools: (application_id: String, loading?: Ref<boolean>) => Promise<R
291260}
292261
293262export default {
294- getAllApplication,
295263 getApplication,
296- postApplication,
297264 putApplication,
298265 delApplication,
299266 getApplicationDetail,
0 commit comments