MCPcopy Create free account
hub / github.com/chieapp/chie / #updateSwitchButton

Method #updateSwitchButton

src/view/chat-view.ts:245–271  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

243
244 // Create the switch button.
245 #updateSwitchButton() {
246 for (const switcher of this.switchers) {
247 this.toolbar.removeChildView(switcher.view);
248 switcher.destructor();
249 }
250 this.switchers = [];
251 const serviceRecord = serviceManager.getRegisteredServices().find(record => this.service.constructor == record.serviceClass);
252 if (serviceRecord?.params) {
253 for (const param of serviceRecord.params) {
254 if (param.hasSwitcher) {
255 const switcher = new SwitcherButton(this.service, param, false);
256 this.toolbar.addChildView(switcher.view);
257 this.switchers.push(switcher);
258 }
259 }
260 }
261 const apiRecord = apiManager.getAPIRecord(this.service.api.credential.type);
262 if (apiRecord?.params) {
263 for (const param of apiRecord.params) {
264 if (param.hasSwitcher) {
265 const switcher = new SwitcherButton(this.service, param, true);
266 this.toolbar.addChildView(switcher.view);
267 this.switchers.push(switcher);
268 }
269 }
270 }
271 }
272
273 // Set the input and button to ready to send state.
274 #resetUIState() {

Callers 1

loadServiceMethod · 0.95

Calls 3

getRegisteredServicesMethod · 0.80
getAPIRecordMethod · 0.80
destructorMethod · 0.45

Tested by

no test coverage detected