mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: add getFile function to retrieve file URLs in application and chat modules
This commit is contained in:
parent
b664ab571f
commit
3e1d34b83d
|
|
@ -401,6 +401,10 @@ const postUploadFile: (
|
|||
return post(`/oss/file`, fd, undefined, loading)
|
||||
}
|
||||
|
||||
|
||||
const getFile: (application_id: string, params: any) => Promise<Result<any>> = (application_id, params) => {
|
||||
return get(`/oss/get_url/${application_id}`, params)
|
||||
}
|
||||
export default {
|
||||
getAllApplication,
|
||||
getApplication,
|
||||
|
|
@ -430,5 +434,6 @@ export default {
|
|||
postUploadFile,
|
||||
generate_prompt,
|
||||
getTokenUsage,
|
||||
topQuestions
|
||||
topQuestions,
|
||||
getFile
|
||||
}
|
||||
|
|
|
|||
|
|
@ -332,6 +332,10 @@ const postUploadFile: (
|
|||
fd.append('source_type', sourceType)
|
||||
return post(`/oss/file`, fd, undefined, loading)
|
||||
}
|
||||
|
||||
const getFile: (application_id: string, params: any) => Promise<Result<any>> = (application_id, params) => {
|
||||
return get(`/oss/get_url/${application_id}`, params)
|
||||
}
|
||||
export default {
|
||||
open,
|
||||
chat,
|
||||
|
|
@ -362,4 +366,5 @@ export default {
|
|||
clearChat,
|
||||
modifyChat,
|
||||
postUploadFile,
|
||||
getFile
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,10 +10,6 @@ const postImage: (data: any) => Promise<Result<any>> = (data) => {
|
|||
return post(`${prefix}`, data)
|
||||
}
|
||||
|
||||
const getFile: (application_id: string, params: any) => Promise<Result<any>> = (application_id, params) => {
|
||||
return get(`/oss/get_url/${application_id}`, params)
|
||||
}
|
||||
export default {
|
||||
postImage,
|
||||
getFile
|
||||
postImage
|
||||
}
|
||||
|
|
|
|||
|
|
@ -419,7 +419,6 @@ import bus from '@/bus'
|
|||
import 'recorder-core/src/engine/mp3'
|
||||
import 'recorder-core/src/engine/mp3-engine'
|
||||
import chatAPI from '@/api/chat/chat'
|
||||
import imageApi from '@/api/image'
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
|
@ -1238,7 +1237,11 @@ async function saveUrl() {
|
|||
async function processUrl(url: string) {
|
||||
try {
|
||||
const appId = props.appId || props.applicationDetails?.id;
|
||||
const res = await imageApi.getFile(appId, {url})
|
||||
const res =
|
||||
props.type === 'debug-ai-chat'
|
||||
? await applicationApi.getFile(appId, {url})
|
||||
: await chatAPI.getFile(appId, {url})
|
||||
|
||||
if (res.data['status_code'] !== 200) {
|
||||
MsgWarning(url + ' ' + t('chat.uploadFile.invalidUrl'));
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue