mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 23:23:55 +08:00
Merge branch 'main' into update-tts-voice-data
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
<div style="color: red;display: inline-block;">*</div> {{ $t('addAgentDialog.agentName') }}:
|
||||
</div>
|
||||
<div class="input-46" style="margin-top: 12px;">
|
||||
<el-input ref="inputRef" :placeholder="$t('addAgentDialog.placeholder')" v-model="wisdomBodyName" @keyup.enter.native="confirm" />
|
||||
<el-input maxLength="64" ref="inputRef" :placeholder="$t('addAgentDialog.placeholder')" v-model="wisdomBodyName" @keyup.enter.native="confirm" />
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex;margin: 15px 15px;gap: 7px;">
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
<template>
|
||||
<div class="device-item">
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<div style="font-weight: 700;font-size: 18px;text-align: left;color: #3d4566;">
|
||||
<el-tooltip :content="device.agentName" placement="top" effect="light">
|
||||
<div class="device-item-title">
|
||||
{{ device.agentName }}
|
||||
</div>
|
||||
</el-tooltip>
|
||||
<div>
|
||||
<img src="@/assets/home/delete.png" alt="" style="width: 18px;height: 18px;margin-right: 10px;"
|
||||
@click.stop="handleDelete" />
|
||||
<el-tooltip class="item" effect="dark" :content="device.systemPrompt" placement="top"
|
||||
<el-tooltip class="item" effect="light" :content="device.systemPrompt" placement="top"
|
||||
popper-class="custom-tooltip">
|
||||
<img src="@/assets/home/info.png" alt="" style="width: 18px;height: 18px;" />
|
||||
</el-tooltip>
|
||||
@@ -39,6 +41,11 @@
|
||||
</div>
|
||||
<div class="version-info">
|
||||
<div>{{ $t('home.lastConversation') }}:{{ formattedLastConnectedTime }}</div>
|
||||
<div ref="scrollRef" class="version-info-scroll">
|
||||
<div ref="tagsRef" class="version-info-tags">
|
||||
<el-tag v-for="(tag, index) in tags" :key="index" size="mini">{{ tag }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -81,6 +88,10 @@ export default {
|
||||
} else {
|
||||
return this.device.lastConnectedAt;
|
||||
}
|
||||
},
|
||||
tags() {
|
||||
if (!this.device.tags) return [];
|
||||
return this.device.tags.map((tag) => tag.tagName);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -102,16 +113,45 @@ export default {
|
||||
}
|
||||
this.$emit('chat-history', { agentId: this.device.agentId, agentName: this.device.agentName })
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
tags: {
|
||||
handler(newTags) {
|
||||
if (newTags.length === 0) return;
|
||||
this.$nextTick(() => {
|
||||
const scrollWidth = this.$refs.scrollRef.clientWidth;
|
||||
const tagsWidth = this.$refs.tagsRef.clientWidth;
|
||||
if (tagsWidth < scrollWidth) {
|
||||
this.$refs.tagsRef.style.width = '100%';
|
||||
this.$refs.tagsRef.style.justifyContent = 'flex-end';
|
||||
} else {
|
||||
this.$refs.tagsRef.style.width = 'fit-content';
|
||||
this.$refs.tagsRef.style.justifyContent = 'flex-start';
|
||||
}
|
||||
})
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
<style lang="scss" scoped>
|
||||
.device-item {
|
||||
width: 342px;
|
||||
border-radius: 20px;
|
||||
background: #fafcfe;
|
||||
padding: 22px;
|
||||
padding: 22px 22px 14px;
|
||||
box-sizing: border-box;
|
||||
&-title {
|
||||
flex: 1;
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
color: #3d4566;
|
||||
text-align: left;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.device-name {
|
||||
@@ -142,6 +182,42 @@ export default {
|
||||
font-size: 12px;
|
||||
color: #979db1;
|
||||
font-weight: 400;
|
||||
> div {
|
||||
&:first-of-type {
|
||||
margin-top: 5px;
|
||||
}
|
||||
}
|
||||
&-scroll {
|
||||
height: 26px;
|
||||
margin-left: 20px;
|
||||
flex: 1;
|
||||
overflow-x: auto;
|
||||
padding-bottom: 4px;
|
||||
&::-webkit-scrollbar {
|
||||
height: 6px;
|
||||
background: #e6ebff;
|
||||
}
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: #409EFF;
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
&-tags {
|
||||
width: fit-content;
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
.more-tag {
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.all-tags-popover {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.disabled-btn {
|
||||
|
||||
@@ -71,8 +71,14 @@
|
||||
{{ $t('ttsModel.delete') }}
|
||||
</el-button>
|
||||
</template>
|
||||
<el-button v-else type="success" size="mini" @click="saveEdit(scope.row)" class="save-Tts">{{ $t('ttsModel.save') }}
|
||||
<template v-else>
|
||||
<el-button type="success" size="mini" @click="cancelEdit(scope.row)" class="save-Tts">
|
||||
{{ $t('button.cancel') }}
|
||||
</el-button>
|
||||
<el-button type="success" size="mini" @click="saveEdit(scope.row)" class="save-Tts">
|
||||
{{ $t('ttsModel.save') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -340,6 +346,17 @@ export default {
|
||||
this.$set(row, 'originalData', { ...row });
|
||||
},
|
||||
|
||||
cancelEdit(row) {
|
||||
// 通过新增创建的数据,取消编辑时,需要从数组中移除
|
||||
if (!row.id) {
|
||||
this.ttsModels.shift(row);
|
||||
} else {
|
||||
Object.assign(row, row.originalData);
|
||||
delete row.originalData;
|
||||
}
|
||||
row.editing = false;
|
||||
},
|
||||
|
||||
saveEdit(row) {
|
||||
if (!row.voiceCode || !row.voiceName || !row.languageType) {
|
||||
this.$message.error({
|
||||
@@ -447,7 +464,7 @@ export default {
|
||||
referenceText: '',
|
||||
selected: false,
|
||||
editing: true,
|
||||
sort: maxSort + 1
|
||||
sort: 0 // 新增数据默认排序在顶部
|
||||
};
|
||||
|
||||
this.ttsModels.unshift(newRow);
|
||||
|
||||
Reference in New Issue
Block a user