Skip to content

Commit

Permalink
Refactoring of AssistantElement.vue
Browse files Browse the repository at this point in the history
  • Loading branch information
jschm42 committed Nov 23, 2023
1 parent 0a41ce3 commit dcf1ddb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 31 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/choice/AssistantElement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default {
<small class="text-body-secondary">{{ assistant.description }}</small>
</div>

<persona-compact-info :assistant="assistant"></persona-compact-info>
<persona-compact-info :assistant="assistant" :show-properties="false"></persona-compact-info>

</div>
</template>
Expand Down
58 changes: 28 additions & 30 deletions frontend/src/components/persona/PersonaCompactInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,50 +57,47 @@ export default {
mounted() {
if (this.showProperties) {
this.allowedKeys.push(
AssistantProperties.CHATGPT_TEMPERATURE,
AssistantProperties.CHATGPT_TOP_P,
AssistantProperties.CHATGPT_TEMPERATURE,
AssistantProperties.CHATGPT_TOP_P,
);
}
},
computed: {
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;
},
},
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';
Expand All @@ -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:
Expand Down

0 comments on commit dcf1ddb

Please sign in to comment.