Skip to content

Commit 9c20504

Browse files
committed
refactor: ui
1 parent e9d7dec commit 9c20504

File tree

34 files changed

+528
-484
lines changed

34 files changed

+528
-484
lines changed

ui/src/api/application/application.ts

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
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'
6-
import type { FormField } from '@/components/dynamics-form/type'
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'
6+
import type {FormField} from '@/components/dynamics-form/type'
77

8-
const prefix = '/workspace'
8+
const prefix = '/workspace/' + localStorage.getItem('workspace_id') + '/application'
99

1010
/**
1111
* 获取全部应用
1212
* @param 参数
1313
*/
14-
const getAllAppilcation: () => Promise<Result<any[]>> = () => {
14+
const getAllApplication: () => Promise<Result<any[]>> = () => {
1515
return get(`${prefix}`)
1616
}
1717

@@ -22,13 +22,12 @@ const getAllAppilcation: () => Promise<Result<any[]>> = () => {
2222
}
2323
*/
2424
const getApplication: (
25-
wordspace_id: string,
2625
page: pageRequest,
2726
param: any,
2827
loading?: Ref<boolean>,
29-
) => Promise<Result<any>> = (wordspace_id, page, param, loading) => {
28+
) => Promise<Result<any>> = (page, param, loading) => {
3029
return get(
31-
`${prefix}/${wordspace_id}/application/${page.current_page}/${page.page_size}`,
30+
`${prefix}/${page.current_page}/${page.page_size}`,
3231
param,
3332
loading,
3433
)
@@ -39,11 +38,10 @@ const getApplication: (
3938
* @param 参数
4039
*/
4140
const postApplication: (
42-
wordspace_id: string,
4341
data: ApplicationFormType,
4442
loading?: Ref<boolean>,
45-
) => Promise<Result<any>> = (wordspace_id, data, loading) => {
46-
return post(`${prefix}/${wordspace_id}/application`, data, undefined, loading)
43+
) => Promise<Result<any>> = (data, loading) => {
44+
return post(`${prefix}`, data, undefined, loading)
4745
}
4846

4947
/**
@@ -131,7 +129,7 @@ const postAppAuthentication: (
131129
) => Promise<any> = (access_token, loading, authentication_value) => {
132130
return post(
133131
`${prefix}/authentication`,
134-
{ access_token: access_token, authentication_value },
132+
{access_token: access_token, authentication_value},
135133
undefined,
136134
loading,
137135
)
@@ -257,7 +255,7 @@ const getApplicationRerankerModel: (
257255
application_id: string,
258256
loading?: Ref<boolean>,
259257
) => Promise<Result<Array<any>>> = (application_id, loading) => {
260-
return get(`${prefix}/${application_id}/model`, { model_type: 'RERANKER' }, loading)
258+
return get(`${prefix}/${application_id}/model`, {model_type: 'RERANKER'}, loading)
261259
}
262260

263261
/**
@@ -271,7 +269,7 @@ const getApplicationSTTModel: (
271269
application_id: string,
272270
loading?: Ref<boolean>,
273271
) => Promise<Result<Array<any>>> = (application_id, loading) => {
274-
return get(`${prefix}/${application_id}/model`, { model_type: 'STT' }, loading)
272+
return get(`${prefix}/${application_id}/model`, {model_type: 'STT'}, loading)
275273
}
276274

277275
/**
@@ -285,21 +283,21 @@ const getApplicationTTSModel: (
285283
application_id: string,
286284
loading?: Ref<boolean>,
287285
) => Promise<Result<Array<any>>> = (application_id, loading) => {
288-
return get(`${prefix}/${application_id}/model`, { model_type: 'TTS' }, loading)
286+
return get(`${prefix}/${application_id}/model`, {model_type: 'TTS'}, loading)
289287
}
290288

291289
const getApplicationImageModel: (
292290
application_id: string,
293291
loading?: Ref<boolean>,
294292
) => Promise<Result<Array<any>>> = (application_id, loading) => {
295-
return get(`${prefix}/${application_id}/model`, { model_type: 'IMAGE' }, loading)
293+
return get(`${prefix}/${application_id}/model`, {model_type: 'IMAGE'}, loading)
296294
}
297295

298296
const getApplicationTTIModel: (
299297
application_id: string,
300298
loading?: Ref<boolean>,
301299
) => Promise<Result<Array<any>>> = (application_id, loading) => {
302-
return get(`${prefix}/${application_id}/model`, { model_type: 'TTI' }, loading)
300+
return get(`${prefix}/${application_id}/model`, {model_type: 'TTI'}, loading)
303301
}
304302

305303
/**
@@ -542,7 +540,7 @@ const importApplication: (data: any, loading?: Ref<boolean>) => Promise<Result<a
542540
return post(`${prefix}/import`, data, undefined, loading)
543541
}
544542
export default {
545-
getAllAppilcation,
543+
getAllAppilcation: getAllApplication,
546544
getApplication,
547545
postApplication,
548546
putApplication,

ui/src/api/folder.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { Result } from '@/request/Result'
2-
import { get, post, del, put } from '@/request/index'
3-
import { type Ref } from 'vue'
4-
import type { pageRequest } from '@/api/type/common'
5-
const prefix = '/workspace'
1+
import {Result} from '@/request/Result'
2+
import {get, post, del, put} from '@/request/index'
3+
import {type Ref} from 'vue'
4+
import type {pageRequest} from '@/api/type/common'
5+
6+
const prefix = '/workspace/' + localStorage.getItem('workspace_id')
67

78
/**
89
* 获得文件夹列表
@@ -11,31 +12,29 @@ const prefix = '/workspace'
1112
* data : {name: string}
1213
*/
1314
const getFolder: (
14-
wordspace_id: string,
1515
source: string,
1616
data?: any,
1717
loading?: Ref<boolean>,
18-
) => Promise<Result<Array<any>>> = (wordspace_id, source, data, loading) => {
19-
return get(`${prefix}/${wordspace_id}/${source}/folder`, data, loading)
18+
) => Promise<Result<Array<any>>> = (source, data, loading) => {
19+
return get(`${prefix}/${source}/folder`, data, loading)
2020
}
2121

2222
/**
2323
* 添加文件夹
2424
* @params 参数
2525
* source : APPLICATION, KNOWLEDGE, TOOL
26-
{
27-
"name": "string",
28-
"desc": "string",
29-
"parent_id": "root"
30-
}
26+
{
27+
"name": "string",
28+
"desc": "string",
29+
"parent_id": "root"
30+
}
3131
*/
3232
const postFolder: (
33-
wordspace_id: string,
3433
source: string,
3534
data?: any,
3635
loading?: Ref<boolean>,
37-
) => Promise<Result<Array<any>>> = (wordspace_id, source, data, loading) => {
38-
return post(`${prefix}/${wordspace_id}/${source}/folder`, data, loading)
36+
) => Promise<Result<Array<any>>> = (source, data, loading) => {
37+
return post(`${prefix}/${source}/folder`, data, loading)
3938
}
4039

4140
export default {

ui/src/api/knowledge/document.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { Result } from '@/request/Result'
2-
import { get, post, del, put, exportExcel, exportFile } from '@/request/index'
3-
import type { Ref } from 'vue'
4-
import type { KeyValue } from '@/api/type/common'
5-
import type { pageRequest } from '@/api/type/common'
1+
import {Result} from '@/request/Result'
2+
import {get, post, del, put, exportExcel, exportFile} from '@/request/index'
3+
import type {Ref} from 'vue'
4+
import type {KeyValue} from '@/api/type/common'
5+
import type {pageRequest} from '@/api/type/common'
66

7-
const prefix = '/workspace'
7+
const prefix = '/workspace/' + localStorage.getItem('workspace_id') + '/knowledge'
88

99
/**
1010
* 文档分页列表
@@ -19,14 +19,13 @@ const prefix = '/workspace'
1919
*/
2020

2121
const getDocument: (
22-
wordspace_id: string,
2322
knowledge_id: string,
2423
page: pageRequest,
2524
param: any,
2625
loading?: Ref<boolean>,
27-
) => Promise<Result<any>> = (wordspace_id, knowledge_id, page, param, loading) => {
26+
) => Promise<Result<any>> = (knowledge_id, page, param, loading) => {
2827
return get(
29-
`${prefix}/${wordspace_id}/knowledge/${knowledge_id}/document/${page.current_page}/${page.page_size}`,
28+
`${prefix}/${knowledge_id}/document/${page.current_page}/${page.page_size}`,
3029
param,
3130
loading,
3231
)
@@ -124,7 +123,7 @@ const delMulDocument: (
124123
data: any,
125124
loading?: Ref<boolean>,
126125
) => Promise<Result<boolean>> = (dataset_id, data, loading) => {
127-
return del(`${prefix}/${dataset_id}/document/_bach`, undefined, { id_list: data }, loading)
126+
return del(`${prefix}/${dataset_id}/document/_bach`, undefined, {id_list: data}, loading)
128127
}
129128

130129
const batchRefresh: (
@@ -135,7 +134,7 @@ const batchRefresh: (
135134
) => Promise<Result<boolean>> = (dataset_id, data, stateList, loading) => {
136135
return put(
137136
`${prefix}/${dataset_id}/document/batch_refresh`,
138-
{ id_list: data, state_list: stateList },
137+
{id_list: data, state_list: stateList},
139138
undefined,
140139
loading,
141140
)
@@ -164,7 +163,7 @@ const putDocumentRefresh: (
164163
) => Promise<Result<any>> = (dataset_id, document_id, state_list, loading) => {
165164
return put(
166165
`${prefix}/${dataset_id}/document/${document_id}/refresh`,
167-
{ state_list },
166+
{state_list},
168167
undefined,
169168
loading,
170169
)
@@ -204,14 +203,14 @@ const delMulSyncDocument: (
204203
data: any,
205204
loading?: Ref<boolean>,
206205
) => Promise<Result<boolean>> = (dataset_id, data, loading) => {
207-
return put(`${prefix}/${dataset_id}/document/_bach`, { id_list: data }, undefined, loading)
206+
return put(`${prefix}/${dataset_id}/document/_bach`, {id_list: data}, undefined, loading)
208207
}
209208
const delMulLarkSyncDocument: (
210209
dataset_id: string,
211210
data: any,
212211
loading?: Ref<boolean>,
213212
) => Promise<Result<boolean>> = (dataset_id, data, loading) => {
214-
return put(`${prefix}/lark/${dataset_id}/_batch`, { id_list: data }, undefined, loading)
213+
return put(`${prefix}/lark/${dataset_id}/_batch`, {id_list: data}, undefined, loading)
215214
}
216215

217216
/**
@@ -302,7 +301,7 @@ const exportQATemplate: (fileName: string, type: string, loading?: Ref<boolean>)
302301
type,
303302
loading,
304303
) => {
305-
return exportExcel(fileName, `${prefix}/document/template/export`, { type }, loading)
304+
return exportExcel(fileName, `${prefix}/document/template/export`, {type}, loading)
306305
}
307306

308307
/**
@@ -314,7 +313,7 @@ const exportTableTemplate: (fileName: string, type: string, loading?: Ref<boolea
314313
type,
315314
loading,
316315
) => {
317-
return exportExcel(fileName, `${prefix}/document/table_template/export`, { type }, loading)
316+
return exportExcel(fileName, `${prefix}/document/table_template/export`, {type}, loading)
318317
}
319318

320319
/**

0 commit comments

Comments
 (0)