From dcf1ddb01361c1255121e6e4ae71a4600afc9bda Mon Sep 17 00:00:00 2001 From: Jean Schmitz Date: Thu, 23 Nov 2023 10:48:07 +0100 Subject: [PATCH] Refactoring of AssistantElement.vue --- .../components/choice/AssistantElement.vue | 2 +- .../components/persona/PersonaCompactInfo.vue | 58 +++++++++---------- 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/frontend/src/components/choice/AssistantElement.vue b/frontend/src/components/choice/AssistantElement.vue index 6b340a6a..80e6f9be 100644 --- a/frontend/src/components/choice/AssistantElement.vue +++ b/frontend/src/components/choice/AssistantElement.vue @@ -82,7 +82,7 @@ export default { {{ assistant.description }} - + diff --git a/frontend/src/components/persona/PersonaCompactInfo.vue b/frontend/src/components/persona/PersonaCompactInfo.vue index 33ae7057..3882481d 100644 --- a/frontend/src/components/persona/PersonaCompactInfo.vue +++ b/frontend/src/components/persona/PersonaCompactInfo.vue @@ -57,8 +57,8 @@ export default { mounted() { if (this.showProperties) { this.allowedKeys.push( - AssistantProperties.CHATGPT_TEMPERATURE, - AssistantProperties.CHATGPT_TOP_P, + AssistantProperties.CHATGPT_TEMPERATURE, + AssistantProperties.CHATGPT_TOP_P, ); } }, @@ -66,32 +66,30 @@ export default { properties() { let result = []; - // if (this.assistant.properties[PersonaProperties.CHATGPT_MODEL]) { - // result.push({ - // key: PersonaProperties.CHATGPT_MODEL, - // value: this.persona.properties[PersonaProperties.CHATGPT_MODEL], - // }); - // } - // - // if (this.persona.properties[PersonaProperties.TTS_TYPE] === TTSType.ELEVENLABS) { - // result.push({ - // key: TTSType.ELEVENLABS, - // value: this.persona.properties[PersonaProperties.ELEVENLABS_MODELID], - // }); - // } else if (this.persona.properties[PersonaProperties.TTS_TYPE] === TTSType.SPEECHAPI) { - // result.push({ - // key: TTSType.SPEECHAPI, - // value: this.persona.properties[PersonaProperties.SPEECHAPI_VOICE], - // }); - // } + result.push({ + key: 'model', + value: this.assistant.model, + }); - // if (this.persona.properties) { - // Object.keys(this.persona.properties).filter((key) => { - // return this.allowedKeys.indexOf(key) !== -1; - // }).forEach((key) => { - // result.push({key: key, value: this.persona.properties[key]}); - // }); - // } + if (this.assistant.properties[AssistantProperties.TTS_TYPE] === TTSType.ELEVENLABS) { + result.push({ + key: TTSType.ELEVENLABS, + value: this.assistant.properties[AssistantProperties.ELEVENLABS_MODELID], + }); + } else if (this.assistant.properties[AssistantProperties.TTS_TYPE] === TTSType.SPEECHAPI) { + result.push({ + key: TTSType.SPEECHAPI, + value: this.assistant.properties[AssistantProperties.SPEECHAPI_VOICE], + }); + } + + if (this.assistant.properties) { + Object.keys(this.assistant.properties).filter((key) => { + return this.allowedKeys.indexOf(key) !== -1; + }).forEach((key) => { + result.push({key: key, value: this.assistant.properties[key]}); + }); + } return result; }, @@ -99,8 +97,7 @@ export default { methods: { badgeColor(key) { switch (key) { - case AssistantProperties.CHATGPT_MODEL: - return 'text-bg-primary'; + case 'model': case TTSType.ELEVENLABS: case TTSType.SPEECHAPI: return 'text-bg-info'; @@ -114,7 +111,8 @@ export default { }, badgeLabel(item) { switch (item.key) { - case AssistantProperties.CHATGPT_MODEL: + case 'model': + return item.value; case AssistantProperties.ELEVENLABS_MODELID: return item.value; case AssistantProperties.CHATGPT_TEMPERATURE: