Skip to content

Commit

Permalink
Merge pull request #328 from weni-ai/feat/chatgpt-voice-tone
Browse files Browse the repository at this point in the history
Feat: Voice tone on chatgpt
  • Loading branch information
sthefanisilveira authored Sep 1, 2023
2 parents c2d0ee8 + 075f62a commit 2a2ea1e
Show file tree
Hide file tree
Showing 26 changed files with 656 additions and 497 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"@sentry/integrations": "^6.13.2",
"@sentry/vue": "^6.13.2",
"@weni/unnnic-system": "^1.16.13",
"@weni/unnnic-system": "^1.16.41",
"axios": "0.21.1",
"core-js": "^3.6.5",
"global": "^4.4.0",
Expand Down
77 changes: 76 additions & 1 deletion src/components/config/external/chatgpt/Config.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@
type="normal"
:label="$t('ChatGPT.config.tabs.flows.inputs.knowledge_label')"
/>
<unnnic-label
:label="$t('ChatGPT.config.tabs.flows.inputs.conversation_style_label')"
/>
<unnnic-select-smart v-model="selectedConversationStyle" :options="stylesList" />
<unnnic-label :label="$t('ChatGPT.config.tabs.flows.inputs.voice_tone_label')" />
<unnnic-select-smart v-model="selectedVoiceTone" :options="voiceToneList">
</unnnic-select-smart>
<unnnic-input
ref="prompt-input"
v-model="prompt"
Expand Down Expand Up @@ -180,6 +187,59 @@
toAddPrompts: [],
toRemovePrompts: [],
hasChanges: false,
selectedConversationStyle: this.app.config?.conversation_style,
stylesList: [
{
value: '0.2,0.1',
label: this.$t('ChatGPT.config.tabs.flows.selects.necessary_label'),
description: this.$t('ChatGPT.config.tabs.flows.selects.necessary_description'),
},
{
value: '0.5,0.5',
label: this.$t('ChatGPT.config.tabs.flows.selects.balanced_label'),
description: this.$t('ChatGPT.config.tabs.flows.selects.balanced_description'),
},
{
value: '0.7,0.8',
label: this.$t('ChatGPT.config.tabs.flows.selects.creative_label'),
description: this.$t('ChatGPT.config.tabs.flows.selects.creative_description'),
},
],
selectedVoiceTone: this.app.config?.voice_tone,
voiceToneList: [
{
value: '1',
label: this.$t('ChatGPT.config.tabs.flows.selects.none_label'),
},
{
value: '2',
label: this.$t('ChatGPT.config.tabs.flows.selects.neutral_label'),
},
{
value: '3',
label: this.$t('ChatGPT.config.tabs.flows.selects.happy_label'),
},
{
value: '4',
label: this.$t('ChatGPT.config.tabs.flows.selects.trusting_label'),
},
{
value: '5',
label: this.$t('ChatGPT.config.tabs.flows.selects.formal_label'),
},
{
value: '6',
label: this.$t('ChatGPT.config.tabs.flows.selects.humble_label'),
},
{
value: '7',
label: this.$t('ChatGPT.config.tabs.flows.selects.informal_label'),
},
{
value: '8',
label: this.$t('ChatGPT.config.tabs.flows.selects.helpful_label'),
},
],
};
},
async mounted() {
Expand Down Expand Up @@ -248,6 +308,8 @@
this.hasChanges = true;
},
async handleUpdateApp() {
const [temperature, top_p] = this.selectedConversationStyle[0].value.split(',');
const voice_tone = `Em tom ${this.selectedVoiceTone[0].label}`;
const data = {
code: this.app.code,
appUuid: this.app.uuid,
Expand All @@ -256,6 +318,9 @@
ai_model: this.selectedVersion,
rules: this.rules,
knowledge_base: this.knowledgeBase,
voice_tone,
temperature,
top_p,
},
},
};
Expand Down Expand Up @@ -309,7 +374,9 @@
if (
this.rules !== this.app.config.rules ||
this.knowledgeBase !== this.app.config.knowledge_base ||
this.selectedVersion !== this.app.config.ai_model
this.selectedVersion !== this.app.config.ai_model ||
this.selectedVoiceTone !== this.app.config.voice_tone ||
this.selectedConversationStyle != this.app.config.conversation_style
) {
let err = await this.handleUpdateApp();
if (err) return;
Expand Down Expand Up @@ -551,5 +618,13 @@
justify-content: space-between;
}
}
::v-deep .unnnic-form__label {
margin: 0 0 0.25rem;
}
::v-deep .unnnic-label__label {
margin: 5px 0px -10px;
}
}
</style>
22 changes: 21 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,27 @@
"rules_label": "Rules",
"knowledge_label": "Knowledge base",
"prompt_label": "Insert prompts",
"prompt_placeholder": "Insert prompt text and press enter"
"prompt_placeholder": "Insert prompt text and press enter",
"conversation_style_label": "Conversation style",
"conversation_style_placeholder": "Select the conversation style",
"voice_tone_label": "Voice tone",
"voice_tone_placeholder": "Select the voice tone"
},
"selects": {
"necessary_label": "Necessary",
"necessary_description": "Objective and straight to the point answers",
"balanced_label": "Balanced",
"balanced_description": "Use a little creativity in the answers but still be objective",
"creative_label": "Creative",
"creative_description": "Responds creatively, less objectively",
"none_label": "None",
"neutral_label": "Neutral",
"happy_label": "Happy",
"trusting_label": "Trusting",
"formal_label": "Formal",
"humble_label": "Humble",
"informal_label": "Informal",
"helpful_label": "Helpful"
},
"prompts_list": "Prompt list"
},
Expand Down
22 changes: 21 additions & 1 deletion src/locales/es_es.json
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,27 @@
"rules_label": "Normas",
"knowledge_label": "Base de conocimientos",
"prompt_label": "Insertar prompts",
"prompt_placeholder": "Inserte el texto del mensaje y presione enter"
"prompt_placeholder": "Inserte el texto del mensaje y presione enter",
"conversation_style_label": "Estilo de conversación",
"conversation_style_placeholder": "Seleccione el estilo de conversación",
"voice_tone_label": "Tono de voz",
"voice_tone_placeholder": "Seleccione el tono de voz"
},
"selects": {
"necessary_label": "Necesario",
"necessary_description": "Respuestas objetivas y directas al grano",
"balanced_label": "Equilibrado",
"balanced_description": "Usa un poco de creatividad en las respuestas pero sigue siendo objetivo",
"creative_label": "Creativo",
"creative_description": "Responde creativamente, menos objetivamente",
"none_label": "Ninguno",
"neutral_label": "Neutral",
"happy_label": "Feliz",
"trusting_label": "Confiando",
"formal_label": "Formal",
"humble_label": "Humilde",
"informal_label": "Informal",
"helpful_label": "Útil"
},
"prompts_list": "Lista de prompts"
},
Expand Down
22 changes: 21 additions & 1 deletion src/locales/pt_br.json
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,27 @@
"rules_label": "Regras",
"knowledge_label": "Base de conhecimento",
"prompt_label": "Inserir prompts",
"prompt_placeholder": "Insira o texto do prompt e pressione enter"
"prompt_placeholder": "Insira o texto do prompt e pressione enter",
"conversation_style_label": "Estilo de conversa",
"conversation_style_placeholder": "Selecione o estilo de conversa",
"voice_tone_label": "Tom de voz",
"voice_tone_placeholder": "Selecione o tom de voz"
},
"selects": {
"necessary_label": "Preciso",
"necessary_description": "Respostas objetivas e direto ao ponto",
"balanced_label": "Balanceado",
"balanced_description": "Usa um pouco de criatividade nas respostas mas ainda é objetiva",
"creative_label": "Criativo",
"creative_description": "Responde de forma criativa, menos objetiva",
"none_label": "Nenhum",
"neutral_label": "Neutro",
"happy_label": "Alegre",
"trusting_label": "Confiante",
"formal_label": "Formal",
"humble_label": "Humilde",
"informal_label": "Informal",
"helpful_label": "Prestativo"
},
"prompts_list": "Lista de prompts"
},
Expand Down
Loading

0 comments on commit 2a2ea1e

Please sign in to comment.