Skip to content

Commit

Permalink
Merge branch 'main' of github.com:weni-ai/ia-platform-frontend into n…
Browse files Browse the repository at this point in the history
…exus-1264-redirect-to-intelligence-next-repository
  • Loading branch information
cristiantela committed May 23, 2024
2 parents 554b563 + ad69232 commit c3ff027
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 92 deletions.
54 changes: 44 additions & 10 deletions src/components/QuickTest/AnswerSources.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
<template>
<section class="sources">
<UnnnicIntelligenceText
color="neutral-cloudy"
family="secondary"
weight="regular"
size="body-md"
tag="p"
<UnnnicCollapse
size="md"
v-model="active"
:unspacedIcon="true"
>
{{ $tc('quick_test.sources', sources.length) }}

{{ list(sources) }}.
</UnnnicIntelligenceText>
<template slot="header">
<UnnnicIntelligenceText
color="neutral-cloudy"
family="secondary"
weight="regular"
size="body-md"
tag="p"
>
{{
$tc('quick_test.sources', sources.length, { len: sources.length })
}}
</UnnnicIntelligenceText></template
>
<UnnnicIntelligenceText
color="neutral-cloudy"
family="secondary"
weight="regular"
size="body-md"
tag="p"
>
{{ list(sources) }}.
</UnnnicIntelligenceText>
</UnnnicCollapse>
</section>
</template>

