refactor: file to oss

This commit is contained in:
wxg0103 2025-06-06 12:31:30 +08:00
parent 448bbb3aae
commit 4d76f08b14
39 changed files with 91 additions and 90 deletions

View File

@ -44,11 +44,12 @@ mime_types = {
"dll": "application/octet-stream", "deb": "application/octet-stream", "dmg": "application/octet-stream", "dll": "application/octet-stream", "deb": "application/octet-stream", "dmg": "application/octet-stream",
"iso": "application/octet-stream", "img": "application/octet-stream", "msi": "application/octet-stream", "iso": "application/octet-stream", "img": "application/octet-stream", "msi": "application/octet-stream",
"msp": "application/octet-stream", "msm": "application/octet-stream", "mid": "audio/midi", "msp": "application/octet-stream", "msm": "application/octet-stream", "mid": "audio/midi",
"midi": "audio/midi", "kar": "audio/midi", "mp3": "audio/mpeg", "ogg": "audio/ogg", "m4a": "audio/x-m4a", "midi": "audio/midi", "kar": "audio/midi", "mp3": "audio/mp3", "ogg": "audio/ogg", "m4a": "audio/x-m4a",
"ra": "audio/x-realaudio", "3gpp": "video/3gpp", "3gp": "video/3gpp", "ts": "video/mp2t", "ra": "audio/x-realaudio", "3gpp": "video/3gpp", "3gp": "video/3gpp", "ts": "video/mp2t",
"mp4": "video/mp4", "mpeg": "video/mpeg", "mpg": "video/mpeg", "mov": "video/quicktime", "mp4": "video/mp4", "mpeg": "video/mpeg", "mpg": "video/mpeg", "mov": "video/quicktime",
"webm": "video/webm", "flv": "video/x-flv", "m4v": "video/x-m4v", "mng": "video/x-mng", "webm": "video/webm", "flv": "video/x-flv", "m4v": "video/x-m4v", "mng": "video/x-mng",
"asx": "video/x-ms-asf", "asf": "video/x-ms-asf", "wmv": "video/x-ms-wmv", "avi": "video/x-msvideo" "asx": "video/x-ms-asf", "asf": "video/x-ms-asf", "wmv": "video/x-ms-wmv", "avi": "video/x-msvideo",
"wav": "audio/wav", "flac": "audio/flac", "aac": "audio/aac", "opus": "audio/opus",
} }
@ -77,21 +78,16 @@ class FileSerializer(serializers.Serializer):
file = QuerySet(File).filter(id=file_id).first() file = QuerySet(File).filter(id=file_id).first()
if file is None: if file is None:
raise NotFound404(404, _('File not found')) raise NotFound404(404, _('File not found'))
# 如果是音频文件,直接返回文件流 file_type = file.file_name.split(".")[-1].lower()
file_type = file.file_name.split(".")[-1] content_type = mime_types.get(file_type, 'application/octet-stream')
if file_type in ['mp3', 'wav', 'ogg', 'aac']: headers = {
return HttpResponse( 'Content-Type': content_type,
file.get_bytes(), 'Content-Disposition': f'attachment; filename="{file.file_name}"'
status=200, }
headers={
'Content-Type': f'audio/{file_type}',
'Content-Disposition': 'attachment; filename="{}"'.format(file.file_name)
}
)
return HttpResponse( return HttpResponse(
file.get_bytes(), file.get_bytes(),
status=200, status=200,
headers={'Content-Type': mime_types.get(file_type, 'text/plain')} headers=headers
) )
def delete(self): def delete(self):

View File

