Add DeepSeek model to Chat (#170)

Co-authored-by: AceDataCloud <office@acedata.cloud>
This commit is contained in:
GermeyandAceDataCloud authored and GitHub committed 2025-02-10 00:32:30 +08:00
1 parent 64f5e51e67
commit 28876eee56
56 files changed
+3307 -1479

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
<template>
<p class="disclaimer">{{ $t('chat.message.howToUse') }}</p>
</template>
<style class="scss" scoped>
.disclaimer {
font-size: 12px;
color: var(--el-text-color-secondary);
}
</style>
+100 -43
View File
@@ -9,19 +9,27 @@
:disabled="!canUpload"
name="file"
:show-file-list="true"
:limit="1"
:limit="10"
:multiple="false"
:action="uploadUrl"
:on-exceed="onExceed"
:on-error="onError"
:headers="headers"
>
<el-tooltip class="box-item" effect="dark" :content="$t('chat.message.uploadFile')" placement="top">
<el-tooltip class="box-item" effect="dark" :content="$t('chat.message.uploadFile')" placement="bottom">
<span class="btn btn-upload">
<font-awesome-icon icon="fa-solid fa-paperclip" class="icon icon-attachment" />
<font-awesome-icon icon="fa-solid fa-plus" class="icon icon-attachment" />
</span>
</el-tooltip>
</el-upload>
<span :class="{ btn: true, 'btn-search': true, active: search, disabled: !canSearch }" @click="search = !search">
<font-awesome-icon icon="fa-solid fa-globe" class="icon icon-search" />
{{ $t('chat.button.search') }}
</span>
<span :class="{ btn: true, 'btn-reason': true, active: reason, disabled: !canReason }" @click="reason = !reason">
<font-awesome-icon icon="fa-regular fa-lightbulb" class="icon icon-reason" />
{{ $t('chat.button.thinkDeeper') }}
</span>
<span
v-show="!disabled"
:class="{
@@ -42,7 +50,7 @@
}"
@click="onStop"
>
<font-awesome-icon icon="fa-solid fa-stop-circle" class="icon icon-stop" />
<font-awesome-icon icon="fa-solid fa-stop" class="icon icon-stop" />
</span>
<!-- add this textarea -->
<textarea
@@ -56,7 +64,6 @@
@input="adjustTextareaHeight"
></textarea>
</div>
<p class="info">{{ $t('chat.message.howToUse') }}</p>
</template>
<script lang="ts">
@@ -65,7 +72,6 @@ import { ElMessage, ElTooltip, ElUpload } from 'element-plus';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
import { IChatModel } from '@/models';
import { getBaseUrlPlatform } from '@/utils';
import { CHAT_MODEL_GPT_4_ALL, CHAT_MODEL_GPT_4_VISION } from '@/constants';
export default defineComponent({
name: 'InputBox',
@@ -90,12 +96,14 @@ export default defineComponent({
required: true
}
},
emits: ['update:question', 'update:references', 'submit', 'stop'],
emits: ['update:question', 'update:references', 'submit', 'stop', 'update:search', 'update:reason'],
data() {
return {
inputHeight: '35px', //add inputHeight
questionValue: this.question,
fileList: [],
search: false,
reason: false,
uploadUrl: getBaseUrlPlatform() + '/api/v1/files/'
};
},
@@ -110,7 +118,13 @@ export default defineComponent({
return this.fileList.map((file: UploadFile) => file?.response?.file_url);
},
canUpload() {
return [CHAT_MODEL_GPT_4_VISION.name, CHAT_MODEL_GPT_4_ALL.name].includes(this.model.name);
return !this.search && !this.reason;
},
canSearch() {
return !this.reason && !this.urls.length;
},
canReason() {
return !this.search && !this.urls.length;
},
model(): IChatModel {
return this.$store.state.chat.model;
@@ -120,6 +134,12 @@ export default defineComponent({
urls(val) {
this.$emit('update:references', val);
},
search(val: boolean) {
this.$emit('update:search', val);
},
reason(val: boolean) {
this.$emit('update:reason', val);
},
questionValue(val: string) {
this.$emit('update:question', val);
},
@@ -169,15 +189,14 @@ export default defineComponent({
<style lang="scss">
textarea.input {
font-size: 14px;
min-height: 35px;
max-height: 350px;
min-height: 55px;
max-height: 150px;
border: none;
background: none;
box-shadow: none;
resize: none;
line-height: 25px;
width: calc(100% - 80px);
margin-left: 30px;
font-family: var(--el-font-family);
padding-top: 6px;
}
@@ -198,8 +217,8 @@ textarea.input:focus {
}
.el-upload-list {
position: absolute;
width: 400px;
bottom: 55px;
width: 100%;
bottom: 135px;
}
.el-textarea.is-disabled .el-textarea__inner {
@@ -215,7 +234,7 @@ textarea.input:focus {
margin: auto;
position: relative;
border-radius: 20px;
background: var(--el-bg-color-page);
border: 1px solid var(--el-border-color-lighter);
padding: 5px;
.upload {
display: inline-block;
@@ -230,57 +249,95 @@ textarea.input:focus {
}
.input {
border: none;
width: calc(100% - 80px);
margin-left: 35px;
width: calc(100% - 16px);
margin-left: 8px;
margin-top: 5px;
font-size: 16px;
margin-bottom: 50px;
}
.btn {
display: block;
z-index: 100;
cursor: pointer;
bottom: 15px;
border: 1px solid var(--el-border-color-lighter);
width: fit-content;
position: absolute;
bottom: 15px;
height: 36px;
line-height: 36px;
user-select: none;
&.disabled {
cursor: not-allowed;
pointer-events: none;
color: var(--el-text-color-disabled) !important;
}
&.btn-upload {
left: 15px;
border-radius: 50%;
width: 36px;
text-align: center;
color: var(--el-text-color-secondary);
.icon-attachment {
font-size: 16px;
color: var(--el-text-color-primary);
}
}
&.btn-send {
right: 15px;
&.disabled {
.icon-send {
color: var(--el-text-color-disabled);
}
cursor: not-allowed;
&.btn-search {
left: 60px;
color: var(--el-text-color-primary);
border-radius: 20px;
padding: 0 10px;
font-size: 16px;
&.active {
border: 1px solid var(--el-color-primary);
color: var(--el-color-primary);
}
.icon-send {
.icon-search {
font-size: 16px;
color: var(--el-text-color-primary);
}
}
&.btn-reason {
left: 145px;
color: var(--el-text-color-primary);
border-radius: 20px;
padding: 0 10px;
font-size: 16px;
&.active {
border: 1px solid var(--el-color-primary);
color: var(--el-color-primary);
}
.icon-reason {
font-size: 16px;
}
}
&.btn-send {
bottom: 15px;
right: 15px;
border-radius: 50%;
width: 36px;
text-align: center;
background-color: var(--el-color-black);
color: var(--el-color-white);
font-size: 16px;
&.disabled {
display: none;
cursor: not-allowed;
}
}
&.btn-stop {
right: 15px; // Adjust position if needed
bottom: 15px;
right: 15px;
border-radius: 50%;
width: 36px;
text-align: center;
background-color: var(--el-color-black);
color: var(--el-color-white);
font-size: 16px;
&.disabled {
.icon-stop {
color: var(--el-text-color-disabled);
}
display: none;
cursor: not-allowed;
}
.icon-stop {
font-size: 16px;
color: var(--el-text-color-primary);
}
}
}
}
.info {
display: block;
font-size: 12px;
color: var(--el-text-color-secondary);
margin-top: 5px;
text-align: center;
margin-bottom: 0;
}
</style>
+5 -7
View File
@@ -7,12 +7,7 @@
:role="message.role"
>
<div class="author">
<el-image
v-if="message.role === 'assistant'"
src="https://cdn.acedata.cloud/7dljuv.png"
fit="cover"
class="avatar"
/>
<el-image v-if="message.role === 'assistant'" :src="modelGroup.icon" fit="cover" class="avatar" />
</div>
<div v-if="!errorText" class="main">
<div class="content">
@@ -161,6 +156,9 @@ export default defineComponent({
};
},
computed: {
modelGroup() {
return this.$store.state.chat.modelGroup;
},
errorText() {
if (!this.message.error || !this.message.error?.code) {
return undefined;
@@ -328,7 +326,7 @@ export default defineComponent({
}
.content {
border-radius: 20px;
padding: 8px;
padding: 8px 12px;
width: 100%;
max-width: 800px;
margin-bottom: 10px;
+27 -76
View File
@@ -1,26 +1,22 @@
<template>
<div class="selector">
<el-dropdown trigger="click" popper-class="popper">
<div>
<span class="name">{{ model?.getDisplayName() }}</span>
<div class="flex align-center justify-center">
<span class="name">{{ modelGroup?.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)"
>
<el-dropdown-item v-for="(option, optionKey) in options" :key="optionKey" @click="onCommandChange(option)">
<div class="item">
<div class="icon" :style="{ color: option.color }">
<font-awesome-icon :icon="option.icon" />
<div class="icon">
<img :src="option.icon" />
</div>
<div class="info">
<p class="name">{{ option.model.getDisplayName() }}</p>
<p class="description">{{ option.model.getDescription() }}</p>
<p class="name">{{ option.getDisplayName() }}</p>
<p class="description">{{ option.getDescription() }}</p>
</div>
</div>
</el-dropdown-item>
@@ -34,15 +30,12 @@
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,
CHAT_MODEL_GPT_4_ALL
} from '@/constants';
import { IChatModelGroup } from '@/models';
import { CHAT_MODEL_GROUP_CHATGPT, CHAT_MODEL_GROUP_DEEPSEEK } from '@/constants';
interface IData {
options: IChatModelGroup[];
}
export default defineComponent({
name: 'ModelSelector',
@@ -53,60 +46,20 @@ export default defineComponent({
FontAwesomeIcon
},
emits: ['update:modelValue', 'select'],
data() {
data(): IData {
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
},
{
icon: 'fa-solid fa-wand-magic-sparkles',
color: '#ce65e6',
model: CHAT_MODEL_GPT_4_ALL
}
]
options: [CHAT_MODEL_GROUP_CHATGPT, CHAT_MODEL_GROUP_DEEPSEEK]
};
},
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,
CHAT_MODEL_GPT_4_ALL
].find((model) => model.name === modelName);
return model;
modelGroup() {
return this.$store.state.chat.modelGroup;
}
},
methods: {
onCommandChange(command: IChatModel) {
this.$emit('select', command);
this.$store.dispatch('chat/setModel', command);
onCommandChange(modelGroup: IChatModelGroup) {
this.$emit('select', modelGroup);
this.$store.dispatch('chat/setModelGroup', modelGroup);
}
}
});
@@ -142,19 +95,17 @@ export default defineComponent({
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;
align-items: center;
margin-right: 10px;
img {
width: 30px;
height: 30px;
border-radius: 50%;
}
}
.info {
width: calc(100% - 15px);
.name {
+1 -1
View File
@@ -1,5 +1,5 @@
<template>
<el-tooltip effect="dark" :content="$t('common.button.restart')" placement="top-start">
<el-tooltip effect="dark" :content="$t('common.button.restart')" placement="bottom">
<font-awesome-icon icon="fa-solid fa-sync" class="icon-sync" @click="onRestart" />
</el-tooltip>
</template>
+2 -4
View File
@@ -190,10 +190,8 @@ export default defineComponent({
padding: 10px;
width: 250px;
height: 100%;
@media (max-width: 767px) {
border-right: none;
}
background-color: var(--el-bg-color-page);
border-right: none;
.conversations {
width: 100%;
@@ -1,8 +1,8 @@
<template>
<div class="introduction">
<div class="suggestion">
<el-row class="items" justify="center" :gutter="15">
<el-col v-for="(item, itemKey) in items" :key="itemKey" :md="6" :sm="12" :xs="12">
<introduction-item
<el-col v-for="(item, itemKey) in items" :key="itemKey" :md="8" :sm="12" :xs="12">
<suggestion-item
:content="item.content"
:icon="item.icon"
:color="item.color"
@@ -16,13 +16,13 @@
<script lang="ts">
import { defineComponent } from 'vue';
import IntroductionItem from './IntroductionItem.vue';
import SuggestionItem from './SuggestionItem.vue';
import { ElRow, ElCol } from 'element-plus';
export default defineComponent({
name: 'ConversationIntroduction',
name: 'Suggestion',
components: {
IntroductionItem,
SuggestionItem,
ElRow,
ElCol
},
@@ -49,8 +49,30 @@ export default defineComponent({
icon: 'fa-solid fa-plane-departure',
content: this.$t('chat.message.question4'),
color: 'rgb(237, 98, 98)'
},
{
icon: 'fa-solid fa-bolt',
content: this.$t('chat.message.question5'),
color: 'rgb(203, 139, 208)'
},
{
icon: 'fa-solid fa-diamond',
content: this.$t('chat.message.question6'),
color: 'rgb(118, 208, 235)'
},
{
icon: 'fa-solid fa-fire',
content: this.$t('chat.message.question7'),
color: 'rgb(226, 197, 65)'
},
{
icon: 'fa-solid fa-magic',
content: this.$t('chat.message.question8'),
color: 'rgb(237, 98, 98)'
}
].sort(() => Math.random() - 0.5)
]
.sort(() => Math.random() - 0.5)
.slice(0, 3)
};
},
computed: {}
@@ -58,13 +80,12 @@ export default defineComponent({
</script>
<style lang="scss" scoped>
.introduction {
width: 100%;
height: 100%;
flex: 1;
.suggestion {
display: flex;
align-items: center;
justify-content: center;
height: 150px;
width: 100%;
.items {
max-width: 800px;
@@ -72,15 +93,4 @@ export default defineComponent({
margin: auto;
}
}
@media (max-width: 767px) {
.introduction {
position: relative;
top: initial;
left: initial;
transform: initial;
width: 90%;
margin: auto;
}
}
</style>
@@ -17,7 +17,6 @@
<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',
@@ -47,7 +46,7 @@ export default defineComponent({
<style lang="scss" scoped>
.item {
height: 100px;
height: 80px;
font-size: 14px;
background-color: var(--el-color-color);
color: var(--el-text-color-primary);
+2 -3
View File
@@ -1,9 +1,8 @@
<template>
<el-tooltip v-if="!copied" effect="dark" :content="$t('common.button.copy')" placement="top-start">
<el-tooltip v-if="!copied" effect="dark" :content="$t('common.button.copy')" placement="bottom">
<font-awesome-icon icon="fa-regular fa-copy" class="icon-copy" @click="onCopy"
/></el-tooltip>
<el-tooltip v-else :visible="copied" effect="dark" :content="$t('common.message.copied')" placement="top-start">
<el-tooltip v-else :visible="copied" effect="dark" :content="$t('common.message.copied')" placement="bottom">
<font-awesome-icon icon="fa-solid fa-check" class="icon-check" />
</el-tooltip>
</template>