fix(web): app chat

This commit is contained in:
zhaoying
2026-03-27 14:28:51 +08:00
parent 4f69224cfd
commit 3da6331515
6 changed files with 99 additions and 72 deletions

View File

@@ -2,7 +2,7 @@
* @Author: ZhaoYing
* @Date: 2026-02-03 16:27:56
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-03-26 14:03:01
* @Last Modified time: 2026-03-27 14:24:47
*/
/**
* Copy Application Modal
@@ -74,16 +74,16 @@ const FeaturesConfigModal = forwardRef<FeaturesConfigModalRef, FeaturesConfigMod
}
const formatFileTypeOptions = (fu: FeaturesConfigForm['file_upload']) => {
let options = [{ type: 'document', enabled: fu.document_enabled, maxSize: fu.document_max_size_mb }]
let options = fu.document_enabled ? [{ type: 'document', enabled: fu.document_enabled, maxSize: fu.document_max_size_mb }] : []
if (!capability) return options
if (capability.includes('vision')) {
if ((capability.includes('vision') || source === 'workflow') && fu.image_enabled) {
options.push({ type: 'image', enabled: fu.image_enabled, maxSize: fu.image_max_size_mb })
}
if (capability.includes('audio')) {
if ((capability.includes('audio') || source === 'workflow') && fu.audio_enabled) {
options.push({ type: 'audio', enabled: fu.audio_enabled, maxSize: fu.audio_max_size_mb })
}
if (capability.includes('video')) {
if ((capability.includes('video') || source === 'workflow') && fu.video_enabled) {
options.push({ type: 'video', enabled: fu.video_enabled, maxSize: fu.video_max_size_mb })
}
return options.filter(item => item.enabled)
@@ -201,6 +201,7 @@ const FeaturesConfigModal = forwardRef<FeaturesConfigModalRef, FeaturesConfigMod
ref={fileUploadSettingModalRef}
onSave={handleSaveSettings}
capability={capability}
source={source}
/>
<OpenStatementSettingModal
ref={openStatementSettingModalRef}

View File

@@ -2,7 +2,7 @@
* @Author: ZhaoYing
* @Date: 2026-03-05
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-03-24 11:00:14
* @Last Modified time: 2026-03-27 14:02:40
*/
import { forwardRef, useImperativeHandle, useState, useMemo } from 'react';
import { Form, InputNumber, Flex, Switch, Row, Col, Radio } from 'antd';
@@ -12,6 +12,7 @@ import clsx from 'clsx';
import RbModal from '@/components/RbModal';
import type { FeaturesConfigForm } from '../../types'
import type { Capability } from '@/views/ModelManagement/types'
import type { Application } from '@/views/ApplicationManagement/types';
type FileUpload = Omit<FeaturesConfigForm['file_upload'], 'settings'>
@@ -23,6 +24,7 @@ interface FileUploadSettingModalRef {
interface FileUploadSettingModalProps {
onSave: (values: FileUpload) => void;
capability?: Capability[];
source?: Application['type']
}
const documentType = {
type: 'document',
@@ -108,6 +110,7 @@ const defaultValues: FileUpload = {
const FileUploadSettingModal = forwardRef<FileUploadSettingModalRef, FileUploadSettingModalProps>(({
onSave,
capability,
source,
}, ref) => {
const { t } = useTranslation();
const [visible, setVisible] = useState(false);
@@ -149,6 +152,14 @@ const FileUploadSettingModal = forwardRef<FileUploadSettingModalRef, FileUploadS
}));
const fileTypeOptions = useMemo(() => {
if (source === 'workflow') {
return [
documentType,
imageType,
audioType,
videoType,
]
}
let options = [documentType]
if (!capability) return options
if (capability.includes('vision')) options = [...options, imageType]