@ -32,8 +32,8 @@ const postAPIKey: (application_id: string, loading?: Ref<boolean>) => Promise<Re
* @param application_id api_key_id * @param application_id api_key_id
*/ */
const delAPIKey: ( const delAPIKey: (
application_id: String, application_id: string,
api_key_id: String, api_key_id: string,
loading?: Ref<boolean> loading?: Ref<boolean>
) => Promise<Result<boolean>> = (application_id, api_key_id, loading) => { ) => Promise<Result<boolean>> = (application_id, api_key_id, loading) => {
return del(`${prefix}/${application_id}/api_key/${api_key_id}`, undefined, undefined, loading) return del(`${prefix}/${application_id}/api_key/${api_key_id}`, undefined, undefined, loading)
@ -48,7 +48,7 @@ const delAPIKey: (
*/ */
const putAPIKey: ( const putAPIKey: (
application_id: string, application_id: string,
api_key_id: String, api_key_id: string,
data: any, data: any,
loading?: Ref<boolean> loading?: Ref<boolean>
) => Promise<Result<any>> = (application_id, api_key_id, data, loading) => { ) => Promise<Result<any>> = (application_id, api_key_id, data, loading) => {

View File

@ -49,7 +49,7 @@ const postApplication: (
* @param * @param
*/ */
const putApplication: ( const putApplication: (
application_id: String, application_id: string,
data: ApplicationFormType, data: ApplicationFormType,
loading?: Ref<boolean>, loading?: Ref<boolean>,
) => Promise<Result<any>> = (application_id, data, loading) => { ) => Promise<Result<any>> = (application_id, data, loading) => {
@ -61,7 +61,7 @@ const putApplication: (
* @param application_id * @param application_id
*/ */
const delApplication: ( const delApplication: (
application_id: String, application_id: string,
loading?: Ref<boolean>, loading?: Ref<boolean>,
) => Promise<Result<boolean>> = (application_id, loading) => { ) => Promise<Result<boolean>> = (application_id, loading) => {
return del(`${prefix}/${application_id}`, undefined, {}, loading) return del(`${prefix}/${application_id}`, undefined, {}, loading)
@ -177,7 +177,7 @@ const postWorkflowChatOpen: (data: ApplicationFormType) => Promise<Result<any>>
] ]
} }
*/ */
const getChatOpen: (application_id: String) => Promise<Result<any>> = (application_id) => { const getChatOpen: (application_id: string) => Promise<Result<any>> = (application_id) => {
return get(`${prefix}/${application_id}/chat/open`) return get(`${prefix}/${application_id}/chat/open`)
} }
/** /**
@ -305,7 +305,7 @@ const getApplicationTTIModel: (
* @param * @param
*/ */
const putPublishApplication: ( const putPublishApplication: (
application_id: String, application_id: string,
data: ApplicationFormType, data: ApplicationFormType,
loading?: Ref<boolean>, loading?: Ref<boolean>,
) => Promise<Result<any>> = (application_id, data, loading) => { ) => Promise<Result<any>> = (application_id, data, loading) => {
@ -317,7 +317,7 @@ const putPublishApplication: (
* @param loading * @param loading
* @returns * @returns
*/ */
const listFunctionLib: (application_id: String, loading?: Ref<boolean>) => Promise<Result<any>> = ( const listFunctionLib: (application_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = (
application_id, application_id,
loading, loading,
) => { ) => {
@ -343,8 +343,8 @@ export const getApplicationList: (
* @returns * @returns
*/ */
const getFunctionLib: ( const getFunctionLib: (
application_id: String, application_id: string,
function_lib_id: String, function_lib_id: string,
loading?: Ref<boolean>, loading?: Ref<boolean>,
) => Promise<Result<any>> = (application_id, function_lib_id, loading) => { ) => Promise<Result<any>> = (application_id, function_lib_id, loading) => {
return get(`${prefix}/${application_id}/function_lib/${function_lib_id}`, undefined, loading) return get(`${prefix}/${application_id}/function_lib/${function_lib_id}`, undefined, loading)
@ -358,8 +358,8 @@ const getMcpTools: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> =
} }
const getApplicationById: ( const getApplicationById: (
application_id: String, application_id: string,
app_id: String, app_id: string,
loading?: Ref<boolean>, loading?: Ref<boolean>,
) => Promise<Result<any>> = (application_id, app_id, loading) => { ) => Promise<Result<any>> = (application_id, app_id, loading) => {
return get(`${prefix}/${application_id}/application/${app_id}`, undefined, loading) return get(`${prefix}/${application_id}/application/${app_id}`, undefined, loading)
@ -372,8 +372,8 @@ const getApplicationById: (
* @returns * @returns
*/ */
const getModelParamsForm: ( const getModelParamsForm: (
application_id: String, application_id: string,
model_id: String, model_id: string,
loading?: Ref<boolean>, loading?: Ref<boolean>,
) => Promise<Result<Array<FormField>>> = (application_id, model_id, loading) => { ) => Promise<Result<Array<FormField>>> = (application_id, model_id, loading) => {
return get(`${prefix}/${application_id}/model_params_form/${model_id}`, undefined, loading) return get(`${prefix}/${application_id}/model_params_form/${model_id}`, undefined, loading)
@ -383,8 +383,8 @@ const getModelParamsForm: (
* *
*/ */
const uploadFile: ( const uploadFile: (
application_id: String, application_id: string,
chat_id: String, chat_id: string,
data: any, data: any,
loading?: Ref<boolean>, loading?: Ref<boolean>,
) => Promise<Result<any>> = (application_id, chat_id, data, loading) => { ) => Promise<Result<any>> = (application_id, chat_id, data, loading) => {
@ -395,7 +395,7 @@ const uploadFile: (
* *
*/ */
const postSpeechToText: ( const postSpeechToText: (
application_id: String, application_id: string,
data: any, data: any,
loading?: Ref<boolean>, loading?: Ref<boolean>,
) => Promise<Result<any>> = (application_id, data, loading) => { ) => Promise<Result<any>> = (application_id, data, loading) => {
@ -406,7 +406,7 @@ const postSpeechToText: (
* *
*/ */
const postTextToSpeech: ( const postTextToSpeech: (
application_id: String, application_id: string,
data: any, data: any,
loading?: Ref<boolean>, loading?: Ref<boolean>,
) => Promise<Result<any>> = (application_id, data, loading) => { ) => Promise<Result<any>> = (application_id, data, loading) => {
@ -417,7 +417,7 @@ const postTextToSpeech: (
* *
*/ */
const playDemoText: ( const playDemoText: (
application_id: String, application_id: string,
data: any, data: any,
loading?: Ref<boolean>, loading?: Ref<boolean>,
) => Promise<Result<any>> = (application_id, data, loading) => { ) => Promise<Result<any>> = (application_id, data, loading) => {

View File

@ -70,7 +70,7 @@ const putTool: (
* @returns * @returns
*/ */
const getToolById: ( const getToolById: (
tool_id: String, tool_id: string,
loading?: Ref<boolean>, loading?: Ref<boolean>,
) => Promise<Result<any>> = (tool_id, loading) => { ) => Promise<Result<any>> = (tool_id, loading) => {
return get(`${prefix}/tool/${tool_id}`, undefined, loading) return get(`${prefix}/tool/${tool_id}`, undefined, loading)

View File

@ -45,7 +45,7 @@ interface chatType {
id: string id: string
problem_text: string problem_text: string
answer_text: string answer_text: string
buffer: Array<String> buffer: Array<string>
answer_text_list: Array< answer_text_list: Array<
Array<{ Array<{
content: string content: string

View File

@ -1,8 +1,8 @@
interface knowledgeData { interface knowledgeData {
name: String name: string
folder_id?: String folder_id?: string
desc: String desc: string
embedding?: String embedding?: string
documents?: Array<any> documents?: Array<any>
} }

View File

@ -1,13 +1,13 @@
interface toolData { interface toolData {
id?: String id?: string
name?: String name?: string
icon?: String icon?: string
desc?: String desc?: string
code?: String code?: string
input_field_list?: Array<any> input_field_list?: Array<any>
init_field_list?: Array<any> init_field_list?: Array<any>
is_active?: Boolean is_active?: boolean
folder_id?: String folder_id?: string
} }
export type { toolData } export type { toolData }

View File

@ -49,7 +49,7 @@ import ToolApi from '@/api/tool/tool'
defineOptions({name: 'CodemirrorEditor'}) defineOptions({name: 'CodemirrorEditor'})
const props = defineProps<{ const props = defineProps<{
title: String title: string
modelValue: any modelValue: any
}>() }>()
const emit = defineEmits(['update:modelValue', 'submitDialog']) const emit = defineEmits(['update:modelValue', 'submitDialog'])
@ -73,7 +73,7 @@ function getRangeFromLineAndColumn(state: any, line: number, column: number, end
} }
const regexpLinter = linter(async (view) => { const regexpLinter = linter(async (view) => {
let diagnostics: Diagnostic[] = [] const diagnostics: Diagnostic[] = []
await ToolApi.postPylint(view.state.doc.toString()).then((ok) => { await ToolApi.postPylint(view.state.doc.toString()).then((ok) => {
ok.data.forEach((element: any) => { ok.data.forEach((element: any) => {
const range = getRangeFromLineAndColumn( const range = getRangeFromLineAndColumn(

View File

@ -36,7 +36,7 @@ const props = withDefaults(
}, },
) )
const current = ref<Number | String>(0) const current = ref<number | string>(0)
watch( watch(
() => props.defaultActive, () => props.defaultActive,

View File

@ -114,7 +114,7 @@ const errMsg = computed(() => {
*/ */
const to_rule = (rule: any) => { const to_rule = (rule: any) => {
if (rule.validator) { if (rule.validator) {
let validator = (rule: any, value: string, callback: any) => {} const validator = (rule: any, value: string, callback: any) => {}
eval(rule.validator) eval(rule.validator)
return { ...rule, validator } return { ...rule, validator }
} }

View File

@ -74,12 +74,12 @@ const formFieldRef = ref<Array<InstanceType<typeof FormItem>>>([])
*/ */
const show = (field: FormField) => { const show = (field: FormField) => {
if (field.relation_show_field_dict) { if (field.relation_show_field_dict) {
let keys = Object.keys(field.relation_show_field_dict) const keys = Object.keys(field.relation_show_field_dict)
for (const index in keys) { for (const index in keys) {
const key = keys[index] const key = keys[index]
let v = _.get(formValue.value, key) const v = _.get(formValue.value, key)
if (v && v !== undefined && v !== null) { if (v && v !== undefined && v !== null) {
let values = field.relation_show_field_dict[key] const values = field.relation_show_field_dict[key]
if (values && values.length > 0) { if (values && values.length > 0) {
return values.includes(v) return values.includes(v)
} else { } else {

View File

@ -125,7 +125,7 @@ function deleteApiKey(row: any) {
.catch(() => {}) .catch(() => {})
} }
function changeState(bool: Boolean, row: any) { function changeState(bool: boolean, row: any) {
const obj = { const obj = {
is_active: bool is_active: bool
} }

View File

@ -96,7 +96,7 @@ const open = () => {
} }
const onChange = (file: any) => { const onChange = (file: any) => {
let fd = new FormData() const fd = new FormData()
fd.append('license_file', file.raw) fd.append('license_file', file.raw)
licenseApi.putLicense(fd, loading).then((res: any) => { licenseApi.putLicense(fd, loading).then((res: any) => {
getLicenseInfo() getLicenseInfo()

View File

@ -5,13 +5,13 @@ import {createI18n} from 'vue-i18n'
// 导入语言文件 // 导入语言文件
const langModules = import.meta.glob('./lang/*/index.ts', {eager: true}) as Record< const langModules = import.meta.glob('./lang/*/index.ts', {eager: true}) as Record<
string, string,
() => Promise<{ default: Object }> () => Promise<{ default: object }>
> >
// 定义 Recordable 类型 // 定义 Recordable 类型
type Recordable<T = any> = Record<string, T> type Recordable<T = any> = Record<string, T>
const langModuleMap = new Map<string, Object>() const langModuleMap = new Map<string, object>()
export const langCode: Array<string> = [] export const langCode: Array<string> = []

View File

@ -10,7 +10,7 @@ const useLoginStore = defineStore('login', {
userAccessToken: '', userAccessToken: '',
}), }),
actions: { actions: {
getToken(): String | null { getToken(): string | null {
if (this.token) { if (this.token) {
return this.token return this.token
} }

View File

@ -65,7 +65,7 @@ const useLoginStore = defineStore('user', {
this.XPACK_LICENSE_IS_VALID = true this.XPACK_LICENSE_IS_VALID = true
if (this.isEnterprise()) { if (this.isEnterprise()) {
// await this.theme() // await this.theme()
} else { } else {
this.themeInfo = { this.themeInfo = {
...defaultPlatformSetting ...defaultPlatformSetting

View File

@ -63,6 +63,6 @@ export function filesize(size: number) {
// 头像 // 头像
export const defaultIcon = '/ui/favicon.ico' export const defaultIcon = '/ui/favicon.ico'
export function isAppIcon(url: String | undefined) { export function isAppIcon(url: string | undefined) {
return url === defaultIcon ? '' : url return url === defaultIcon ? '' : url
} }

View File

@ -38,7 +38,7 @@ export const MsgError = (message: string) => {
} }
export const MsgAlert = (title: string, description: string, options?: any) => { export const MsgAlert = (title: string, description: string, options?: any) => {
const defaultOptions: Object = { const defaultOptions: object = {
confirmButtonText: t('common.confirm'), confirmButtonText: t('common.confirm'),
...options ...options
} }
@ -51,7 +51,7 @@ export const MsgAlert = (title: string, description: string, options?: any) => {
*/ */
export const MsgConfirm = (title: string, description: string, options?: any) => { export const MsgConfirm = (title: string, description: string, options?: any) => {
const defaultOptions: Object = { const defaultOptions: object = {
showCancelButton: true, showCancelButton: true,
confirmButtonText: t('common.confirm'), confirmButtonText: t('common.confirm'),
cancelButtonText: t('common.cancel'), cancelButtonText: t('common.cancel'),

View File

@ -50,7 +50,7 @@ class Status {
} }
status = status.split('').reverse().join('') status = status.split('').reverse().join('')
this.task_status = {} this.task_status = {}
for (let key in TaskType) { for (const key in TaskType) {
const value = TaskType[key as keyof TaskTypeInterface] const value = TaskType[key as keyof TaskTypeInterface]
const index = value - 1 const index = value - 1
this.task_status[value] = status[index] ? status[index] : 'n' this.task_status[value] = status[index] ? status[index] : 'n'
@ -58,7 +58,7 @@ class Status {
} }
toString() { toString() {
const r = [] const r = []
for (let key in TaskType) { for (const key in TaskType) {
const value = TaskType[key as keyof TaskTypeInterface] const value = TaskType[key as keyof TaskTypeInterface]
r.push(this.task_status[value]) r.push(this.task_status[value])
} }

View File

@ -120,7 +120,7 @@ function submit() {
dialogVisible.value = false dialogVisible.value = false
}) })
} else if (radioType.value === 'custom' && iconFile.value) { } else if (radioType.value === 'custom' && iconFile.value) {
let fd = new FormData() const fd = new FormData()
fd.append('file', iconFile.value.raw) fd.append('file', iconFile.value.raw)
overviewApi.putAppIcon(id as string, fd, loading).then((res: any) => { overviewApi.putAppIcon(id as string, fd, loading).then((res: any) => {
emit('refresh') emit('refresh')

View File

@ -573,7 +573,7 @@ const submit = async (formEl: FormInstance | undefined) => {
if (!formEl) return if (!formEl) return
await formEl.validate((valid, fields) => { await formEl.validate((valid, fields) => {
if (valid) { if (valid) {
let fd = new FormData() const fd = new FormData()
Object.keys(xpackForm.value).map((item) => { Object.keys(xpackForm.value).map((item) => {
if (['custom_theme', 'float_location'].includes(item)) { if (['custom_theme', 'float_location'].includes(item)) {
fd.append(item, JSON.stringify(xpackForm.value[item])) fd.append(item, JSON.stringify(xpackForm.value[item]))

View File

@ -334,7 +334,7 @@ function refreshAccessToken() {
}) })
.catch(() => {}) .catch(() => {})
} }
function changeState(bool: Boolean) { function changeState(bool: boolean) {
const obj = { const obj = {
is_active: !bool is_active: !bool
} }

View File

@ -278,7 +278,7 @@ async function publicHandle() {
MsgError(e.toString()) MsgError(e.toString())
return return
} }
applicationApi.putPublishApplication(id as String, obj, loading).then(() => { applicationApi.putPublishApplication(id as string, obj, loading).then(() => {
application.asyncGetApplicationDetail(id, loading).then((res: any) => { application.asyncGetApplicationDetail(id, loading).then((res: any) => {
detail.value.name = res.data.name detail.value.name = res.data.name

View File

@ -154,7 +154,7 @@ const open = async (platform: Platform) => {
Object.assign(currentPlatform, platform) Object.assign(currentPlatform, platform)
// callback_url // callback_url
let defaultCallbackUrl = window.location.origin const defaultCallbackUrl = window.location.origin
switch (platform.key) { switch (platform.key) {
case 'wecom': case 'wecom':
if (currentPlatform.config.app_key) { if (currentPlatform.config.app_key) {

View File

@ -82,7 +82,7 @@ async function next() {
disabled.value = true disabled.value = true
if (await UploadComponentRef.value.validate()) { if (await UploadComponentRef.value.validate()) {
if (documentsType.value === 'QA') { if (documentsType.value === 'QA') {
let fd = new FormData() const fd = new FormData()
documentsFiles.value.forEach((item: any) => { documentsFiles.value.forEach((item: any) => {
if (item?.raw) { if (item?.raw) {
fd.append('file', item?.raw) fd.append('file', item?.raw)
@ -97,7 +97,7 @@ async function next() {
}) })
} }
} else if (documentsType.value === 'table') { } else if (documentsType.value === 'table') {
let fd = new FormData() const fd = new FormData()
documentsFiles.value.forEach((item: any) => { documentsFiles.value.forEach((item: any) => {
if (item?.raw) { if (item?.raw) {
fd.append('file', item?.raw) fd.append('file', item?.raw)

View File

@ -168,7 +168,7 @@ function changeHandle(val: boolean) {
} }
function splitDocument() { function splitDocument() {
loading.value = true loading.value = true
let fd = new FormData() const fd = new FormData()
documentsFiles.value.forEach((item) => { documentsFiles.value.forEach((item) => {
if (item?.raw) { if (item?.raw) {
fd.append('file', item?.raw) fd.append('file', item?.raw)

View File

@ -440,7 +440,7 @@ function deleteParam(index: any) {
function refresh(data: any, index: any) { function refresh(data: any, index: any) {
for (let i = 0; i < base_form_data.value.model_params_form.length; i++) { for (let i = 0; i < base_form_data.value.model_params_form.length; i++) {
let field = base_form_data.value.model_params_form[i].field const field = base_form_data.value.model_params_form[i].field
let label = base_form_data.value.model_params_form[i].label let label = base_form_data.value.model_params_form[i].label
if (label && label.input_type === 'TooltipLabel') { if (label && label.input_type === 'TooltipLabel') {
label = label.label label = label.label

View File

@ -124,7 +124,7 @@ function deleteParam(index: any) {
function refresh(data: any, index: any) { function refresh(data: any, index: any) {
for (let i = 0; i < modelParamsForm.value.length; i++) { for (let i = 0; i < modelParamsForm.value.length; i++) {
let field = modelParamsForm.value[i].field const field = modelParamsForm.value[i].field
let label = modelParamsForm.value[i].label let label = modelParamsForm.value[i].label
if (label && label.input_type === 'TooltipLabel') { if (label && label.input_type === 'TooltipLabel') {
label = label.label label = label.label

View File

@ -131,13 +131,13 @@ const loading = ref(false)
const documentList = ref<any[]>([]) const documentList = ref<any[]>([])
const cloneDocumentList = ref<any[]>([]) const cloneDocumentList = ref<any[]>([])
const paragraphList = ref<any[]>([]) const paragraphList = ref<any[]>([])
const currentProblemId = ref<String>('') const currentProblemId = ref<string>('')
const currentMulProblemId = ref<string[]>([]) const currentMulProblemId = ref<string[]>([])
// //
const associationParagraph = ref<any[]>([]) const associationParagraph = ref<any[]>([])
const currentDocument = ref<String>('') const currentDocument = ref<string>('')
const search = ref('') const search = ref('')
const searchType = ref('title') const searchType = ref('title')
const filterDoc = ref('') const filterDoc = ref('')
@ -222,7 +222,7 @@ function getDocument() {
}) })
} }
function getParagraphList(documentId: String) { function getParagraphList(documentId: string) {
paragraphApi paragraphApi
.getParagraph( .getParagraph(
id, id,
@ -238,16 +238,16 @@ function getParagraphList(documentId: String) {
} }
// //
function getRecord(problemId: String) { function getRecord(problemId: string) {
problemApi.getDetailProblems(id as string, problemId as string, loading).then((res) => { problemApi.getDetailProblems(id as string, problemId as string, loading).then((res) => {
associationParagraph.value = res.data associationParagraph.value = res.data
}) })
} }
function associationCount(documentId: String) { function associationCount(documentId: string) {
return associationParagraph.value.filter((item) => item.document_id === documentId).length return associationParagraph.value.filter((item) => item.document_id === documentId).length
} }
function isAssociation(paragraphId: String) { function isAssociation(paragraphId: string) {
return associationParagraph.value.some((option) => option.id === paragraphId) return associationParagraph.value.some((option) => option.id === paragraphId)
} }

View File

@ -305,12 +305,12 @@ const nextChatRecord = () => {
} }
} }
const pre_disable = computed(() => { const pre_disable = computed(() => {
let index = problemIndexMap.value[currentClickId.value] - 1 const index = problemIndexMap.value[currentClickId.value] - 1
return index < 0 && paginationConfig.current_page <= 1 return index < 0 && paginationConfig.current_page <= 1
}) })
const next_disable = computed(() => { const next_disable = computed(() => {
let index = problemIndexMap.value[currentClickId.value] + 1 const index = problemIndexMap.value[currentClickId.value] + 1
return ( return (
index >= problemData.value.length && index >= problemData.value.length &&
index + (paginationConfig.current_page - 1) * paginationConfig.page_size >= index + (paginationConfig.current_page - 1) * paginationConfig.page_size >=

View File

@ -82,7 +82,7 @@ const submitMember = async (formEl: FormInstance | undefined) => {
if (!formEl) return if (!formEl) return
await formEl.validate((valid, fields) => { await formEl.validate((valid, fields) => {
if (valid) { if (valid) {
let idsArray = memberForm.value.users.map((obj: any) => obj.id) const idsArray = memberForm.value.users.map((obj: any) => obj.id)
AuthorizationApi.postCreatTeamMember(idsArray, loading).then((res) => { AuthorizationApi.postCreatTeamMember(idsArray, loading).then((res) => {
MsgSuccess(t('common.submitSuccess')) MsgSuccess(t('common.submitSuccess'))
emit('refresh', idsArray) emit('refresh', idsArray)

View File

@ -108,7 +108,7 @@ watch(filterText, (val: any) => {
} }
}) })
function isManage(type: String) { function isManage(type: string) {
return type === 'manage' return type === 'manage'
} }

View File

@ -109,7 +109,7 @@ function submit() {
emit('refresh', '/ui/favicon.ico') emit('refresh', '/ui/favicon.ico')
dialogVisible.value = false dialogVisible.value = false
} else if (radioType.value === 'custom' && iconFile.value) { } else if (radioType.value === 'custom' && iconFile.value) {
let fd = new FormData() const fd = new FormData()
fd.append('file', iconFile.value.raw) fd.append('file', iconFile.value.raw)
toolApi.putToolIcon(detail.value.id, fd, loading).then((res: any) => { toolApi.putToolIcon(detail.value.id, fd, loading).then((res: any) => {
emit('refresh', res.data) emit('refresh', res.data)

View File

@ -25,7 +25,7 @@ import { t } from '@/locales'
const props = defineProps<{ const props = defineProps<{
nodeModel: any nodeModel: any
modelValue: Array<any> modelValue: Array<any>
global?: Boolean global?: boolean
}>() }>()
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue'])
const data = computed({ const data = computed({

View File

@ -94,7 +94,7 @@ function refreshFieldList(data: any) {
} }
} }
// list // list
let arr = props.nodeModel.properties.user_input_field_list const arr = props.nodeModel.properties.user_input_field_list
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
if (arr[i].field === data.variable) { if (arr[i].field === data.variable) {
MsgError(t('views.applicationWorkflow.tip.paramErrorMessage') + data.variable) MsgError(t('views.applicationWorkflow.tip.paramErrorMessage') + data.variable)

View File

@ -149,7 +149,7 @@ function refreshFieldList(data: any, index: any) {
} }
} }
// list // list
let arr = props.nodeModel.properties.api_input_field_list const arr = props.nodeModel.properties.api_input_field_list
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
if (arr[i].variable === data.field) { if (arr[i].variable === data.field) {
MsgError(t('views.applicationWorkflow.tip.paramErrorMessage') + data.field) MsgError(t('views.applicationWorkflow.tip.paramErrorMessage') + data.field)

View File

@ -284,7 +284,7 @@ function changeTool() {
)[0].args_schema )[0].args_schema
form_data.value.tool_form_field = [] form_data.value.tool_form_field = []
for (const item in args_schema.properties) { for (const item in args_schema.properties) {
let params = args_schema.properties[item].properties const params = args_schema.properties[item].properties
if (params) { if (params) {
form_data.value.params_nested = item form_data.value.params_nested = item
for (const item2 in params) { for (const item2 in params) {

View File

@ -86,7 +86,7 @@ const refreshFileUploadConfig = () => {
set(props.nodeModel.properties.config, 'fields', fields) set(props.nodeModel.properties.config, 'fields', fields)
return return
} }
let fileUploadFields = [] const fileUploadFields = []
if (form_data[0].document) { if (form_data[0].document) {
fileUploadFields.push({ label: t('common.fileUpload.document'), value: 'document' }) fileUploadFields.push({ label: t('common.fileUpload.document'), value: 'document' })
} }

View File

@ -16,6 +16,11 @@ export default defineConfig(({ mode }) => {
target: 'http://127.0.0.1:8080', target: 'http://127.0.0.1:8080',
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(ENV.VITE_BASE_PATH, '/'), rewrite: (path) => path.replace(ENV.VITE_BASE_PATH, '/'),
}
proxyConf['/oss'] = {
target: 'http://127.0.0.1:8080',
changeOrigin: true,
rewrite: (path) => path.replace(ENV.VITE_BASE_PATH, '/'),
} }
proxyConf['/doc'] = { proxyConf['/doc'] = {
target: 'http://127.0.0.1:8080', target: 'http://127.0.0.1:8080',