Skip to content

Commit 189564d

Browse files
feat: api
1 parent cbc552f commit 189564d

File tree

78 files changed

+395
-274
lines changed

Some content is hidden

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

78 files changed

+395
-274
lines changed

ui/src/api/application/chat-log.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@ import {
1313
import type { pageRequest } from '@/api/type/common'
1414
import type { ApplicationFormType } from '@/api/type/application'
1515
import { type Ref } from 'vue'
16-
17-
const prefix = '/workspace/' + localStorage.getItem('workspace_id') + '/application'
16+
import useStore from '@/stores'
17+
const prefix: any = { _value: '/workspace/' }
18+
Object.defineProperty(prefix, 'value', {
19+
get: function () {
20+
const { user } = useStore()
21+
return this._value + user.getWorkspaceId() + '/application'
22+
},
23+
})
1824
/**
1925
* 对话记录提交至知识库
2026
* @param data
@@ -28,7 +34,7 @@ const postChatLogAddKnowledge: (
2834
data: any,
2935
loading?: Ref<boolean>,
3036
) => Promise<Result<any>> = (application_id, data, loading) => {
31-
return post(`${prefix}/${application_id}/add_knowledge`, data, undefined, loading)
37+
return post(`${prefix.value}/${application_id}/add_knowledge`, data, undefined, loading)
3238
}
3339

3440
/**
@@ -47,7 +53,7 @@ const getChatLog: (
4753
loading?: Ref<boolean>,
4854
) => Promise<Result<any>> = (application_id, page, param, loading) => {
4955
return get(
50-
`${prefix}/${application_id}/chat/${page.current_page}/${page.page_size}`,
56+
`${prefix.value}/${application_id}/chat/${page.current_page}/${page.page_size}`,
5157
param,
5258
loading,
5359
)
@@ -66,7 +72,7 @@ const getChatRecordLog: (
6672
order_asc?: boolean,
6773
) => Promise<Result<any>> = (application_id, chart_id, page, loading, order_asc) => {
6874
return get(
69-
`${prefix}/${application_id}/chat/${chart_id}/chat_record/${page.current_page}/${page.page_size}`,
75+
`${prefix.value}/${application_id}/chat/${chart_id}/chat_record/${page.current_page}/${page.page_size}`,
7076
{ order_asc: order_asc !== undefined ? order_asc : true },
7177
loading,
7278
)
@@ -93,7 +99,7 @@ const getMarkChatRecord: (
9399
loading,
94100
) => {
95101
return get(
96-
`${prefix}/${application_id}/chat/${chart_id}/chat_record/${chart_record_id}/knowledge/${knowledge_id}/document/${document_id}/improve`,
102+
`${prefix.value}/${application_id}/chat/${chart_id}/chat_record/${chart_record_id}/knowledge/${knowledge_id}/document/${document_id}/improve`,
97103
undefined,
98104
loading,
99105
)
@@ -127,7 +133,7 @@ const putChatRecordLog: (
127133
loading,
128134
) => {
129135
return put(
130-
`${prefix}/${application_id}/chat/${chart_id}/chat_record/${chart_record_id}/knowledge/${knowledge_id}/document/${document_id}/improve`,
136+
`${prefix.value}/${application_id}/chat/${chart_id}/chat_record/${chart_record_id}/knowledge/${knowledge_id}/document/${document_id}/improve`,
131137
data,
132138
undefined,
133139
loading,
@@ -157,7 +163,7 @@ const delMarkChatRecord: (
157163
loading,
158164
) => {
159165
return del(
160-
`${prefix}/${application_id}/chat/${chart_id}/chat_record/${chart_record_id}/knowledge/${knowledge_id}/document/${document_id}/paragraph/${paragraph_id}/improve`,
166+
`${prefix.value}/${application_id}/chat/${chart_id}/chat_record/${chart_record_id}/knowledge/${knowledge_id}/document/${document_id}/paragraph/${paragraph_id}/improve`,
161167
undefined,
162168
{},
163169
loading,
@@ -182,7 +188,7 @@ const postExportChatLog: (
182188
) => void = (application_id, application_name, param, data, loading) => {
183189
exportExcelPost(
184190
application_name + '.xlsx',
185-
`${prefix}/${application_id}/chat/export`,
191+
`${prefix.value}/${application_id}/chat/export`,
186192
param,
187193
data,
188194
loading,
@@ -195,7 +201,7 @@ const getChatRecordDetails: (
195201
loading?: Ref<boolean>,
196202
) => Promise<any> = (application_id, chat_id, chat_record_id, loading) => {
197203
return get(
198-
`${prefix}/${application_id}/chat/${chat_id}/chat_record/${chat_record_id}`,
204+
`${prefix.value}/${application_id}/chat/${chat_id}/chat_record/${chat_record_id}`,
199205
{},
200206
loading,
201207
)

ui/src/api/application/work-flow-version.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@ import { Result } from '@/request/Result'
22
import { get, put } from '@/request/index'
33
import { type Ref } from 'vue'
44

5-
const prefix = '/workspace/' + localStorage.getItem('workspace_id') + '/application'
5+
import useStore from '@/stores'
6+
const prefix: any = { _value: '/workspace/' }
7+
Object.defineProperty(prefix, 'value', {
8+
get: function () {
9+
const { user } = useStore()
10+
return this._value + user.getWorkspaceId() + '/application'
11+
},
12+
})
613

714
/**
815
* workflow历史版本
@@ -11,7 +18,7 @@ const getWorkFlowVersion: (
1118
application_id: string,
1219
loading?: Ref<boolean>,
1320
) => Promise<Result<any>> = (application_id, loading) => {
14-
return get(`${prefix}/${application_id}/work_flow_version`, undefined, loading)
21+
return get(`${prefix.value}/${application_id}/work_flow_version`, undefined, loading)
1522
}
1623

1724
/**
@@ -23,7 +30,7 @@ const getWorkFlowVersionDetail: (
2330
loading?: Ref<boolean>,
2431
) => Promise<Result<any>> = (application_id, application_version_id, loading) => {
2532
return get(
26-
`${prefix}/${application_id}/work_flow_version/${application_version_id}`,
33+
`${prefix.value}/${application_id}/work_flow_version/${application_version_id}`,
2734
undefined,
2835
loading,
2936
)
@@ -38,7 +45,7 @@ const putWorkFlowVersion: (
3845
loading?: Ref<boolean>,
3946
) => Promise<Result<any>> = (application_id, application_version_id, data, loading) => {
4047
return put(
41-
`${prefix}/${application_id}/work_flow_version/${application_version_id}`,
48+
`${prefix.value}/${application_id}/work_flow_version/${application_version_id}`,
4249
data,
4350
undefined,
4451
loading,

ui/src/api/chat/chat.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@ import {
1212

1313
import { type Ref } from 'vue'
1414

15-
const prefix = '/workspace/' + localStorage.getItem('workspace_id') + '/application'
15+
import useStore from '@/stores'
16+
const prefix: any = { _value: '/workspace/' }
17+
Object.defineProperty(prefix, 'value', {
18+
get: function () {
19+
const { user } = useStore()
20+
return this._value + user.getWorkspaceId() + '/application'
21+
},
22+
})
1623

1724
/**
1825
* 打开调试对话id
@@ -24,7 +31,7 @@ const open: (application_id: string, loading?: Ref<boolean>) => Promise<Result<s
2431
application_id,
2532
loading,
2633
) => {
27-
return get(`${prefix}/${application_id}/open`, {}, loading)
34+
return get(`${prefix.value}/${application_id}/open`, {}, loading)
2835
}
2936
/**
3037
* 对话

ui/src/api/folder.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
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'
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'
55

6-
const prefix = '/workspace/' + localStorage.getItem('workspace_id')
6+
import useStore from '@/stores'
7+
const prefix: any = { _value: '/workspace/' }
8+
Object.defineProperty(prefix, 'value', {
9+
get: function () {
10+
const { user } = useStore()
11+
return this._value + user.getWorkspaceId()
12+
},
13+
})
714

815
/**
916
* 获得文件夹列表
@@ -16,7 +23,7 @@ const getFolder: (
1623
data?: any,
1724
loading?: Ref<boolean>,
1825
) => Promise<Result<Array<any>>> = (source, data, loading) => {
19-
return get(`${prefix}/${source}/folder`, data, loading)
26+
return get(`${prefix.value}/${source}/folder`, data, loading)
2027
}
2128

2229
/**
@@ -34,7 +41,7 @@ const postFolder: (
3441
data?: any,
3542
loading?: Ref<boolean>,
3643
) => Promise<Result<Array<any>>> = (source, data, loading) => {
37-
return post(`${prefix}/${source}/folder`, data, loading)
44+
return post(`${prefix.value}/${source}/folder`, data, loading)
3845
}
3946

4047
export default {

0 commit comments

Comments
 (0)