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

Function loadChannel

web/src/pages/Channel/EditChannel.js:203–256  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

201 };
202
203 const loadChannel = async () => {
204 setLoading(true);
205 let res = await API.get(`/api/channel/${channelId}`);
206 if (res === undefined) {
207 return;
208 }
209 const { success, message, data } = res.data;
210 if (success) {
211 if (data.models === '') {
212 data.models = [];
213 } else {
214 data.models = data.models.split(',');
215 }
216 if (data.group === '') {
217 data.groups = [];
218 } else {
219 data.groups = data.group.split(',');
220 }
221 if (data.model_mapping !== '') {
222 data.model_mapping = JSON.stringify(
223 JSON.parse(data.model_mapping),
224 null,
225 2,
226 );
227 }
228 const chInfo = data.channel_info || {};
229 const isMulti = chInfo.is_multi_key === true;
230 setIsMultiKeyChannel(isMulti);
231 if (isMulti) {
232 setBatch(true);
233 setMultiToSingle(true);
234 const modeVal = chInfo.multi_key_mode || 'random';
235 setMultiKeyMode(modeVal);
236 data.multi_key_mode = modeVal;
237 } else {
238 setBatch(false);
239 setMultiToSingle(false);
240 }
241 setInputs(data);
242 if (formApiRef.current) {
243 formApiRef.current.setValues(data);
244 }
245 if (data.auto_ban === 0) {
246 setAutoBan(false);
247 } else {
248 setAutoBan(true);
249 }
250 setBasicModels(getChannelModels(data.type));
251 // console.log(data);
252 } else {
253 showError(message);
254 }
255 setLoading(false);
256 };
257
258 const fetchUpstreamModelList = async (name) => {
259 // if (inputs['type'] !== 1) {

Callers 1

EditChannel.jsFile · 0.85

Calls 2

getChannelModelsFunction · 0.90
showErrorFunction · 0.90

Tested by

no test coverage detected