Expand All @@ -22,6 +39,12 @@ export default {
sources: Array,
},
data() {
return {
active: false,
};
},
methods: {
list(sources) {
const list = uniq(sources.map(this.name));
Expand Down Expand Up @@ -72,5 +95,16 @@ export default {
.sources {
margin-top: $unnnic-spacing-xs;
::v-deep .unnnic-collapse {
padding: 0;
}
::v-deep .unnnic-icon {
min-width: 10px;
min-height: 10px;
height: 10px;
width: 10px;
}
}
</style>
14 changes: 8 additions & 6 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"fields": {
"model": "Select model",
"token": "Token",
"token_info": "Code required to access OpenAI services. Get your token by creating an OpenAI account and generating an API key in the control panel.",
"version": "Version",
"select-language": "Language",
"language": "Select the default language",
Expand Down Expand Up @@ -162,6 +163,7 @@
"upload_content": "Upload content from files",
"drag_and_drop_your_file_here": "Drag and drop your file here to add the content to the AI knowledge base.",
"supported_files": "Supported formats: .pdf, .doc, docx, .txt, .xls and .xlsx.<br /> 250MB limit per file.",
"file_error": "File error. Delete and add again",
"browse_file": "Add file",
"uploaded_files": "Uploaded files",
"status": {
Expand Down Expand Up @@ -217,7 +219,7 @@
"liked": "Good answer",
"disliked": "Bad answer"
},
"sources": "Source: | Sources:"
"sources": "Source ({len}) | Sources ({len})"
},
"log": {
"interaction_received_on": "Interaction received on:",
Expand Down Expand Up @@ -1445,14 +1447,14 @@
}
},
"placeholders": {
"instruction": "Instruction",
"name": "Agent's name",
"occupation": "Agent's occupation",
"goal": "Agent's goal"
"instruction": "You're funny but you don't make jokes",
"name": "Tainá",
"occupation": "Llama expert",
"goal": "To answer questions and give information about llamas"
},
"instructions": {
"title": "General instructions",
"sub_title": "How you want the agent to behave. Example: You're funny but you don't make jokes.",
"sub_title": "How you want the agent to behave.",
"add_instruction_btn": "Add instruction",
"modals": {
"title": "Remove instruction",
Expand Down
14 changes: 8 additions & 6 deletions src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"fields": {
"model": "Seleccionar modelo",
"token": "Token",
"token_info": "Código necesario para acceder a los servicios de OpenAI. Obtén tu token creando una cuenta OpenAI y generando una clave API en el panel de control.",
"version": "Versión",
"version-gpt": "Versión",
"select-language": "Idioma",
Expand Down Expand Up @@ -162,6 +163,7 @@
"upload_content": "Cargar contenido a partir de archivos",
"drag_and_drop_your_file_here": "Arrastre y suelte su archivo aquí para añadir el contenido a la base de conocimientos de IA.",
"supported_files": "Formatos admitidos: .pdf, .doc, docx, .txt, .xls y .xlsx.<br /> Límite de 250 MB por archivo.",
"file_error": "Error de archivo. Eliminar y añadir de nuevo",
"browse_file": "Añadir archivo",
"uploaded_files": "Archivos cargados",
"status": {
Expand Down Expand Up @@ -217,7 +219,7 @@
"liked": "Buena respuesta",
"disliked": "Mala respuesta"
},
"sources": "Fuente: | Fuentes:"
"sources": "Fuente ({len}) | Fuentes ({len})"
},
"log": {
"interaction_received_on": "Interacción recibida el:",
Expand Down Expand Up @@ -1424,14 +1426,14 @@
}
},
"placeholders": {
"instruction": "Instrucción",
"name": "Nombre del agente",
"occupation": "Ocupación del agente",
"goal": "Objetivo del agente"
"instruction": "Eres gracioso pero no haces bromas",
"name": "Tainá",
"occupation": "Experto en llamas",
"goal": "Responder preguntas y dar información sobre llamas"
},
"instructions": {
"title": "Instrucciones generales",
"sub_title": "Cómo quieres que se comporte el agente. Ejemplo: Eres gracioso pero no haces chistes",
"sub_title": "Cómo quieres que se comporte el agente.",
"add_instruction_btn": "Añadir instrucción",
"modals": {
"title": "Quitar instrucción",
Expand Down
14 changes: 8 additions & 6 deletions src/locales/pt_br.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"fields": {
"model": "Selecione o modelo",
"token": "Token",
"token_info": "Código necessário para acessar os serviços da OpenAI. Obtenha o seu token criando uma conta na OpenAI e gerando uma chave de API no painel de controle.",
"version": "Versão",
"select-language": "Idioma",
"language": "Selecione o idioma padrão",
Expand Down Expand Up @@ -162,6 +163,7 @@
"upload_content": "Carregar conteúdo de arquivos",
"drag_and_drop_your_file_here": "Arraste e solte seu arquivo aqui para adicionar o conteúdo à base de conhecimento da IA.",
"supported_files": "Formatos suportados: .pdf, .doc, docx, .txt, .xls e .xlsx.<br /> Limite de 250MB por arquivo.",
"file_error": "Arquivo com erro. Exclua e adicione-o novamente.",
"browse_file": "Adicionar arquivo",
"uploaded_files": "Arquivos carregados",
"status": {
Expand Down Expand Up @@ -217,7 +219,7 @@
"liked": "Boa resposta",
"disliked": "Resposta ruim"
},
"sources": "Fonte: | Fontes:"
"sources": "Fonte ({len}) | Fontes ({len})"
},
"log": {
"interaction_received_on": "Interação recebida em:",
Expand Down Expand Up @@ -1403,14 +1405,14 @@
}
},
"placeholders": {
"instruction": "Instrução",
"name": "Nome do agente",
"occupation": "Ocupação do agente",
"goal": "Objetivo do agente"
"instruction": "Você é divertido mas não faz piadas",
"name": "Tainá",
"occupation": "Especialista em lhamas",
"goal": "Tirar dúvidas e dar informações sobre lhamas"
},
"instructions": {
"title": "Instruções gerais",
"sub_title": "Como você quer que o agente se comporte. Exemplo: Você é divertido mas não faz piadas.",
"sub_title": "Como você quer que o agente se comporte.",
"add_instruction_btn": "Adicionar instrução",
"modals": {
"title": "Remover instrução",
Expand Down
8 changes: 4 additions & 4 deletions src/store/brain/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ export const models = [
{
name: 'ChatGPT',
fields: [
{
type: 'password',
name: 'token',
},
{
type: 'select',
name: 'version-gpt',
default: 'gpt-4o',
options: ['gpt-3.5-turbo', 'gpt-4-turbo', 'gpt-4o'],
},
{
type: 'password',
name: 'token',
},
{
type: 'select',
name: 'language',
Expand Down
6 changes: 1 addition & 5 deletions src/views/repository/content/BasesFormFilesItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
:icon="file.status === 'fail' ? 'warning' : icon"
class="files-list__content__file__icon__itself"
:size="compressed ? 'sm' : 'avatar-nano'"
:scheme="file.status === 'fail' ? 'feedback-red' : 'weni-600'"
/>
</section>

Expand Down Expand Up @@ -229,13 +230,8 @@ export default {
&__icon {
display: flex;
background-color: $unnnic-color-neutral-light;
border-radius: $unnnic-border-radius-sm;
padding: 0.6875 * $unnnic-font-size;
&__itself {
color: $unnnic-color-neutral-clean;
}
}
&__content {
Expand Down
73 changes: 31 additions & 42 deletions src/views/repository/content/router/RouterCustomization.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
:placeholder="$t('customization.placeholders.name')"
/>
</UnnnicFormElement>
</div>
<div class="customization__form">
<UnnnicFormElement
:label="$t('customization.fields.occupation')"
class="customization__form-element"
Expand All @@ -26,33 +28,17 @@
:placeholder="$t('customization.placeholders.occupation')"
/>
</UnnnicFormElement>
</div>
<div class="customization__container__persona">
<section>
<UnnnicLabel
v-bind="$props"
:label="$t('customization.fields.personality')"
class="customization__container__label"
<UnnnicFormElement
:label="$t('customization.fields.personality')"
class="customization__form-element"
>
<UnnnicSelectSmart
:value="handlePersonalityValue(brain.agent.personality.current)"
@input="brain.agent.personality.current = $event[0].value"
:options="personalities"
orderedByIndex
/>
<div class="customization__personality">
<section
:class="[
'customization__personality__item',
{
'customization__personality-selected':
brain.agent.personality.current === item?.value,
},
]"
v-for="(item, index) in personalities"
:key="index"
@click="handlePersonalitySelect(item)"
>
<p>
{{ $t(`customization.fields.personalities.${item.label}`) }}
</p>
</section>
</div>
</section>
</UnnnicFormElement>
</div>
<div class="customization__container__persona">
<UnnnicTextArea
Expand Down Expand Up @@ -135,43 +121,43 @@ export default {
removing: false,
personalities: [
{
label: 'friendly',
label: this.$t('customization.fields.personalities.friendly'),
value: 'Amigável',
},
{
label: 'cooperative',
label: this.$t('customization.fields.personalities.cooperative'),
value: 'Cooperativo',
},
{
label: 'extrovert',
label: this.$t('customization.fields.personalities.extrovert'),
value: 'Extrovertido',
},
{
label: 'generous',
label: this.$t('customization.fields.personalities.generous'),
value: 'Generoso',
},
{
label: 'relaxed',
label: this.$t('customization.fields.personalities.relaxed'),
value: 'Relaxado',
},
{
label: 'organized',
label: this.$t('customization.fields.personalities.organized'),
value: 'Organizado',
},
{
label: 'systematic',
label: this.$t('customization.fields.personalities.systematic'),
value: 'Sistemático',
},
{
label: 'innovative',
label: this.$t('customization.fields.personalities.innovative'),
value: 'Inovador',
},
{
label: 'creative',
label: this.$t('customization.fields.personalities.creative'),
value: 'Criativo',
},
{
label: 'intellectual',
label: this.$t('customization.fields.personalities.intellectual'),
value: 'Intelectual',
},
],
Expand All @@ -198,6 +184,15 @@ export default {
this.showRemoveModal = true;
this.currentInstruction = index;
},
handlePersonalityValue(value) {
if (!value) {
return [this.personalities[0]];
}
const personality = this.personalities.find((e) => value === e.value);
return [personality];
},
async removeInstruction() {
try {
this.removing = true;
Expand Down Expand Up @@ -229,12 +224,6 @@ export default {
this.removing = false;
}
},
handlePersonalitySelect(personality) {
if (this.brain.agent.personality.current === personality.value) {
this.brain.agent.personality.current = '';
} else this.brain.agent.personality.current = personality.value;
},
},
};
</script>
Expand Down
Loading

0 comments on commit c3ff027

Please sign in to comment.