File size: 2,965 Bytes
7d4338a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<html>
<head>
  <title>Model Configuration</title>
  <script type="module">
    import { store } from "/plugins/_model_config/webui/model-config-store.js";
  </script>
</head>

<body>
  <div x-data
       x-init="
         await $store.modelConfig.ensureLoaded();
         $store.modelConfig.resetApiKeyDrafts();
         await $store.modelConfig.refreshApiKeyStatus();
         $store.modelConfig.initConfigFields(config);
         $store.modelConfig.installSettingsHooks(context, config);
       ">
    <template x-if="config && $store.modelConfig._loaded">
      <div class="model-config-sections">

        <!-- Model Sections (Main, Utility, Embedding) -->
        <template x-for="section in $store.modelConfig.MODEL_SECTIONS" :key="section.key">
          <div class="model-section"
               x-data="{ model: config[section.key], modelType: section.key.replace('_model', ''), providers: $store.modelConfig.getProviders(section.key), searchType: $store.modelConfig.getSearchType(section.key), apiKeyMode: 'store' }">
            <div class="section-title" x-text="section.title"></div>
            <div class="section-description" x-text="section.desc"></div>
            <x-component path="/plugins/_model_config/webui/model-field.html"></x-component>
          </div>
        </template>


        <!-- Per-Chat Override -->
        <div class="model-section">
          <div class="section-title">Per-Chat Override</div>
          <div class="section-description">Allow switching model presets from the chat navigation bar. New chats inherit the active preset.</div>
          <div class="field">
            <div class="field-label">
              <div class="field-title">Enable model switcher</div>
              <div class="field-description">Show a preset switcher in the chat navigation bar. Overrides main and utility model for the current chat.</div>
            </div>
            <div class="field-control">
              <label class="toggle">
                <input type="checkbox" x-model="config.allow_chat_override" />
                <span class="toggler"></span>
              </label>
            </div>
          </div>
          <div class="override-presets-link" x-show="config.allow_chat_override">
            <button class="text-button" @click="openModal('/plugins/_model_config/webui/main.html')">
              <span class="material-symbols-outlined">tune</span>
              <span>Edit Presets</span>
            </button>
          </div>
        </div>

      </div>
    </template>
  </div>

<style>
  .model-config-sections {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .model-section {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
  }
  .model-section .section-title {
    margin-top: 0;
  }
  .override-presets-link {
    margin-top: 4px;
  }
  .override-presets-link .text-button {
    font-size: 0.78rem;
    gap: 4px;
  }

</style>
</body>
</html>