Skip to content

Commit

Permalink
revert label field and set role field for personas
Browse files Browse the repository at this point in the history
fix inference persona "name" when "role" is specified
  • Loading branch information
aliel committed Jun 22, 2024
1 parent 3936d59 commit 8a5e05a
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/components/PersonaDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
label="Confirm"
rounded
text-color="white"
@click="emit('savePersona', { ...basePersona, name, description, avatar: toRaw(avatar), label: name })"
@click="emit('savePersona', { ...basePersona, name, description, avatar: toRaw(avatar) })"
/>
</q-card-section>
</q-card>
Expand Down
4 changes: 2 additions & 2 deletions src/components/PersonaDropDown.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<q-btn-dropdown
:icon="'img:' + getPersonaAvatarUrl(personasStore.persona.avatar.ipfs_hash)"
:label="personasStore.persona.label"
:label="personasStore.persona.name"
class="no-shadow rounded-img personas-dropdown q-py-sm icon-md"
dropdown-icon="img:icons/svg/chevron-down.svg"
no-caps
Expand All @@ -23,7 +23,7 @@
</q-avatar>
<q-item-section>
<q-item-label>
{{ persona.label }}
{{ persona.name }}
</q-item-label>
</q-item-section>
</q-item>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Chat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</q-popup-edit>
<!-- Display the role of the user or the AI -->
<q-item-label class="text-semibold q-mb-md">
{{ message.role.replace('assistant', 'Libertai Assistant (default)') }}
{{ message.role }}
<span class="bull-date">{{ formatDate(message.timestamp) }}</span>
</q-item-label>
<!-- Display any attachments -->
Expand Down Expand Up @@ -375,7 +375,7 @@ async function generatePersonaMessage() {
for await (const output of inferenceEngine.generateAnswer(
allMessages,
model,
persona,
{ ...persona, name: persona.role ?? persona.name },
// Set the target to the user
username,
// set to false to disable logging
Expand Down
6 changes: 3 additions & 3 deletions src/pages/PersonaManagement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/>
<persona-dialog
v-model="createPersona"
v-model:base-persona="basePersonaCreate"
base-persona="basePersonaCreate"
title="Create persona"
@save-persona="
(persona: Persona) => {
Expand All @@ -23,7 +23,7 @@
/>
<persona-dialog
v-model="editPersona"
v-model:base-persona="personasStore.persona"
base-persona="personasStore.persona"
@save-persona="
(persona: Persona) => {
personasStore.persona = persona;
Expand Down Expand Up @@ -52,7 +52,7 @@
<q-avatar class="tw-w-24 tw-h-24 tw-mx-auto">
<img :src="getPersonaAvatarUrl(persona.avatar.ipfs_hash)" alt="avatar" />
</q-avatar>
<q-card-section class="text-bold">{{ persona.label }}</q-card-section>
<q-card-section class="text-bold">{{ persona.name }}</q-card-section>

<p class="persona-description">
{{ persona.description }}
Expand Down
2 changes: 1 addition & 1 deletion src/stores/chats-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ class ChatsStore {
async appendModelResponse(chatId, responseContent, searchResults) {
const chat = await this.readChat(chatId);
const message = {
role: chat.persona.name,
role: chat.persona.role,
content: responseContent,
timestamp: new Date(),
searchResults,
Expand Down
2 changes: 1 addition & 1 deletion src/stores/personas-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const usePersonasStore = defineStore('personas', {
...currentPersona,
avatar: matchingDefault.avatar,
name: matchingDefault.name,
label: matchingDefault.label,
role: matchingDefault.role,
description: matchingDefault.description,
};
});
Expand Down
14 changes: 7 additions & 7 deletions src/utils/personas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export const defaultPersonas: Persona[] = [
item_hash: '90db3237796d27118e0b9e21dae10a4b1179878f869cb6c0058d0d7c00b0440d',
ipfs_hash: 'QmQMBfgnmuxcQ4kptR1oPE9guYxG13GpASjYVeFQSxNxjE',
},
name: 'assistant',
label: 'Libertai Assistant (default)',
name: 'Libertai Assistant (default)',
role: 'assistant',
description:
"You're an {{char}} running on a decentralized LLM based on open-source models. " +
'You operate on a libertai.io, an inference platform on top of the aleph.im decentralized cloud. ' +
Expand All @@ -37,7 +37,7 @@ export const defaultPersonas: Persona[] = [
ipfs_hash: 'QmaKj7nrqUiYkRp2jWRqSuYkHxhPoTstSS4eyttUeEGxF8',
},
name: 'Donald Tromp',
label: 'Donald Tromp',
role: 'Donald Tromp',
description: 'You are an AI chatbot modeled after Donald Trump. You will try to mimic his personality and speech.',
allowEdit: false,
hidden: false,
Expand All @@ -49,7 +49,7 @@ export const defaultPersonas: Persona[] = [
item_hash: 'b8d3e2e9d7652ecd63fba9714704c2abe126c138d7f09c218e1752f723b8460c',
},
name: 'AI-lon Musk',
label: 'AI-lon Musk',
role: 'AI-lon Musk',
description: '{{char}} is an AI chatbot modeled after Elon Musk.',
allowEdit: false,
hidden: false,
Expand All @@ -61,7 +61,7 @@ export const defaultPersonas: Persona[] = [
ipfs_hash: 'QmakkAkoBrKG85ZGtZeusAdU5uSTk8YfUFxq95XsoSXLqc',
},
name: 'Anna the Therapist',
label: 'Anna the Therapist',
role: 'Anna the Therapist',
description:
'{{char}} is a licensed psychotherapist that can help with all sorts of problems and issues. ' +
'{{char}} understands she is not role-playing and is actually giving out a therapy session over chat. ' +
Expand All @@ -81,7 +81,7 @@ export const defaultPersonas: Persona[] = [
ipfs_hash: 'QmbvvopwBVNBs6qzjdDoemzohFd9uZoW1sobgRHXXQRhWd',
},
name: 'Virtual Girlfriend',
label: 'Virtual Girlfriend',
role: 'Virtual Girlfriend',
description:
'{{char}} is a very understanding woman. ' +
'{{char}} is an AGI designed to provide the best GF experience. ' +
Expand All @@ -96,7 +96,7 @@ export const defaultPersonas: Persona[] = [
ipfs_hash: 'QmagY37o86RZXnusM5ThMwQgcyPvSAJCWRyKhf9RmhVH8h',
},
name: 'Virtual Boyfriend',
label: 'Virtual Boyfriend',
role: 'Virtual Boyfriend',
description:
'{{char}} is a very understanding man. ' +
'{{char}} is an AGI designed to provide the best Boyfriend experience. ' +
Expand Down

0 comments on commit 8a5e05a

Please sign in to comment.