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

Function addCustomModels

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

Source from the content-addressed store, hash-verified

599 };
600
601 const addCustomModels = () => {
602 if (customModel.trim() === '') return;
603 const modelArray = customModel.split(',').map((model) => model.trim());
604
605 let localModels = [...inputs.models];
606 let localModelOptions = [...modelOptions];
607 const addedModels = [];
608
609 modelArray.forEach((model) => {
610 if (model && !localModels.includes(model)) {
611 localModels.push(model);
612 localModelOptions.push({
613 key: model,
614 label: model,
615 value: model,
616 });
617 addedModels.push(model);
618 }
619 });
620
621 setModelOptions(localModelOptions);
622 setCustomModel('');
623 handleInputChange('models', localModels);
624
625 if (addedModels.length > 0) {
626 showSuccess(
627 t('已新增 {{count}} 个模型:{{list}}', {
628 count: addedModels.length,
629 list: addedModels.join(', '),
630 })
631 );
632 } else {
633 showInfo(t('未发现新增模型'));
634 }
635 };
636
637 const batchAllowed = !isEdit || isMultiKeyChannel;
638 const batchExtra = batchAllowed ? (

Callers

nothing calls this directly

Calls 4

showSuccessFunction · 0.90
showInfoFunction · 0.90
handleInputChangeFunction · 0.70
tFunction · 0.50

Tested by

no test coverage detected