MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / slotAddModel

Method slotAddModel

src/plugins/aimanager/option/modelconfigdialog.cpp:141–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141void AddModelDialogPrivate::slotAddModel()
142{
143 LLMInfo newLLMInfo;
144 newLLMInfo.modelName = leLLMName->text();
145 if (newLLMInfo.modelName.isEmpty()) {
146 leLLMName->showAlertMessage(ModelConfigDialog::tr("This field cannot be empty."));
147 return;
148 }
149 newLLMInfo.type = cbLLMType->currentData().value<LLMType>();
150 if (newLLMInfo.type == LLMType::OPENAI)
151 newLLMInfo.icon = QIcon::fromTheme("uc_openai");
152
153 newLLMInfo.modelPath = leApiUrl->text();
154 if (newLLMInfo.modelPath.isEmpty()) {
155 leApiUrl->showAlertMessage(ModelConfigDialog::tr("This field cannot be empty."));
156 return;
157 }
158 newLLMInfo.apikey = leApiKey->text();
159
160 showWaitingState(true);
161 QString errStr;
162 auto valid = AiManager::instance()->checkModelValid(newLLMInfo, &errStr);
163 if (valid) {
164 LLMAppended = newLLMInfo;
165 q->accept();
166 } else if (!errStr.isEmpty() && q->isVisible()) { // if dialog closed, do not show error info
167 showErrorInfoDialog(errStr);
168 }
169 showWaitingState(false);
170}
171
172void AddModelDialogPrivate::showWaitingState(bool waiting)
173{

Callers

nothing calls this directly

Calls 5

isVisibleMethod · 0.80
textMethod · 0.45
isEmptyMethod · 0.45
checkModelValidMethod · 0.45
acceptMethod · 0.45

Tested by

no test coverage detected