File size: 4,102 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<html>

<head>
  <title>Model Configuration</title>
</head>

<body>
  <script type="module">
    import { store } from "/plugins/_model_config/webui/model-config-store.js";
  </script>

  <div x-data>
    <template x-if="$store.modelConfig">
      <div>
        <div class="section-title">Model Configuration</div>
        <div class="section-description">
          AI models can be configured globally, per project, per agent and using quick-switch presets as well.
        </div>

        <!-- Read-only model config summary -->
        <div x-init="$store.modelConfig.refreshModelsSummary()" class="model-summary">
          <div class="model-summary-header">
            <div class="field-title">Current Models</div>
            <div class="field-description">Active model configuration resolved from global, project, and agent profile
              scopes.</div>
          </div>
          <div x-show="$store.modelConfig.modelsSummaryLoading" style="text-align:center; padding:12px;">
            <span class="material-symbols-outlined spinning" style="font-size:18px;">progress_activity</span>
          </div>
          <template x-if="!$store.modelConfig.modelsSummaryLoading && $store.modelConfig.modelsSummary.length">
            <div class="model-summary-grid">
              <template x-for="m in $store.modelConfig.modelsSummary" :key="m.title">
                <div class="model-summary-row">
                  <span class="material-symbols-outlined model-summary-icon" x-text="m.icon"></span>
                  <span class="model-summary-label" x-text="m.title"></span>
                  <span class="model-summary-value">
                    <span x-text="m.provider" style="opacity:0.6;"></span>
                    <span style="opacity:0.3; margin:0 4px;">/</span>
                    <span x-text="m.name"></span>
                  </span>
                </div>
              </template>
            </div>
          </template>
        </div>

        <div style="display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px;">
          <button class="btn btn-field" @click="$store.modelConfig.openConfigFromSummary()">
            Configure Models
          </button>
          <button class="btn btn-field" @click="$store.modelConfig.openPresetsFromSummary()">
            Configure Presets
          </button>
          <button class="btn btn-field" @click="$store.modelConfig.openApiKeysFromSummary()">
            Configure API Keys
          </button>
        </div>

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

  <style>
    .model-summary {
      margin-top: 14px;
    }

    .model-summary-header {
      margin-bottom: 8px;
    }

    .model-summary-grid {
      display: flex;
      flex-direction: column;
      background: var(--color-input);
      /* border: 1px solid var(--color-border);
      border-radius: 8px; */
      /* padding: 0.75em 1em; */
      max-width: 100%;
      overflow: hidden;
      box-sizing: border-box;
    }

    .model-summary-row {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 9px 14px;
      font-size: 0.82rem;
      min-width: 0;
    }

    .model-summary-row:not(:last-child) {
      border-bottom: 1px solid var(--color-border);
    }

    .model-summary-icon {
      font-size: 16px;
      opacity: 0.45;
      flex-shrink: 0;
    }

    .model-summary-label {
      width: 80px;
      flex-shrink: 0;
      font-weight: 500;
      opacity: 0.7;
    }

    .model-summary-value {
      flex: 1;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    @media (max-width: 600px) {
      .model-summary-grid {
        padding: 0.5em 0.5em;
      }

      .model-summary-row {
        flex-wrap: wrap;
        padding: 8px 8px;
        gap: 4px;
      }

      .model-summary-label {
        width: auto;
      }

      .model-summary-value {
        width: 100%;
        flex-basis: 100%;
        padding-left: 24px;
        font-size: 0.78rem;
        white-space: normal;
        word-break: break-all;
      }
    }
  </style>
</body>

</html>