diff --git a/web/src/components/playground/ImageUrlInput.js b/web/src/components/playground/ImageUrlInput.js index 88bbbecb..717bbf9d 100644 --- a/web/src/components/playground/ImageUrlInput.js +++ b/web/src/components/playground/ImageUrlInput.js @@ -3,15 +3,17 @@ import { Input, Typography, Button, + Switch, } from '@douyinfe/semi-ui'; import { IconFile } from '@douyinfe/semi-icons'; import { FileText, Plus, X, + Image, } from 'lucide-react'; -const ImageUrlInput = ({ imageUrls, onImageUrlsChange }) => { +const ImageUrlInput = ({ imageUrls, imageEnabled, onImageUrlsChange, onImageEnabledChange }) => { const handleAddImageUrl = () => { const newUrls = [...imageUrls, '']; onImageUrlsChange(newUrls); @@ -32,7 +34,7 @@ const ImageUrlInput = ({ imageUrls, onImageUrlsChange }) => {
- + 图片地址 @@ -40,18 +42,32 @@ const ImageUrlInput = ({ imageUrls, onImageUrlsChange }) => { (多模态对话)
-
- {imageUrls.length === 0 ? ( + {!imageEnabled ? ( + + 图片发送已停用,启用后可添加图片URL进行多模态对话 + + ) : imageUrls.length === 0 ? ( 点击 + 按钮添加图片URL,支持最多5张图片 @@ -61,7 +77,7 @@ const ImageUrlInput = ({ imageUrls, onImageUrlsChange }) => { )} -
+
{imageUrls.map((url, index) => (
@@ -72,6 +88,7 @@ const ImageUrlInput = ({ imageUrls, onImageUrlsChange }) => { className="!rounded-lg" size="small" prefix={} + disabled={!imageEnabled} />
))} diff --git a/web/src/components/playground/SettingsPanel.js b/web/src/components/playground/SettingsPanel.js index 150f9836..17326820 100644 --- a/web/src/components/playground/SettingsPanel.js +++ b/web/src/components/playground/SettingsPanel.js @@ -125,7 +125,9 @@ const SettingsPanel = ({ {/* 图片URL输入 */} onInputChange('imageUrls', urls)} + onImageEnabledChange={(enabled) => onInputChange('imageEnabled', enabled)} /> {/* 参数控制组件 */} diff --git a/web/src/components/playground/configStorage.js b/web/src/components/playground/configStorage.js index 23ba5ccd..7ddddb3f 100644 --- a/web/src/components/playground/configStorage.js +++ b/web/src/components/playground/configStorage.js @@ -12,6 +12,7 @@ const DEFAULT_CONFIG = { seed: null, stream: true, imageUrls: [], + imageEnabled: false, }, parameterEnabled: { max_tokens: true, diff --git a/web/src/pages/Playground/Playground.js b/web/src/pages/Playground/Playground.js index 661b0db9..1dc0b171 100644 --- a/web/src/pages/Playground/Playground.js +++ b/web/src/pages/Playground/Playground.js @@ -568,7 +568,7 @@ const Playground = () => { let messageContent; const validImageUrls = inputs.imageUrls.filter(url => url.trim() !== ''); - if (validImageUrls.length > 0) { + if (inputs.imageEnabled && validImageUrls.length > 0) { messageContent = [ { type: 'text', @@ -643,6 +643,12 @@ const Playground = () => { handleNonStreamRequest(payload); } + if (inputs.imageEnabled) { + setTimeout(() => { + handleInputChange('imageEnabled', false); + }, 100); + } + newMessage.push({ role: 'assistant', content: '', @@ -655,7 +661,7 @@ const Playground = () => { return newMessage; }); }, - [getSystemMessage, inputs, setMessage, parameterEnabled], + [getSystemMessage, inputs, setMessage, parameterEnabled, handleInputChange], ); const completeMessage = useCallback((status = 'complete') => {