@@ -13,8 +13,14 @@ import {
1313import type { pageRequest } from '@/api/type/common'
1414import type { ApplicationFormType } from '@/api/type/application'
1515import { 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 )
0 commit comments