MCPcopy Create free account
hub / github.com/CatMuse/HiNote / showStandardCustomModelInput

Function showStandardCustomModelInput

src/settings/ai/AIServiceSettings.ts:308–337  ·  view source on GitHub ↗

* 显示自定义模型输入框

(
        config: AIProviderConfig,
        modelState: StandardModelState,
        refs: { modelSelectEl: HTMLSelectElement | null; customModelContainer: HTMLDivElement | null }
    )

Source from the content-addressed store, hash-verified

306 * 显示自定义模型输入框
307 */
308 protected async showStandardCustomModelInput(
309 config: AIProviderConfig,
310 modelState: StandardModelState,
311 refs: { modelSelectEl: HTMLSelectElement | null; customModelContainer: HTMLDivElement | null }
312 ): Promise<void> {
313 if (refs.customModelContainer && refs.modelSelectEl) {
314 refs.customModelContainer.addClass('visible');
315 refs.modelSelectEl.value = 'custom';
316
317 const settings = this.getProviderSettings(config);
318 const currentModel = modelState.selectedModel;
319
320 if (!currentModel.isCustom) {
321 const modelId = this.getProviderSettingString(config, 'lastCustomModel');
322 modelState.selectedModel = {
323 id: modelId,
324 name: modelId,
325 isCustom: true
326 };
327 settings.model = modelId;
328 settings.isCustomModel = true;
329 await this.plugin.saveSettings();
330
331 const inputEl = refs.customModelContainer.querySelector('input');
332 if (inputEl) {
333 inputEl.value = modelId;
334 }
335 }
336 }
337 }
338
339 /**
340 * 隐藏自定义模型输入框

Callers

nothing calls this directly

Calls 1

saveSettingsMethod · 0.80

Tested by

no test coverage detected