update:角色配置页面mcp图标显示优化

This commit is contained in:
rainv123
2025-11-10 15:10:59 +08:00
parent cbb74170ea
commit 79eefb651f
+14 -1
View File
@@ -105,7 +105,7 @@
<div><strong>功能名称:</strong> {{ func.name }}</div>
</div>
<div class="icon-dot" :style="{ backgroundColor: getFunctionColor(func.name) }">
{{ func.name.charAt(0) }}
{{ getFunctionDisplayChar(func.name) }}
</div>
</el-tooltip>
<el-button class="edit-function-btn" @click="openFunctionDialog"
@@ -432,6 +432,19 @@ export default {
const hash = [...name].reduce((acc, char) => acc + char.charCodeAt(0), 0);
return this.functionColorMap[hash % this.functionColorMap.length];
},
getFunctionDisplayChar(name) {
if (!name || name.length === 0) return '';
for (let i = 0; i < name.length; i++) {
const char = name[i];
if (/[\u4e00-\u9fa5a-zA-Z0-9]/.test(char)) {
return char;
}
}
// 如果没有找到有效字符,返回第一个字符
return name.charAt(0);
},
showFunctionIcons(type) {
return type === 'Intent' &&
this.form.model.intentModelId !== 'Intent_nointent';