Upgrade to openai style for aichat (#46)
This commit is contained in:
1 parent
3918446e7a
commit
7869cc0acd
14 files changed
+431
-220
No files matched your search
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"type": "minor",
|
||||
"comment": "adapt to latest chatgpt stlye for aichat",
|
||||
"packageName": "@acedatacloud/nexior",
|
||||
"email": "germey@acedata.cloud",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
||||
@@ -173,8 +173,8 @@ export default defineComponent({
|
||||
margin: auto;
|
||||
}
|
||||
.info {
|
||||
font-size: 14px;
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
text-align: center;
|
||||
}
|
||||
.actions {
|
||||
|
||||
@@ -155,6 +155,7 @@ export default defineComponent({
|
||||
|
||||
<style lang="scss">
|
||||
textarea.input {
|
||||
font-size: 14px;
|
||||
min-height: 35px;
|
||||
max-height: 350px;
|
||||
border: none;
|
||||
@@ -171,7 +172,6 @@ textarea.input:focus {
|
||||
outline: none;
|
||||
}
|
||||
.input-box {
|
||||
// height: auto;
|
||||
position: relative;
|
||||
.input {
|
||||
textarea {
|
||||
@@ -197,11 +197,12 @@ textarea.input:focus {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.input-box {
|
||||
width: 100%;
|
||||
border: 1px solid var(--el-border-color);
|
||||
border-radius: 10px;
|
||||
background: none;
|
||||
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.1);
|
||||
width: 800px;
|
||||
margin: auto;
|
||||
position: relative;
|
||||
border-radius: 20px;
|
||||
background: var(--el-bg-color-page);
|
||||
padding: 5px;
|
||||
.upload {
|
||||
display: inline-block;
|
||||
&.disabled {
|
||||
@@ -216,18 +217,18 @@ textarea.input:focus {
|
||||
.input {
|
||||
border: none;
|
||||
width: calc(100% - 80px);
|
||||
margin-left: 30px;
|
||||
margin-left: 35px;
|
||||
}
|
||||
.btn {
|
||||
display: block;
|
||||
z-index: 100;
|
||||
cursor: pointer;
|
||||
bottom: 15px;
|
||||
position: absolute;
|
||||
top: 7px;
|
||||
&.btn-upload {
|
||||
left: 10px;
|
||||
left: 15px;
|
||||
.icon-attachment {
|
||||
font-size: 14px;
|
||||
font-size: 16px;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
}
|
||||
@@ -250,9 +251,9 @@ textarea.input:focus {
|
||||
.info {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
color: var(--el-text-color-secondary);
|
||||
margin-top: 5px;
|
||||
margin-left: 3px;
|
||||
text-align: center;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -1,67 +1,13 @@
|
||||
<template>
|
||||
<div class="introduction">
|
||||
<el-row class="introduction-items" justify="center" :gutter="15">
|
||||
<el-col :md="8" :sm="24" :xs="24">
|
||||
<div class="text-center">
|
||||
<font-awesome-icon icon="fa-regular fa-sun" class="icon icon-rotate" />
|
||||
</div>
|
||||
<h3 class="subtitle">{{ $t('chat.title.complexQuestion') }}</h3>
|
||||
<el-row class="items" justify="center" :gutter="15">
|
||||
<el-col v-for="(item, itemKey) in items" :key="itemKey" :md="6" :sm="12" :xs="24">
|
||||
<introduction-item
|
||||
:content="$t('chat.message.question1')"
|
||||
:content="item.content"
|
||||
:icon="item.icon"
|
||||
:color="item.color"
|
||||
class="cursor-pointer"
|
||||
@click="$emit('draft', $t('chat.message.question1'))"
|
||||
/>
|
||||
<introduction-item
|
||||
:content="$t('chat.message.question2')"
|
||||
class="cursor-pointer"
|
||||
@click="$emit('draft', $t('chat.message.question2'))"
|
||||
/>
|
||||
<introduction-item
|
||||
:content="$t('chat.message.question3')"
|
||||
class="cursor-pointer"
|
||||
@click="$emit('draft', $t('chat.message.question3'))"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :md="8" :sm="24" :xs="24">
|
||||
<div class="text-center">
|
||||
<font-awesome-icon icon="fa-solid fa-book" class="icon icon-rotate" />
|
||||
</div>
|
||||
<h3 class="subtitle">{{ $t('chat.title.professionalQuestion') }}</h3>
|
||||
<introduction-item
|
||||
:content="$t('chat.message.question4')"
|
||||
class="cursor-pointer"
|
||||
@click="$emit('draft', $t('chat.message.question4'))"
|
||||
/>
|
||||
<introduction-item
|
||||
:content="$t('chat.message.question5')"
|
||||
class="cursor-pointer"
|
||||
@click="$emit('draft', $t('chat.message.question5'))"
|
||||
/>
|
||||
<introduction-item
|
||||
:content="$t('chat.message.question6')"
|
||||
class="cursor-pointer"
|
||||
@click="$emit('draft', $t('chat.message.question6'))"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :md="8" :sm="24" :xs="24">
|
||||
<div class="text-center">
|
||||
<font-awesome-icon icon="fa-solid fa-fire" class="icon icon-rotate" />
|
||||
</div>
|
||||
<h3 class="subtitle">{{ $t('chat.title.getTips') }}</h3>
|
||||
<introduction-item
|
||||
:content="$t('chat.message.question7')"
|
||||
class="cursor-pointer"
|
||||
@click="$emit('draft', $t('chat.message.question7'))"
|
||||
/>
|
||||
<introduction-item
|
||||
:content="$t('chat.message.question8')"
|
||||
class="cursor-pointer"
|
||||
@click="$emit('draft', $t('chat.message.question8'))"
|
||||
/>
|
||||
<introduction-item
|
||||
:content="$t('chat.message.question9')"
|
||||
class="cursor-pointer"
|
||||
@click="$emit('draft', $t('chat.message.question9'))"
|
||||
@click="$emit('draft', item.content)"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -70,21 +16,42 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import IntroductionItem from './IntroductionItem.vue';
|
||||
import { ElRow, ElCol } from 'element-plus';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ConversationIntroduction',
|
||||
components: {
|
||||
FontAwesomeIcon,
|
||||
IntroductionItem,
|
||||
ElRow,
|
||||
ElCol
|
||||
},
|
||||
emits: ['draft'],
|
||||
data() {
|
||||
return {};
|
||||
return {
|
||||
items: [
|
||||
{
|
||||
icon: 'fa-solid fa-pen-nib',
|
||||
content: this.$t('chat.message.question1'),
|
||||
color: 'rgb(226, 197, 65)'
|
||||
},
|
||||
{
|
||||
icon: 'fa-solid fa-laptop-code',
|
||||
content: this.$t('chat.message.question2'),
|
||||
color: 'rgb(203, 139, 208)'
|
||||
},
|
||||
{
|
||||
icon: 'fa-solid fa-fan',
|
||||
content: this.$t('chat.message.question3'),
|
||||
color: 'rgb(118, 208, 235)'
|
||||
},
|
||||
{
|
||||
icon: 'fa-solid fa-plane-departure',
|
||||
content: this.$t('chat.message.question4'),
|
||||
color: 'rgb(237, 98, 98)'
|
||||
}
|
||||
].sort(() => Math.random() - 0.5)
|
||||
};
|
||||
},
|
||||
computed: {}
|
||||
});
|
||||
@@ -92,34 +59,16 @@ export default defineComponent({
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.introduction {
|
||||
width: 80%;
|
||||
margin: auto;
|
||||
padding: 30px 0;
|
||||
padding: 60px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.title {
|
||||
height: 70px;
|
||||
text-align: center;
|
||||
display: block;
|
||||
font-size: 36px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
.introduction-items {
|
||||
height: fit-content;
|
||||
.icon {
|
||||
font-size: 20px;
|
||||
}
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.introduction-item {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.items {
|
||||
width: 800px;
|
||||
margin: auto;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,9 +80,6 @@ export default defineComponent({
|
||||
transform: initial;
|
||||
width: 90%;
|
||||
margin: auto;
|
||||
.introduction-items {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,18 +1,41 @@
|
||||
<template>
|
||||
<div class="introduction-item">
|
||||
{{ content }}
|
||||
<div class="item">
|
||||
<div class="icon">
|
||||
<font-awesome-icon
|
||||
:icon="icon"
|
||||
:style="{
|
||||
color: color
|
||||
}"
|
||||
/>
|
||||
</div>
|
||||
<div class="content">
|
||||
{{ content }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import { color } from '@codemirror/theme-one-dark';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ConversationIntroductionItem',
|
||||
components: {
|
||||
FontAwesomeIcon
|
||||
},
|
||||
props: {
|
||||
content: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
icon: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: 'rgb(0, 0, 0)'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -23,12 +46,20 @@ export default defineComponent({
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.introduction-item {
|
||||
.item {
|
||||
height: 100px;
|
||||
font-size: 14px;
|
||||
background-color: var(--el-fill-color-extra-light);
|
||||
background-color: var(--el-color-white);
|
||||
color: var(--el-text-color-primary);
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
padding: 10px 20px;
|
||||
border-radius: 20px;
|
||||
&:hover {
|
||||
background-color: var(--el-bg-color-page);
|
||||
}
|
||||
.icon {
|
||||
font-size: 14px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -46,7 +46,7 @@ import {
|
||||
ERROR_CODE_USED_UP,
|
||||
ROLE_ASSISTANT
|
||||
} from '@/constants';
|
||||
import message from '@/i18n/zh/common/message';
|
||||
// import message from '@/i18n/zh/common/message';
|
||||
import { ROUTE_CONSOLE_APPLICATION_BUY } from '@/router';
|
||||
|
||||
interface IData {
|
||||
@@ -159,19 +159,17 @@ export default defineComponent({
|
||||
.content {
|
||||
background-color: var(--el-bg-color-page);
|
||||
color: var(--el-text-color-primary);
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
}
|
||||
&.user {
|
||||
align-items: end;
|
||||
.content {
|
||||
background-color: var(--el-color-primary);
|
||||
color: var(--el-color-white);
|
||||
border-bottom-right-radius: 0;
|
||||
background-color: var(--el-bg-color-page);
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
}
|
||||
.content {
|
||||
border-radius: 10px;
|
||||
border-radius: 20px;
|
||||
padding: 8px 15px;
|
||||
max-width: 800px;
|
||||
.image {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="model-selector">
|
||||
<div class="selector">
|
||||
<el-dropdown
|
||||
v-for="(group, groupIndex) in groups"
|
||||
:key="groupIndex"
|
||||
@@ -137,7 +137,7 @@ export default defineComponent({
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.model-selector {
|
||||
.selector {
|
||||
background-color: var(--el-bg-color-page);
|
||||
padding: 7px 6px;
|
||||
border-radius: 15px;
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
<template>
|
||||
<div class="selector">
|
||||
<el-dropdown trigger="click" popper-class="popper">
|
||||
<div>
|
||||
<span class="name">{{ model?.getDisplayName() }}</span>
|
||||
<span class="angle">
|
||||
<font-awesome-icon icon="fa-solid fa-angle-down" />
|
||||
</span>
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item
|
||||
v-for="(option, optionKey) in options"
|
||||
:key="optionKey"
|
||||
@click="onCommandChange(option.model)"
|
||||
>
|
||||
<div class="item">
|
||||
<div class="icon" :style="{ color: option.color }">
|
||||
<font-awesome-icon :icon="option.icon" />
|
||||
</div>
|
||||
<div class="info">
|
||||
<p class="name">{{ option.model.getDisplayName() }}</p>
|
||||
<p class="description">{{ option.model.getDescription() }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElDropdown, ElDropdownItem, ElDropdownMenu } from 'element-plus';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import { IChatModel } from '@/models';
|
||||
import {
|
||||
CHAT_MODEL_GPT_3_5,
|
||||
CHAT_MODEL_GPT_3_5_BROWSING,
|
||||
CHAT_MODEL_GPT_4,
|
||||
CHAT_MODEL_GPT_4_BROWSING,
|
||||
CHAT_MODEL_GPT_4_VISION
|
||||
} from '@/constants';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ModelSelector',
|
||||
components: {
|
||||
ElDropdown,
|
||||
ElDropdownMenu,
|
||||
ElDropdownItem,
|
||||
FontAwesomeIcon
|
||||
},
|
||||
emits: ['update:modelValue', 'select'],
|
||||
data() {
|
||||
return {
|
||||
options: [
|
||||
{
|
||||
icon: 'fa-solid fa-bolt',
|
||||
color: '#ff9900',
|
||||
model: CHAT_MODEL_GPT_3_5
|
||||
},
|
||||
{
|
||||
icon: 'fa-solid fa-bolt',
|
||||
color: '#ff9900',
|
||||
model: CHAT_MODEL_GPT_3_5_BROWSING
|
||||
},
|
||||
{
|
||||
icon: 'fa-solid fa-wand-magic-sparkles',
|
||||
color: '#ce65e6',
|
||||
model: CHAT_MODEL_GPT_4
|
||||
},
|
||||
{
|
||||
icon: 'fa-solid fa-wand-magic-sparkles',
|
||||
color: '#ce65e6',
|
||||
model: CHAT_MODEL_GPT_4_BROWSING
|
||||
},
|
||||
{
|
||||
icon: 'fa-solid fa-wand-magic-sparkles',
|
||||
color: '#ce65e6',
|
||||
model: CHAT_MODEL_GPT_4_VISION
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
model() {
|
||||
const modelName = this.$store.state.chat.model.name;
|
||||
const model = [
|
||||
CHAT_MODEL_GPT_3_5,
|
||||
CHAT_MODEL_GPT_3_5_BROWSING,
|
||||
CHAT_MODEL_GPT_4,
|
||||
CHAT_MODEL_GPT_4_BROWSING,
|
||||
CHAT_MODEL_GPT_4_VISION
|
||||
].find((model) => model.name === modelName);
|
||||
return model;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onCommandChange(command: IChatModel) {
|
||||
this.$emit('select', command);
|
||||
this.$store.dispatch('chat/setModel', command);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.popper {
|
||||
border-radius: 20px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.selector {
|
||||
cursor: pointer;
|
||||
padding: 7px 6px;
|
||||
border-radius: 15px;
|
||||
margin-bottom: 5px;
|
||||
.name {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
display: inline-block;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.angle {
|
||||
display: inline-block;
|
||||
max-width: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
.icon {
|
||||
width: 15px;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
margin-right: 5px;
|
||||
margin-top: 3px;
|
||||
&.base {
|
||||
color: #ff9900;
|
||||
}
|
||||
&.plus {
|
||||
color: #ce65e6;
|
||||
}
|
||||
}
|
||||
.info {
|
||||
width: calc(100% - 15px);
|
||||
.name {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
color: var(--el-text-color-primary);
|
||||
margin: 0;
|
||||
}
|
||||
.description {
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="panel">
|
||||
<el-skeleton v-if="loading && conversations === undefined" />
|
||||
<el-skeleton v-if="loading && conversationGroups === undefined" />
|
||||
<div v-else class="conversations">
|
||||
<div class="conversation" @click="onNewConversation">
|
||||
<div class="icons">
|
||||
@@ -10,54 +10,56 @@
|
||||
{{ $t('chat.message.startNewChat') }}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-for="(conversation, conversationIndex) in conversations"
|
||||
:key="conversationIndex"
|
||||
:class="{ conversation: true, active: conversation.id === conversationId }"
|
||||
@click="onClick(conversation.id)"
|
||||
>
|
||||
<div class="icons">
|
||||
<font-awesome-icon icon="fa-regular fa-comment" class="icon" />
|
||||
<div v-for="(conversations, groupKey) in conversationGroups" :key="groupKey" class="group">
|
||||
<div class="key">
|
||||
{{ $t(`chat.group.${groupKey}`) }}
|
||||
</div>
|
||||
<div class="title">
|
||||
<span v-if="conversation?.deleting">
|
||||
{{ `${$t('chat.message.confirmDelete')}?` }}
|
||||
</span>
|
||||
<span v-else-if="conversation?.editing">
|
||||
<el-input v-model="conversation.title" @keydown.enter="onConfirm(conversation)" />
|
||||
</span>
|
||||
<span v-else-if="conversation?.title || conversation?.messages">{{
|
||||
conversation?.title || conversation?.messages[conversation?.messages.length - 1]?.content
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="operations">
|
||||
<font-awesome-icon
|
||||
v-if="!conversation?.editing && !conversation.deleting"
|
||||
icon="fa-solid fa-edit"
|
||||
class="icon icon-edit"
|
||||
@click.stop="conversation.editing = true"
|
||||
/>
|
||||
<font-awesome-icon
|
||||
v-if="!conversation?.editing && !conversation.deleting"
|
||||
icon="fa-solid fa-trash"
|
||||
class="icon icon-delete"
|
||||
@click.stop="conversation.deleting = true"
|
||||
/>
|
||||
<font-awesome-icon
|
||||
v-if="conversation?.editing || conversation.deleting"
|
||||
icon="fa-solid fa-check"
|
||||
class="icon icon-confirm"
|
||||
@click.stop="onConfirm(conversation)"
|
||||
/>
|
||||
<font-awesome-icon
|
||||
v-if="conversation?.editing || conversation.deleting"
|
||||
icon="fa-solid fa-xmark"
|
||||
class="icon icon-cancel"
|
||||
@click.stop="
|
||||
conversation.editing = false;
|
||||
conversation.deleting = false;
|
||||
"
|
||||
/>
|
||||
<div
|
||||
v-for="(conversation, conversationIndex) in conversations"
|
||||
:key="conversationIndex"
|
||||
:class="{ conversation: true, active: conversation.id === conversationId }"
|
||||
@click="onClick(conversation.id)"
|
||||
>
|
||||
<div class="title">
|
||||
<span v-if="conversation?.deleting">
|
||||
{{ `${$t('chat.message.confirmDelete')}?` }}
|
||||
</span>
|
||||
<span v-else-if="conversation?.editing">
|
||||
<el-input v-model="conversation.title" @keydown.enter="onConfirm(conversation)" />
|
||||
</span>
|
||||
<span v-else-if="conversation?.title || conversation?.messages">{{
|
||||
conversation?.title || conversation?.messages[conversation?.messages.length - 1]?.content
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="operations">
|
||||
<font-awesome-icon
|
||||
v-if="!conversation?.editing && !conversation.deleting"
|
||||
icon="fa-solid fa-edit"
|
||||
class="icon icon-edit"
|
||||
@click.stop="conversation.editing = true"
|
||||
/>
|
||||
<font-awesome-icon
|
||||
v-if="!conversation?.editing && !conversation.deleting"
|
||||
icon="fa-solid fa-trash"
|
||||
class="icon icon-delete"
|
||||
@click.stop="conversation.deleting = true"
|
||||
/>
|
||||
<font-awesome-icon
|
||||
v-if="conversation?.editing || conversation.deleting"
|
||||
icon="fa-solid fa-check"
|
||||
class="icon icon-confirm"
|
||||
@click.stop="onConfirm(conversation)"
|
||||
/>
|
||||
<font-awesome-icon
|
||||
v-if="conversation?.editing || conversation.deleting"
|
||||
icon="fa-solid fa-xmark"
|
||||
class="icon icon-cancel"
|
||||
@click.stop="
|
||||
conversation.editing = false;
|
||||
conversation.deleting = false;
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -86,8 +88,41 @@ export default defineComponent({
|
||||
conversationId() {
|
||||
return this.$route.params?.id?.toString();
|
||||
},
|
||||
conversations() {
|
||||
return this.$store.state.chat.conversations;
|
||||
conversationGroups() {
|
||||
const conversations = this.$store.state.chat.conversations;
|
||||
// split our 4 groups according to the `updated_at` field, to 'today', 'yesterday', 'this week', 'earlier'.
|
||||
// if (conversations) {
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
const yesterday = new Date(today);
|
||||
yesterday.setDate(yesterday.getDate() - 1);
|
||||
const thisWeek = new Date(today);
|
||||
thisWeek.setDate(thisWeek.getDate() - today.getDay());
|
||||
const earlier = new Date(thisWeek);
|
||||
earlier.setDate(earlier.getDate() - 7);
|
||||
const groups = conversations?.reduce(
|
||||
(acc, conversation: IChatConversation) => {
|
||||
const updatedAt = new Date(conversation.updated_at * 1000);
|
||||
if (updatedAt >= today) {
|
||||
(acc.today as IChatConversation[]).push(conversation);
|
||||
} else if (updatedAt >= yesterday) {
|
||||
(acc.yesterday as IChatConversation[]).push(conversation);
|
||||
} else if (updatedAt >= thisWeek) {
|
||||
(acc.thisWeek as IChatConversation[]).push(conversation);
|
||||
} else {
|
||||
(acc.earlier as IChatConversation[]).push(conversation);
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{ today: [], yesterday: [], thisWeek: [], earlier: [] }
|
||||
) as Record<string, IChatConversation[]>;
|
||||
// sort every group by `updated_at` field.
|
||||
return {
|
||||
today: groups?.today?.sort((a, b) => b.updated_at - a.updated_at),
|
||||
yesterday: groups?.yesterday?.sort((a, b) => b.updated_at - a.updated_at),
|
||||
thisWeek: groups?.thisWeek?.sort((a, b) => b.updated_at - a.updated_at),
|
||||
earlier: groups?.earlier?.sort((a, b) => b.updated_at - a.updated_at)
|
||||
};
|
||||
},
|
||||
application() {
|
||||
return this.$store.state.chat.application;
|
||||
@@ -146,33 +181,47 @@ export default defineComponent({
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
padding: 15px;
|
||||
width: 300px;
|
||||
padding: 10px;
|
||||
width: 250px;
|
||||
height: 100%;
|
||||
border-right: 1px solid var(--el-border-color);
|
||||
overflow-y: scroll;
|
||||
|
||||
.conversations {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
.group {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-top: 10px;
|
||||
.key {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
width: 100%;
|
||||
line-height: 40px;
|
||||
padding-left: 10px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
}
|
||||
.conversation {
|
||||
width: 100%;
|
||||
height: 55px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding: 10px;
|
||||
margin-bottom: 5px;
|
||||
border: 1px dashed var(--el-border-color);
|
||||
line-height: 30px;
|
||||
line-height: 40px;
|
||||
border-radius: 10px;
|
||||
padding: 0 10px;
|
||||
color: var(--el-text-color-primary);
|
||||
cursor: pointer;
|
||||
|
||||
&.active,
|
||||
&:hover {
|
||||
background-color: var(--el-fill-color-extra-light);
|
||||
background-color: var(--el-bg-color-page);
|
||||
.operations {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.icons {
|
||||
@@ -185,13 +234,14 @@ export default defineComponent({
|
||||
.title {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
line-height: 32px;
|
||||
line-height: 40px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
padding-right: 8px;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
.operations {
|
||||
display: none;
|
||||
width: 40px;
|
||||
color: var(--el-text-color-regular);
|
||||
.icon {
|
||||
|
||||
+28
-32
@@ -4,7 +4,7 @@
|
||||
"description": "Model name of the service, which is GPT 3.5 Basic"
|
||||
},
|
||||
"model.35StandardDescription": {
|
||||
"message": "Basic model that can answer simple questions and provide general information.",
|
||||
"message": "Great for everyday tasks.",
|
||||
"description": "Description of the 3.5 Standard model"
|
||||
},
|
||||
"model.35Browsing": {
|
||||
@@ -12,7 +12,7 @@
|
||||
"description": "Model name of the service, which is GPT 3.5 Browsing"
|
||||
},
|
||||
"model.35BrowsingDescription": {
|
||||
"message": "Can real-time retrieve information from the web and provide more basic answers.",
|
||||
"message": "Can real-time retrieve information.",
|
||||
"description": "Description of the 3.5 Browsing model"
|
||||
},
|
||||
"model.4Standard": {
|
||||
@@ -20,7 +20,7 @@
|
||||
"description": "Model name of the service, which is GPT 4.0 Standard"
|
||||
},
|
||||
"model.4StandardDescription": {
|
||||
"message": "More powerful model that can answer more complex questions.",
|
||||
"message": "More powerful model for complex tasks.",
|
||||
"description": "Description of the 4.0 Standard model"
|
||||
},
|
||||
"model.4Browsing": {
|
||||
@@ -28,7 +28,7 @@
|
||||
"description": "Model name of the service, which is GPT 4.0 Browsing"
|
||||
},
|
||||
"model.4BrowsingDescription": {
|
||||
"message": "Can real-time retrieve information to provide more answers based on 4.0 Standard model.",
|
||||
"message": "Powerful & real-time retrieve information.",
|
||||
"description": "Description of the 4.0 Browsing model"
|
||||
},
|
||||
"model.4Vision": {
|
||||
@@ -36,7 +36,7 @@
|
||||
"description": "Model name of the service, which is GPT 4.0 Vision"
|
||||
},
|
||||
"model.4VisionDescription": {
|
||||
"message": "Can analyze images and provide information based on the content of the images.",
|
||||
"message": "Can analyze images.",
|
||||
"description": "Description of the 4.0 Vision model"
|
||||
},
|
||||
"message.startNewChat": {
|
||||
@@ -76,41 +76,21 @@
|
||||
"description": "Message in a webpage, which tell user to try for free"
|
||||
},
|
||||
"message.question1": {
|
||||
"message": "Write a piece of JavaScript code that outputs Hello World",
|
||||
"message": "Create a workout plan",
|
||||
"description": "An example questions for starting a chat, which ask user to write a piece of JavaScript code that outputs Hello World"
|
||||
},
|
||||
"message.question2": {
|
||||
"message": "Write an email to Mike, telling him that I just moved",
|
||||
"message": "Make a personal webpage",
|
||||
"description": "An example questions for starting a chat, which ask user to write an email to Mike, telling him that I just moved"
|
||||
},
|
||||
"message.question3": {
|
||||
"message": "Explain the basic principles of quantum computing in simple terms",
|
||||
"message": "Design a fun coding game",
|
||||
"description": "An example questions for starting a chat, which ask user to explain the basic principles of quantum computing in simple terms"
|
||||
},
|
||||
"message.question4": {
|
||||
"message": "What impact has virtual reality had on artistic creation?",
|
||||
"message": "Experience Seoul like a local",
|
||||
"description": "An example questions for starting a chat, which ask user to explain what impact has virtual reality had on artistic creation"
|
||||
},
|
||||
"message.question5": {
|
||||
"message": "How do privacy protection and data security affect legal practice?",
|
||||
"description": "An example questions for starting a chat, which ask user to explain how do privacy protection and data security affect legal practice"
|
||||
},
|
||||
"message.question6": {
|
||||
"message": "How to deal with the complex changes in tax laws in todays world?",
|
||||
"description": "An example questions for starting a chat, which ask user to explain how to deal with the complex changes in tax laws in todays world"
|
||||
},
|
||||
"message.question7": {
|
||||
"message": "How to create unique cuisine by combining different regional cultural backgrounds?",
|
||||
"description": "An example questions for starting a chat, which ask user to explain how to create unique cuisine by combining different regional cultural backgrounds"
|
||||
},
|
||||
"message.question8": {
|
||||
"message": "How to draw literary creation inspiration from travel experiences?",
|
||||
"description": "An example questions for starting a chat, which ask user to explain how to draw literary creation inspiration from travel experiences"
|
||||
},
|
||||
"message.question9": {
|
||||
"message": "How to get business ideas from successful cases in different industries?",
|
||||
"description": "An example questions for starting a chat, which ask user to explain how to get business ideas from successful cases in different industries"
|
||||
},
|
||||
"message.errorApiError": {
|
||||
"message": "Answer failed, please try again later",
|
||||
"description": "Message in a webpage, which tell user that answer failed, please try again later"
|
||||
@@ -152,8 +132,8 @@
|
||||
"description": "Message in a webpage, which tell user to confirm deletion"
|
||||
},
|
||||
"message.howToUse": {
|
||||
"message": "Press Shift+Enter to start a new line",
|
||||
"description": "Message in a webpage, which tell user to press Shift+Enter to start a new line"
|
||||
"message": "AI can make mistakes. Check important info.",
|
||||
"description": "Message in a webpage, which tell user that AI can make mistakes. Check important info."
|
||||
},
|
||||
"title.chat": {
|
||||
"message": "AI Chat",
|
||||
@@ -182,5 +162,21 @@
|
||||
"title.getTips": {
|
||||
"message": "Get inspiration and creativity",
|
||||
"description": "Title in a webpage, which tells this part is about the ability of the service to get inspiration and creativity"
|
||||
},
|
||||
"group.today": {
|
||||
"message": "Today",
|
||||
"description": "Group name in a webpage, which is Today"
|
||||
},
|
||||
"group.yesterday": {
|
||||
"message": "Yesterday",
|
||||
"description": "Group name in a webpage, which is Yesterday"
|
||||
},
|
||||
"group.thisWeek": {
|
||||
"message": "This week",
|
||||
"description": "Group name in a webpage, which is This week"
|
||||
},
|
||||
"group.earlier": {
|
||||
"message": "Earlier",
|
||||
"description": "Group name in a webpage, which is Earlier"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ export default defineComponent({
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
.side {
|
||||
width: 300px;
|
||||
width: 250px;
|
||||
height: 100%;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
@@ -70,10 +70,11 @@ export default defineComponent({
|
||||
height: 100%;
|
||||
padding: 15px;
|
||||
flex: 1;
|
||||
width: calc(100% - 300px);
|
||||
width: calc(100% - 250px);
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ export interface IChatConversation {
|
||||
deleting?: boolean;
|
||||
editing?: boolean;
|
||||
new?: boolean;
|
||||
updated_at: number;
|
||||
}
|
||||
|
||||
export interface IChatConversationOptions {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<layout>
|
||||
<template #chat>
|
||||
<model-selector class="model-selector" />
|
||||
<model-selector2 class="selector" />
|
||||
<application-status
|
||||
:initializing="initializing"
|
||||
:application="application"
|
||||
@@ -21,6 +21,7 @@
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bottom">
|
||||
<input-box
|
||||
:disabled="answering"
|
||||
@@ -42,7 +43,7 @@ import Message from '@/components/chat/Message.vue';
|
||||
import { ROLE_ASSISTANT, ROLE_USER } from '@/constants';
|
||||
import { IChatModel, IChatMessageState, IChatConversationResponse, IChatConversation, IChatMessage } from '@/models';
|
||||
import InputBox from '@/components/chat/InputBox.vue';
|
||||
import ModelSelector from '@/components/chat/ModelSelector.vue';
|
||||
import ModelSelector2 from '@/components/chat/ModelSelector2.vue';
|
||||
import { ERROR_CODE_CANCELED, ERROR_CODE_NOT_APPLIED, ERROR_CODE_UNKNOWN } from '@/constants/errorCode';
|
||||
import { ROUTE_CHAT_CONVERSATION, ROUTE_CHAT_CONVERSATION_NEW } from '@/router';
|
||||
import { Status } from '@/models';
|
||||
@@ -64,7 +65,7 @@ export default defineComponent({
|
||||
components: {
|
||||
InputBox,
|
||||
Introduction,
|
||||
ModelSelector,
|
||||
ModelSelector2,
|
||||
Message,
|
||||
ApplicationStatus,
|
||||
Layout
|
||||
@@ -283,16 +284,19 @@ export default defineComponent({
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.model-selector {
|
||||
.selector {
|
||||
width: max-content;
|
||||
margin: auto;
|
||||
margin-bottom: 10px;
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: 5px;
|
||||
}
|
||||
|
||||
.dialogue {
|
||||
flex: 1;
|
||||
width: 800px;
|
||||
margin: 15px auto;
|
||||
overflow-y: scroll;
|
||||
margin: 15px 0;
|
||||
position: relative;
|
||||
.messages {
|
||||
padding-top: 30px;
|
||||
|
||||
@@ -9,8 +9,11 @@ import {
|
||||
} from '@fortawesome/free-regular-svg-icons';
|
||||
import { faDiscord as faBrandsDiscord } from '@fortawesome/free-brands-svg-icons';
|
||||
import {
|
||||
faLaptopCode as faSolidLaptopCode,
|
||||
faChevronRight as faSolidChevronRight,
|
||||
faMoon as faSolidMoon,
|
||||
faFan as faSolidFan,
|
||||
faPenNib as faSolidPenNib,
|
||||
faQrcode as faSolidQrcode,
|
||||
faChevronLeft as faSolidChevronLeft,
|
||||
faFire as faSolidFire,
|
||||
@@ -48,6 +51,7 @@ import {
|
||||
faXmark as faSolidXmark,
|
||||
faCoins as faSolidCoins,
|
||||
faRotateLeft as faSolidRotateLeft,
|
||||
faPlaneDeparture as faSolidPlaneDeparture,
|
||||
faWallet as faSolidWallet,
|
||||
faCartShopping as faSolidCartShopping,
|
||||
faPercent as faSolidPercent,
|
||||
@@ -56,18 +60,23 @@ import {
|
||||
faCubes as faSolidCubes,
|
||||
faFileLines as faSolidFileLines,
|
||||
faLink as faSolidLink,
|
||||
faWandMagic as faSolidWandMagic
|
||||
faWandMagic as faSolidWandMagic,
|
||||
faAngleDown as faSolidAngleDown
|
||||
} from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
library.add(faRegularCopy);
|
||||
library.add(faSolidAngleDown);
|
||||
library.add(faSolidStore);
|
||||
library.add(faSolidChevronRight);
|
||||
library.add(faSolidPlaneDeparture);
|
||||
library.add(faSolidCube);
|
||||
library.add(faSolidFileLines);
|
||||
library.add(faSolidCompass);
|
||||
library.add(faSolidPaperclip);
|
||||
library.add(faSolidFan);
|
||||
library.add(faSolidXmark);
|
||||
library.add(faSolidFire);
|
||||
library.add(faSolidLaptopCode);
|
||||
library.add(faSolidRotateRight);
|
||||
library.add(faSolidPenToSquare);
|
||||
library.add(faSolidCheck);
|
||||
@@ -88,6 +97,7 @@ library.add(faSolidTriangleExclamation);
|
||||
library.add(faSolidUpRightFromSquare);
|
||||
library.add(faRegularClock);
|
||||
library.add(faSolidArrowsRotate);
|
||||
library.add(faSolidPenNib);
|
||||
library.add(faRegularPaperPlane);
|
||||
library.add(faSolidWind);
|
||||
library.add(faSolidQrcode);
|
||||
|
||||
Reference in new issue
Block a user