Skip to content

Commit e53d040

Browse files
authored
Merge pull request #42 from visduo/main
供应商-模型管理添加全选/反选功能
2 parents 735656b + f8c758d commit e53d040

3 files changed

Lines changed: 90 additions & 3 deletions

File tree

soloncode-cli/src/main/resources/static/css/settings.css

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,46 @@ select[disabled] {
904904
gap: 4px;
905905
}
906906

907+
.provider-model-menu-wrap {
908+
position: relative;
909+
}
910+
911+
.provider-model-menu {
912+
position: absolute;
913+
top: calc(100% + 6px);
914+
right: 0;
915+
z-index: 20;
916+
display: none;
917+
min-width: 96px;
918+
padding: 4px;
919+
border: 1px solid var(--border-color);
920+
border-radius: 8px;
921+
background: var(--bg-primary);
922+
box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
923+
}
924+
925+
.provider-model-menu.show {
926+
display: block;
927+
}
928+
929+
.provider-model-menu-item {
930+
display: block;
931+
width: 100%;
932+
padding: 6px 10px;
933+
border: none;
934+
border-radius: 6px;
935+
background: transparent;
936+
color: var(--text-primary);
937+
text-align: left;
938+
cursor: pointer;
939+
font-size: 12px;
940+
line-height: 1.2;
941+
}
942+
943+
.provider-model-menu-item:hover {
944+
background: var(--bg-hover);
945+
}
946+
907947
.provider-model-icon-btn {
908948
display: flex;
909949
align-items: center;

soloncode-cli/src/main/resources/static/js/app-settings-providers.js

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* 供应商设置管理模块
3-
*
3+
*
44
* 负责供应商的增删改查、模型列表拉取等功能
55
*/
66
;(function () {
@@ -91,6 +91,43 @@
9191
toggleProviderModel(modelId, enabled, llmName, isSynced);
9292
});
9393

94+
// 批量选择菜单
95+
$('#providerModelsSelectToggle').on('click', function (e) {
96+
e.stopPropagation();
97+
$('#providerModelsActionMenu').toggleClass('show');
98+
});
99+
100+
$(document).on('click', function (e) {
101+
if ($(e.target).closest('.provider-model-menu-wrap').length === 0) {
102+
$('#providerModelsActionMenu').removeClass('show');
103+
}
104+
});
105+
106+
$('#providerModelsSelectAll, #providerModelsSelectNone, #providerModelsInvert').on('click', function () {
107+
var action = this.id;
108+
var changed = false;
109+
110+
$modelsList.find('.provider-model-toggle').each(function () {
111+
var $toggle = $(this);
112+
var nextChecked = $toggle.prop('checked');
113+
114+
if (action === 'providerModelsSelectAll') {
115+
nextChecked = true;
116+
} else if (action === 'providerModelsSelectNone') {
117+
nextChecked = false;
118+
} else if (action === 'providerModelsInvert') {
119+
nextChecked = !$toggle.prop('checked');
120+
}
121+
122+
if ($toggle.prop('checked') !== nextChecked) {
123+
changed = true;
124+
$toggle.prop('checked', nextChecked).trigger('change');
125+
}
126+
});
127+
128+
$('#providerModelsActionMenu').removeClass('show');
129+
});
130+
94131
// 作用域切换
95132
$('.settings-scope-toggle').on('click', '.settings-scope-btn', function () {
96133
var $toggle = $(this).closest('.settings-scope-toggle');
@@ -133,7 +170,7 @@
133170

134171
function renderProviderItem(provider) {
135172
var modelsCount = (provider.models || []).length;
136-
173+
137174
return '<div class="mcp-server-item" data-name="' + provider.name + '">' +
138175
'<div class="mcp-server-icon">P</div>' +
139176
'<div class="mcp-server-info">' +
@@ -169,7 +206,7 @@
169206
$('#providerApiUrl').val(provider ? provider.apiUrl : '');
170207
$('#providerApiKey').val(provider ? provider.apiKey : '');
171208
$('#providerScope').val(provider ? (provider.scope || 'global') : 'global');
172-
209+
173210
// 设置作用域按钮状态
174211
var scope = provider ? (provider.scope || 'global') : 'global';
175212
$('.settings-scope-toggle[data-target="providerScope"] .settings-scope-btn').removeClass('active');

soloncode-cli/src/main/resources/static/web.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,6 +1397,16 @@
13971397
<div class="form-group-header">
13981398
<label>模型管理</label>
13991399
<div class="provider-model-header-actions">
1400+
<div class="provider-model-menu-wrap">
1401+
<button class="provider-model-icon-btn" id="providerModelsSelectToggle" title="批量选择模型">
1402+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-list-checks-icon lucide-list-checks"><path d="M13 5h8"/><path d="M13 12h8"/><path d="M13 19h8"/><path d="m3 17 2 2 4-4"/><path d="m3 7 2 2 4-4"/></svg>
1403+
</button>
1404+
<div class="provider-model-menu" id="providerModelsActionMenu">
1405+
<button type="button" class="provider-model-menu-item" id="providerModelsSelectAll">全选</button>
1406+
<button type="button" class="provider-model-menu-item" id="providerModelsSelectNone">全不选</button>
1407+
<button type="button" class="provider-model-menu-item" id="providerModelsInvert">反选</button>
1408+
</div>
1409+
</div>
14001410
<button class="provider-model-icon-btn" id="providerAddModelBtn" title="手动添加模型">
14011411
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
14021412
</button>

0 commit comments

Comments
 (0)