mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 07:03:53 +08:00
fix: 修复智能体在线状态获取
补充相关国际化
This commit is contained in:
@@ -1415,6 +1415,8 @@ export default {
|
||||
'feature.vad.description': 'Sprachaktivität automatisch erkennen, um die Effizienz der Sprachiinteraktion zu optimieren',
|
||||
'feature.asr.name': 'Spracherkennung',
|
||||
'feature.asr.description': 'Sprache in Text umwandeln, um natürliche Sprachinteraktionsfunktionalität zu ermöglichen',
|
||||
'feature.addressBook.name': 'Adressbuch',
|
||||
'feature.addressBook.description': 'Kontakt-Adressbuch verwalten und pflegen, um Kontaktinformationen für KI-Assistenten bereitzustellen',
|
||||
|
||||
// Address Book Management page
|
||||
'addressBookManagement.mainTitle': 'Adressbuchverwaltung',
|
||||
|
||||
@@ -1415,6 +1415,8 @@ export default {
|
||||
'feature.vad.description': 'Automatically detect voice activity to optimize voice interaction response efficiency',
|
||||
'feature.asr.name': 'Speech Recognition',
|
||||
'feature.asr.description': 'Convert speech to text to enable natural language interaction functionality',
|
||||
'feature.addressBook.name': 'Address Book',
|
||||
'feature.addressBook.description': 'Manage and maintain contact address book to provide contact information support for AI assistant',
|
||||
|
||||
// Address Book Management page
|
||||
'addressBookManagement.mainTitle': 'Address Book Management',
|
||||
|
||||
@@ -1415,6 +1415,8 @@ export default {
|
||||
'feature.vad.description': 'Detectar automaticamente atividade de voz para otimizar a eficiência de resposta da interação por voz',
|
||||
'feature.asr.name': 'Reconhecimento de Fala',
|
||||
'feature.asr.description': 'Converter fala em texto para habilitar a funcionalidade de interação por linguagem natural',
|
||||
'feature.addressBook.name': 'Lista de Contatos',
|
||||
'feature.addressBook.description': 'Gerenciar e manter lista de contatos para fornecer suporte de informações de contato para assistente de IA',
|
||||
|
||||
// Address Book Management page
|
||||
'addressBookManagement.mainTitle': 'Gerenciamento de Lista de Contatos',
|
||||
|
||||
@@ -1415,6 +1415,8 @@ export default {
|
||||
'feature.vad.description': 'Tự động phát hiện hoạt động giọng nói, tối ưu hóa hiệu suất phản hồi tương tác giọng nói',
|
||||
'feature.asr.name': 'Nhận dạng giọng nói',
|
||||
'feature.asr.description': 'Chuyển đổi giọng nói thành văn bản, thực hiện chức năng tương tác ngôn ngữ tự nhiên',
|
||||
'feature.addressBook.name': 'Danh bạ',
|
||||
'feature.addressBook.description': 'Quản lý và duy trì danh bạ liên lạc để cung cấp hỗ trợ thông tin liên lạc cho trợ lý AI',
|
||||
|
||||
// Address Book Management page
|
||||
'addressBookManagement.mainTitle': 'Quản lý danh bạ',
|
||||
|
||||
@@ -221,7 +221,8 @@ export default {
|
||||
isEditingAgentName: false,
|
||||
editAgentNameValue: '',
|
||||
editingDeviceId: null,
|
||||
editingDeviceName: ''
|
||||
editingDeviceName: '',
|
||||
mqttServiceAvailable: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -272,9 +273,10 @@ export default {
|
||||
type: device.board,
|
||||
deviceId: device.macAddress,
|
||||
remarks: device.alias || '',
|
||||
online: device.deviceStatus === 'online',
|
||||
online: false,
|
||||
createDate: device.createDate,
|
||||
lastConnectedAt: device.lastConnectedAt
|
||||
lastConnectedAt: device.lastConnectedAt,
|
||||
deviceStatus: 'offline'
|
||||
}));
|
||||
resolve();
|
||||
});
|
||||
@@ -283,6 +285,8 @@ export default {
|
||||
Promise.all(agentPromises).then(() => {
|
||||
this.agentDeviceOptions = agentList;
|
||||
this.filteredAgents = agentList;
|
||||
// 获取设备状态
|
||||
this.fetchDeviceStatus();
|
||||
});
|
||||
} else {
|
||||
this.agentDeviceOptions = [];
|
||||
@@ -290,6 +294,52 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
fetchDeviceStatus() {
|
||||
// 为每个智能体获取设备状态
|
||||
this.agentDeviceOptions.forEach(agent => {
|
||||
if (!agent.id) return;
|
||||
Api.device.getDeviceStatus(agent.id, (statusRes) => {
|
||||
if (statusRes.data?.code === 0) {
|
||||
try {
|
||||
const statusData = JSON.parse(statusRes.data.data);
|
||||
if (statusData && typeof statusData === 'object') {
|
||||
this.mqttServiceAvailable = true;
|
||||
this.updateDeviceStatusFromResponse(agent, statusData);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Parse device status error:', e);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
updateDeviceStatusFromResponse(agent, statusData) {
|
||||
if (!agent.devices) return;
|
||||
agent.devices.forEach(device => {
|
||||
const macAddress = device.deviceId ? device.deviceId.replace(/:/g, '_') : 'unknown';
|
||||
const groupId = device.type ? device.type.replace(/:/g, '_') : 'GID_default';
|
||||
const mqttClientId = `${groupId}@@@${macAddress}@@@${macAddress}`;
|
||||
|
||||
if (statusData[mqttClientId]) {
|
||||
const statusInfo = statusData[mqttClientId];
|
||||
let isOnline = false;
|
||||
if (statusInfo.isAlive === true) {
|
||||
isOnline = true;
|
||||
} else if (statusInfo.isAlive === false) {
|
||||
isOnline = false;
|
||||
} else if (statusInfo.isAlive === null && statusInfo.exists === true) {
|
||||
isOnline = true;
|
||||
} else {
|
||||
isOnline = false;
|
||||
}
|
||||
device.online = isOnline;
|
||||
device.deviceStatus = isOnline ? 'online' : 'offline';
|
||||
} else {
|
||||
device.online = false;
|
||||
device.deviceStatus = 'offline';
|
||||
}
|
||||
});
|
||||
},
|
||||
handleAgentClick(agent) {
|
||||
if (this.expandedAgentId === agent.id) {
|
||||
this.expandedAgentId = null;
|
||||
|
||||
Reference in New Issue
Block a user