Update deepseek experience (#174)

Co-authored-by: AceDataCloud <office@acedata.cloud>
This commit is contained in:
GermeyandAceDataCloud authored and GitHub committed 2025-02-11 22:13:07 +08:00
1 parent ff13c75db8
commit c0e14308ef
9 files changed
+587 -468

No files matched your search

@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "update deepseek experience",
"packageName": "@acedatacloud/nexior",
"email": "office@acedata.cloud",
"dependentChangeType": "patch"
}
+1 -1
View File
@@ -105,7 +105,7 @@
"prettier": "^2.6.2", "prettier": "^2.6.2",
"rollup-plugin-string": "^3.0.0", "rollup-plugin-string": "^3.0.0",
"sass": "^1.38.1", "sass": "^1.38.1",
"tailwindcss": "^3.4.0", "tailwindcss": "^2.2.8",
"typescript": "^4.9.5", "typescript": "^4.9.5",
"vite": "^2.9.16", "vite": "^2.9.16",
"vite-bundle-visualizer": "1.0", "vite-bundle-visualizer": "1.0",
-3
View File
@@ -1,3 +0,0 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
+1
View File
@@ -1,2 +1,3 @@
@tailwind base;
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;
+184 -120
View File
@@ -1,35 +1,43 @@
<template> <template>
<div class="input-box"> <div class="input-box">
<el-upload <div class="tools">
v-model:file-list="fileList" <el-upload
:class="{ v-model:file-list="fileList"
upload: true, :class="{
disabled: !canUpload upload: true,
}" disabled: !_isUploadEnabled
:disabled="!canUpload" }"
name="file" :disabled="!_isUploadEnabled"
:show-file-list="true" name="file"
:limit="10" :show-file-list="true"
:multiple="false" :limit="10"
:action="uploadUrl" :multiple="false"
:on-exceed="onExceed" :action="uploadUrl"
:on-error="onError" :on-exceed="onExceed"
:headers="headers" :on-error="onError"
> :headers="headers"
<el-tooltip class="box-item" effect="dark" :content="$t('chat.message.uploadFile')" placement="bottom"> >
<span class="btn btn-upload"> <el-tooltip class="box-item" effect="dark" :content="$t('chat.message.uploadFile')" placement="bottom">
<font-awesome-icon icon="fa-solid fa-plus" class="icon icon-attachment" /> <span :class="{ btn: true, 'btn-upload': true, disabled: !_isUploadEnabled }">
</span> <font-awesome-icon icon="fa-solid fa-plus" class="icon icon-attachment" />
</el-tooltip> </span>
</el-upload> </el-tooltip>
<span :class="{ btn: true, 'btn-search': true, active: search, disabled: !canSearch }" @click="search = !search"> </el-upload>
<font-awesome-icon icon="fa-solid fa-globe" class="icon icon-search" /> <span
{{ $t('chat.button.search') }} :class="{ btn: true, 'btn-search': true, active: _isSearchActive, disabled: !isSearchEnabled }"
</span> @click="_isSearchActive = !_isSearchActive"
<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" /> <font-awesome-icon icon="fa-solid fa-globe" class="icon icon-search" />
{{ $t('chat.button.thinkDeeper') }} {{ $t('chat.button.search') }}
</span> </span>
<span
:class="{ btn: true, 'btn-reason': true, active: _isReasonActive, disabled: !isReasonEnabled }"
@click="_isReasonActive = !_isReasonActive"
>
<font-awesome-icon icon="fa-regular fa-lightbulb" class="icon icon-reason" />
{{ $t('chat.button.thinkDeeper') }}
</span>
</div>
<span <span
v-show="!disabled" v-show="!disabled"
:class="{ :class="{
@@ -72,6 +80,7 @@ import { ElMessage, ElTooltip, ElUpload } from 'element-plus';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'; import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
import { IChatModel } from '@/models'; import { IChatModel } from '@/models';
import { getBaseUrlPlatform } from '@/utils'; import { getBaseUrlPlatform } from '@/utils';
import { CHAT_MODEL_GROUP_DEEPSEEK } from '@/constants';
export default defineComponent({ export default defineComponent({
name: 'InputBox', name: 'InputBox',
@@ -94,20 +103,60 @@ export default defineComponent({
question: { question: {
type: String, type: String,
required: true required: true
},
isSearchEnabled: {
type: Boolean,
required: false,
default: true
},
isReasonEnabled: {
type: Boolean,
required: false,
default: true
},
isUploadEnabled: {
type: Boolean,
required: false,
default: true
},
isSearchActive: {
type: Boolean,
required: false,
default: false
},
isReasonActive: {
type: Boolean,
required: false,
default: false
} }
}, },
emits: ['update:question', 'update:references', 'submit', 'stop', 'update:search', 'update:reason'], emits: [
'update:question',
'update:references',
'submit',
'stop',
'update:isSearchActive',
'update:isReasonActive',
'update:isUploadEnabled',
'update:isSearchEnabled',
'update:isReasonEnabled'
],
data() { data() {
return { return {
inputHeight: '35px', //add inputHeight inputHeight: '35px', //add inputHeight
questionValue: this.question, questionValue: this.question,
fileList: [], fileList: [],
search: false, // eslint-disable-next-line vue/no-reserved-keys
reason: false, _isSearchActive: this.isSearchActive,
// eslint-disable-next-line vue/no-reserved-keys
_isReasonActive: this.isReasonActive,
uploadUrl: getBaseUrlPlatform() + '/api/v1/files/' uploadUrl: getBaseUrlPlatform() + '/api/v1/files/'
}; };
}, },
computed: { computed: {
modelGroup() {
return this.$store.state.chat.modelGroup;
},
headers() { headers() {
return { return {
Authorization: `Bearer ${this.$store.state.token.access}` Authorization: `Bearer ${this.$store.state.token.access}`
@@ -117,14 +166,14 @@ export default defineComponent({
// @ts-ignore // @ts-ignore
return this.fileList.map((file: UploadFile) => file?.response?.file_url); return this.fileList.map((file: UploadFile) => file?.response?.file_url);
}, },
canUpload() { _isUploadEnabled() {
return !this.search && !this.reason; return !this._isSearchActive && !this._isReasonActive && this.modelGroup.name !== CHAT_MODEL_GROUP_DEEPSEEK.name;
}, },
canSearch() { _isSearchEnabled() {
return !this.reason && !this.urls.length; return !this._isReasonActive && !this.urls.length;
}, },
canReason() { _isReasonEnabled() {
return !this.search && !this.urls.length; return !this._isSearchActive && !this.urls.length;
}, },
model(): IChatModel { model(): IChatModel {
return this.$store.state.chat.model; return this.$store.state.chat.model;
@@ -134,11 +183,20 @@ export default defineComponent({
urls(val) { urls(val) {
this.$emit('update:references', val); this.$emit('update:references', val);
}, },
search(val: boolean) { _isUploadEnabled(val: boolean) {
this.$emit('update:search', val); this.$emit('update:isUploadEnabled', val);
}, },
reason(val: boolean) { _isSearchEnabled(val: boolean) {
this.$emit('update:reason', val); this.$emit('update:isSearchEnabled', val);
},
_isReasonEnabled(val: boolean) {
this.$emit('update:isReasonEnabled', val);
},
_isSearchActive(val: boolean) {
this.$emit('update:isSearchActive', val);
},
_isReasonActive(val: boolean) {
this.$emit('update:isReasonActive', val);
}, },
questionValue(val: string) { questionValue(val: string) {
this.$emit('update:question', val); this.$emit('update:question', val);
@@ -148,6 +206,16 @@ export default defineComponent({
this.questionValue = val; this.questionValue = val;
} }
}, },
isReasonActive(val: boolean) {
if (val !== this._isReasonActive) {
this._isReasonActive = val;
}
},
isSearchActive(val: boolean) {
if (val !== this._isSearchActive) {
this._isSearchActive = val;
}
},
references(val: string[]) { references(val: string[]) {
if (val.length === 0) { if (val.length === 0) {
this.fileList = []; this.fileList = [];
@@ -241,8 +309,10 @@ textarea.input:focus {
&.disabled { &.disabled {
.btn-upload { .btn-upload {
cursor: not-allowed; cursor: not-allowed;
pointer-events: none;
color: var(--el-text-color-disabled) !important;
.icon-attachment { .icon-attachment {
color: var(--el-text-color-disabled); color: var(--el-text-color-disabled) !important;
} }
} }
} }
@@ -255,88 +325,82 @@ textarea.input:focus {
font-size: 16px; font-size: 16px;
margin-bottom: 50px; margin-bottom: 50px;
} }
.btn { .tools {
display: block; position: absolute;
z-index: 100; left: 15px;
cursor: pointer; bottom: 15px;
border: 1px solid var(--el-border-color-lighter); display: flex;
width: fit-content; flex-direction: row;
align-items: flex-start;
.btn {
display: block;
margin-right: 10px;
z-index: 100;
cursor: pointer;
border: 1px solid var(--el-border-color-lighter);
width: fit-content;
height: 36px;
line-height: 36px;
user-select: none;
&.disabled {
cursor: not-allowed;
pointer-events: none;
color: var(--el-text-color-disabled) !important;
}
&.btn-upload {
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-search {
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-search {
font-size: 16px;
}
}
&.btn-reason {
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,
.btn-stop {
position: absolute; position: absolute;
bottom: 15px; bottom: 15px;
right: 15px;
border-radius: 50%;
width: 36px;
height: 36px; height: 36px;
line-height: 36px; line-height: 36px;
user-select: none; text-align: center;
background-color: var(--el-color-black);
color: var(--el-color-white);
font-size: 16px;
&.disabled { &.disabled {
display: none;
cursor: not-allowed; 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-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-search {
font-size: 16px;
}
}
&.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 {
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;
}
} }
} }
} }
+5 -5
View File
@@ -48,11 +48,11 @@
v-model="questionValue" v-model="questionValue"
type="textarea" type="textarea"
class="chat-input" class="chat-input"
@keydown.enter.exact.prevent="sendEdit" @keydown.enter.exact.prevent="onEdit"
></el-input> ></el-input>
<div class="button-group"> <div class="button-group">
<el-button size="small" round @click="cancelEdit">{{ $t('common.button.cancel') }}</el-button> <el-button size="small" round @click="cancelEdit">{{ $t('common.button.cancel') }}</el-button>
<el-button type="primary" size="small" round @click="sendEdit">{{ $t('common.button.confirm') }}</el-button> <el-button type="primary" size="small" round @click="onEdit">{{ $t('common.button.confirm') }}</el-button>
</div> </div>
</div> </div>
<answering-mark v-if="message.state === messageState.PENDING" /> <answering-mark v-if="message.state === messageState.PENDING" />
@@ -75,7 +75,7 @@
" "
class="btn-restart" class="btn-restart"
:messages="messages" :messages="messages"
@restart="sendRestart" @restart="onRestart"
/> />
</div> </div>
</div> </div>
@@ -199,11 +199,11 @@ export default defineComponent({
cancelEdit() { cancelEdit() {
this.isEditing = false; this.isEditing = false;
}, },
sendRestart() { onRestart() {
// Implement the logic to save the edited content // Implement the logic to save the edited content
this.$emit('restart', this.message); this.$emit('restart', this.message);
}, },
sendEdit() { onEdit() {
// Implement the logic to save the edited content // Implement the logic to save the edited content
this.isEditing = false; this.isEditing = false;
this.onSubmit(); this.onSubmit();
+29 -16
View File
@@ -26,12 +26,17 @@
</div> </div>
<div class="composer"> <div class="composer">
<input-box <input-box
v-model:is-search-active="isSearchActive"
v-model:is-reason-active="isReasonActive"
v-model:is-search-enabled="isSearchEnabled"
v-model:is-reason-enabled="isReasonEnabled"
v-model:is-upload-enabled="isUploadEnabled"
:disabled="answering" :disabled="answering"
:question="question" :question="question"
:references="references" :references="references"
:upload="upload"
@update:question="question = $event" @update:question="question = $event"
@update:reason="reason = $event" @update:upload="upload = $event"
@update:search="search = $event"
@update:references="references = $event" @update:references="references = $event"
@submit="onSubmit" @submit="onSubmit"
@stop="onStop" @stop="onStop"
@@ -55,7 +60,6 @@ import {
CHAT_MODEL_GPT_4O, CHAT_MODEL_GPT_4O,
CHAT_MODEL_GROUP_CHATGPT, CHAT_MODEL_GROUP_CHATGPT,
CHAT_MODEL_GROUP_DEEPSEEK, CHAT_MODEL_GROUP_DEEPSEEK,
CHAT_MODEL_O1,
CHAT_MODEL_O1_MINI, CHAT_MODEL_O1_MINI,
CHAT_MODELS, CHAT_MODELS,
ROLE_ASSISTANT, ROLE_ASSISTANT,
@@ -85,8 +89,12 @@ import { CHAT_MODEL_GPT_4_ALL, CHAT_MODEL_GPT_4_VISION } from '@/constants';
export interface IData { export interface IData {
drawer: boolean; drawer: boolean;
question: string; question: string;
search: boolean; upload: boolean;
reason: boolean; isSearchActive: boolean;
isReasonActive: boolean;
isSearchEnabled: boolean;
isReasonEnabled: boolean;
isUploadEnabled: boolean;
references: string[]; references: string[];
answering: boolean; answering: boolean;
messages: IChatMessage[]; messages: IChatMessage[];
@@ -109,8 +117,12 @@ export default defineComponent({
drawer: false, drawer: false,
question: '', question: '',
references: [], references: [],
search: false, upload: false,
reason: false, isSearchActive: false,
isReasonActive: false,
isSearchEnabled: true,
isReasonEnabled: true,
isUploadEnabled: true,
answering: false, answering: false,
canceler: undefined, canceler: undefined,
messages: messages:
@@ -154,7 +166,7 @@ export default defineComponent({
} }
}, },
watch: { watch: {
async search(val) { async isSearchActive(val) {
console.log('search changed', val); console.log('search changed', val);
const model = await this.getModelByAction(); const model = await this.getModelByAction();
if (model) { if (model) {
@@ -168,8 +180,8 @@ export default defineComponent({
// await this.$store.dispatch('chat/setModel', model); // await this.$store.dispatch('chat/setModel', model);
// } // }
// }, // },
async reason() { async isReasonActive(val) {
console.log('reason changed', this.reason); console.log('reason changed', val);
const model = await this.getModelByAction(); const model = await this.getModelByAction();
if (model) { if (model) {
await this.$store.dispatch('chat/setModel', model); await this.$store.dispatch('chat/setModel', model);
@@ -182,6 +194,9 @@ export default defineComponent({
console.log('set model', model); console.log('set model', model);
await this.$store.dispatch('chat/setModel', model); await this.$store.dispatch('chat/setModel', model);
} }
if (val.name === CHAT_MODEL_GROUP_DEEPSEEK.name) {
this.upload = false;
}
}, },
model(val: IChatModel) { model(val: IChatModel) {
console.log('model changed', val); console.log('model changed', val);
@@ -197,7 +212,6 @@ export default defineComponent({
this.conversations?.find((conversation: IChatConversation) => conversation.id === val)?.messages || []; this.conversations?.find((conversation: IChatConversation) => conversation.id === val)?.messages || [];
this.onScrollDown(); this.onScrollDown();
} }
console.log('reason changed', this.reason);
const model = await this.getModelByConversation(); const model = await this.getModelByConversation();
if (model) { if (model) {
await this.$store.dispatch('chat/setModel', model); await this.$store.dispatch('chat/setModel', model);
@@ -240,16 +254,16 @@ export default defineComponent({
}, },
async getModelByAction() { async getModelByAction() {
if (this.modelGroup.name === CHAT_MODEL_GROUP_CHATGPT.name) { if (this.modelGroup.name === CHAT_MODEL_GROUP_CHATGPT.name) {
if (this.reason) { if (this.isReasonActive) {
return CHAT_MODEL_O1_MINI; return CHAT_MODEL_O1_MINI;
} else if (this.search) { } else if (this.isSearchActive) {
return CHAT_MODEL_GPT_4_BROWSING; return CHAT_MODEL_GPT_4_BROWSING;
} else if (this.references.length > 0) { } else if (this.references.length > 0) {
return CHAT_MODEL_GPT_4_ALL; return CHAT_MODEL_GPT_4_ALL;
} }
return CHAT_MODEL_GPT_4O; return CHAT_MODEL_GPT_4O;
} else if (this.modelGroup.name === CHAT_MODEL_GROUP_DEEPSEEK.name) { } else if (this.modelGroup.name === CHAT_MODEL_GROUP_DEEPSEEK.name) {
if (this.reason) { if (this.isReasonActive) {
return CHAT_MODEL_DEEPSEEK_REASONER; return CHAT_MODEL_DEEPSEEK_REASONER;
} }
return CHAT_MODEL_DEEPSEEK_CHAT; return CHAT_MODEL_DEEPSEEK_CHAT;
@@ -446,7 +460,6 @@ export default defineComponent({
if (this.messages && this.messages.length > 0) { if (this.messages && this.messages.length > 0) {
this.messages[this.messages.length - 1].state = IChatMessageState.FAILED; this.messages[this.messages.length - 1].state = IChatMessageState.FAILED;
} }
console.error(error);
if (axios.isCancel(error)) { if (axios.isCancel(error)) {
this.messages[this.messages.length - 1].error = { this.messages[this.messages.length - 1].error = {
code: ERROR_CODE_CANCELED code: ERROR_CODE_CANCELED
@@ -573,7 +586,7 @@ export default defineComponent({
lastMessage?.state !== IChatMessageState.FINISHED ? IChatMessageState.ANSWERING : lastMessage?.state lastMessage?.state !== IChatMessageState.FINISHED ? IChatMessageState.ANSWERING : lastMessage?.state
}; };
conversationId = response?.id; conversationId = response?.id;
this.onScrollDown(); //this.onScrollDown();
}, },
signal: this.canceler.signal signal: this.canceler.signal
} }
+8 -1
View File
@@ -1,7 +1,14 @@
module.exports = { module.exports = {
content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'], purge: {
enabled: process.env.NODE_ENV !== 'development',
content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}']
},
darkMode: false,
theme: { theme: {
extend: {} extend: {}
}, },
variants: {
extend: {}
},
plugins: [] plugins: []
}; };
+352 -322
View File
File diff suppressed because it is too large. Load diff