MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / handleInputChange

Function handleInputChange

web/src/pages/Channel/EditChannel.js:129–201  ·  view source on GitHub ↗
(name, value)

Source from the content-addressed store, hash-verified

127 const [useManualInput, setUseManualInput] = useState(false); // 是否使用手动输入模式
128 const getInitValues = () => ({ ...originInputs });
129 const handleInputChange = (name, value) => {
130 if (formApiRef.current) {
131 formApiRef.current.setValue(name, value);
132 }
133 if (name === 'models' && Array.isArray(value)) {
134 value = Array.from(new Set(value.map((m) => (m || '').trim())));
135 }
136
137 if (name === 'base_url' && value.endsWith('/v1')) {
138 Modal.confirm({
139 title: '警告',
140 content:
141 '不需要在末尾加/v1,New API会自动处理,添加后可能导致请求失败,是否继续?',
142 onOk: () => {
143 setInputs((inputs) => ({ ...inputs, [name]: value }));
144 },
145 });
146 return;
147 }
148 setInputs((inputs) => ({ ...inputs, [name]: value }));
149 if (name === 'type') {
150 let localModels = [];
151 switch (value) {
152 case 2:
153 localModels = [
154 'mj_imagine',
155 'mj_variation',
156 'mj_reroll',
157 'mj_blend',
158 'mj_upscale',
159 'mj_describe',
160 'mj_uploads',
161 ];
162 break;
163 case 5:
164 localModels = [
165 'swap_face',
166 'mj_imagine',
167 'mj_video',
168 'mj_edits',
169 'mj_variation',
170 'mj_reroll',
171 'mj_blend',
172 'mj_upscale',
173 'mj_describe',
174 'mj_zoom',
175 'mj_shorten',
176 'mj_modal',
177 'mj_inpaint',
178 'mj_custom_zoom',
179 'mj_high_variation',
180 'mj_low_variation',
181 'mj_pan',
182 'mj_uploads',
183 ];
184 break;
185 case 36:
186 localModels = ['suno_music', 'suno_lyrics'];

Callers 6

fetchUpstreamModelListFunction · 0.70
addCustomModelsFunction · 0.70
EditChannel.jsFile · 0.70
index.jsFile · 0.50
onMessageSendFunction · 0.50
useDataLoaderFunction · 0.50

Calls 1

getChannelModelsFunction · 0.90

Tested by

no test coverage detected