feat: 模型下拉框选项显示能力图标
每个模型选项文字后追加能力标记: - 🧠 Think(支持思考推理) - 👁️ Vision(支持图片理解) - 🔧 Tools(支持工具调用) 示例:qwen3:8b · 5.2GB 🧠🔧
This commit is contained in:
@@ -70,6 +70,7 @@ export async function loadModels(): Promise<void> {
|
|||||||
.forEach(m => {
|
.forEach(m => {
|
||||||
const opt = document.createElement('option');
|
const opt = document.createElement('option');
|
||||||
opt.value = m.name;
|
opt.value = m.name;
|
||||||
|
opt.dataset.size = String(m.size || 0);
|
||||||
const diskSize = formatSize(m.size || 0);
|
const diskSize = formatSize(m.size || 0);
|
||||||
opt.textContent = diskSize ? `${m.name} · ${diskSize}` : m.name;
|
opt.textContent = diskSize ? `${m.name} · ${diskSize}` : m.name;
|
||||||
modelSelectEl.appendChild(opt);
|
modelSelectEl.appendChild(opt);
|
||||||
@@ -91,6 +92,21 @@ export async function loadModels(): Promise<void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 根据能力为下拉框选项添加图标标记 */
|
||||||
|
function updateOptionIcons(): void {
|
||||||
|
for (const opt of Array.from(modelSelectEl.options)) {
|
||||||
|
const caps = modelCapabilityCache.get(opt.value);
|
||||||
|
if (!caps) continue;
|
||||||
|
const diskSize = opt.dataset.size ? formatSize(parseInt(opt.dataset.size)) : '';
|
||||||
|
const base = diskSize ? `${opt.value} · ${diskSize}` : opt.value;
|
||||||
|
const icons: string[] = [];
|
||||||
|
if (caps.think) icons.push('🧠');
|
||||||
|
if (caps.vision) icons.push('👁️');
|
||||||
|
if (caps.tools) icons.push('🔧');
|
||||||
|
opt.textContent = icons.length > 0 ? `${base} ${icons.join('')}` : base;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function filterEmbedModels(models: Array<{ name: string }>): Promise<void> {
|
async function filterEmbedModels(models: Array<{ name: string }>): Promise<void> {
|
||||||
const api = state.get<OllamaAPI>(KEYS.API);
|
const api = state.get<OllamaAPI>(KEYS.API);
|
||||||
if (!api) return;
|
if (!api) return;
|
||||||
@@ -113,6 +129,8 @@ async function filterEmbedModels(models: Array<{ name: string }>): Promise<void>
|
|||||||
} catch { /* ignore */ }
|
} catch { /* ignore */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateOptionIcons();
|
||||||
|
|
||||||
if (!modelSelectEl.value && modelSelectEl.options.length > 0) {
|
if (!modelSelectEl.value && modelSelectEl.options.length > 0) {
|
||||||
modelSelectEl.value = modelSelectEl.options[0].value;
|
modelSelectEl.value = modelSelectEl.options[0].value;
|
||||||
state.set('_defaultModel', modelSelectEl.value);
|
state.set('_defaultModel', modelSelectEl.value);
|
||||||
|
|||||||
Reference in New Issue
Block a user