mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 23:23:55 +08:00
update:角色配置页面mcp图标显示优化
This commit is contained in:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user