/*
Copyright (C) 2025 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
For commercial licensing, please contact support@quantumnous.com
*/
import React from 'react';
import {
Card,
Select,
Typography,
Button,
Switch,
RadioGroup,
Input,
Slider,
} from '@douyinfe/semi-ui';
import { Sparkles, Users, ToggleLeft, X, Settings } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { formatVideoResolutionDisplayLabel, renderGroupOption, selectFilter } from '../../helpers';
import {
PLAYGROUND_IMAGE_SIZE_OPTIONS,
PLAYGROUND_VIDEO_DURATION_OPTIONS,
} from '../../constants/playground.constants';
import ParameterControl from './ParameterControl';
/**
* 体验馆分组下拉:与全局 renderGroupOption 一致,但不展示倍率角标。
* @param {Record} item Semi Select 传入的选项渲染参数
*/
const renderPlaygroundGroupOption = (item) =>
renderGroupOption({ ...item, ratio: undefined });
import ImageUrlInput from './ImageUrlInput';
import VideoUrlInput from './VideoUrlInput';
import ConfigManager from './ConfigManager';
import CustomRequestEditor from './CustomRequestEditor';
const SettingsPanel = ({
inputs,
parameterEnabled,
models,
modelTypes,
supplierOptions,
groups,
styleState,
showDebugPanel,
customRequestMode,
customRequestBody,
onInputChange,
onParameterToggle,
onCloseSettings,
onConfigImport,
onConfigReset,
onCustomRequestModeChange,
onCustomRequestBodyChange,
previewPayload,
messages,
userId,
}) => {
const { t } = useTranslation();
const currentConfig = {
inputs,
parameterEnabled,
showDebugPanel,
customRequestMode,
customRequestBody,
};
const displayMode = inputs.display_mode || 'text';
const isImageMode = displayMode === 'image';
const isVideoMode = displayMode === 'video';
const mediaModeEnabled = isImageMode || isVideoMode;
const videoMediaHint = isVideoMode
? t(
'体验馆视频素材提示',
'图片地址:第 1 张为首帧,2 张为首尾帧,更多张时最后一张为尾帧。视频地址:填写则作为源视频参与生成。未填写的字段不会加入请求。',
)
: '';
const applyVideoResolutionPreset = (preset) => {
const [w, h] = String(preset || '1280x720')
.split('x')
.map((n) => Number(n));
onInputChange('video_resolution_preset', preset);
if (Number.isFinite(w) && Number.isFinite(h)) {
onInputChange('video_width', w);
onInputChange('video_height', h);
}
};
return (
{/* 标题区域 - 与调试面板保持一致 */}