Skip to content

Commit 14d35c0

Browse files
committed
fix: bug fix
1 parent 31436a7 commit 14d35c0

File tree

2 files changed

+68
-61
lines changed

2 files changed

+68
-61
lines changed

frontend/src/api/chat.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ export class Chat {
134134
chat_type?: string
135135
datasource?: number
136136
engine_type?: string
137+
ds_type?: string
137138

138139
constructor()
139140
constructor(

frontend/src/views/chat/index.vue

Lines changed: 67 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -259,29 +259,35 @@
259259
v-if="computedMessages.length > 0 || (isAssistant && currentChatId)"
260260
class="chat-footer"
261261
>
262-
<div class="input-container" @click="clickInput">
262+
<div class="input-wrapper">
263263
<div class="datasource">
264264
<template v-if="currentChat.datasource && currentChat.datasource_name">
265-
{{ t('qa.selected_datasource') }}:
265+
{{ t('qa.selected_datasource') }}:
266+
<img
267+
style="margin-left: 4px; margin-right: 4px"
268+
:src="currentChatEngineType"
269+
width="16px"
270+
height="16px"
271+
alt=""
272+
/>
266273
<span class="name">
267274
{{ currentChat.datasource_name }}
268275
</span>
269276
</template>
270277
</div>
271-
<div class="input-wrapper">
272-
<el-input
273-
ref="inputRef"
274-
v-model="inputMessage"
275-
:disabled="isTyping"
276-
class="input-area"
277-
type="textarea"
278-
:rows="1"
279-
:autosize="{ minRows: 1, maxRows: 8 }"
280-
:placeholder="t('qa.question_placeholder')"
281-
@keydown.enter.exact.prevent="sendMessage"
282-
@keydown.ctrl.enter.exact.prevent="handleCtrlEnter"
283-
/>
284-
</div>
278+
<el-input
279+
ref="inputRef"
280+
v-model="inputMessage"
281+
:disabled="isTyping"
282+
class="input-area"
283+
type="textarea"
284+
:rows="1"
285+
:autosize="{ minRows: 1, maxRows: 8.583 }"
286+
:placeholder="t('qa.question_placeholder')"
287+
@keydown.enter.exact.prevent="sendMessage"
288+
@keydown.ctrl.enter.exact.prevent="handleCtrlEnter"
289+
/>
290+
285291
<el-button
286292
circle
287293
type="primary"
@@ -315,6 +321,7 @@ import RecommendQuestion from './RecommendQuestion.vue'
315321
import ChatListContainer from './ChatListContainer.vue'
316322
import ChatCreator from '@/views/chat/ChatCreator.vue'
317323
import ChatToolBar from './ChatToolBar.vue'
324+
import { dsTypeWithImg } from '@/views/ds/js/ds-type'
318325
import { useI18n } from 'vue-i18n'
319326
import { find } from 'lodash-es'
320327
import icon_new_chat_outlined from '@/assets/svg/icon_new_chat_outlined.svg'
@@ -432,6 +439,13 @@ function onClickHistory(chat: Chat) {
432439
console.debug('click history', chat)
433440
}
434441
442+
const currentChatEngineType = computed(() => {
443+
return (
444+
dsTypeWithImg.find((ele) => currentChat.value.ds_type === ele.type || ele.type === 'excel') ||
445+
{}
446+
).img
447+
})
448+
435449
function toAssistantHistory(chat: Chat) {
436450
currentChat.value = new ChatInfo(chat)
437451
if (chat !== undefined && chat.id !== undefined && !loading.value) {
@@ -852,21 +866,46 @@ onMounted(() => {
852866
flex-direction: column;
853867
align-items: center;
854868
855-
.input-container {
856-
flex: 1;
857-
display: flex;
858-
flex-direction: column;
859-
align-items: center;
869+
.input-wrapper {
860870
width: 100%;
861-
max-width: 800px;
862-
border-radius: 16px;
863-
border: 1px solid rgba(217, 220, 223, 1);
864-
background: rgba(248, 249, 250, 1);
865-
padding: 12px;
866-
gap: 8px;
867-
868871
position: relative;
869872
873+
.datasource {
874+
width: calc(100% - 2px);
875+
position: absolute;
876+
margin-left: 1px;
877+
margin-top: 1px;
878+
left: 0;
879+
top: 0;
880+
padding-top: 12px;
881+
padding-left: 12px;
882+
z-index: 10;
883+
background: #f8f9fa;
884+
line-height: 22px;
885+
font-size: 14px;
886+
font-weight: 400;
887+
border-top-right-radius: 16px;
888+
border-top-left-radius: 16px;
889+
color: rgba(100, 106, 115, 1);
890+
display: flex;
891+
align-items: center;
892+
893+
.name {
894+
color: rgba(31, 35, 41, 1);
895+
}
896+
}
897+
898+
.input-area {
899+
border-color: #d9dcdf;
900+
901+
:deep(.ed-textarea__inner) {
902+
padding: 42px 12px 52px 12px;
903+
background: #f8f9fa;
904+
border-radius: 16px;
905+
line-height: 24px;
906+
}
907+
}
908+
870909
.input-icon {
871910
min-width: unset;
872911
position: absolute;
@@ -880,39 +919,6 @@ onMounted(() => {
880919
border-color: unset;
881920
}
882921
}
883-
884-
&:hover {
885-
border-color: rgba(28, 186, 144, 1);
886-
}
887-
}
888-
889-
.datasource {
890-
width: 100%;
891-
892-
line-height: 22px;
893-
font-size: 14px;
894-
font-weight: 400;
895-
color: rgba(100, 106, 115, 1);
896-
897-
.name {
898-
color: rgba(31, 35, 41, 1);
899-
}
900-
}
901-
902-
.input-wrapper {
903-
width: 100%;
904-
flex: 1;
905-
906-
.input-area {
907-
height: 100%;
908-
909-
:deep(.ed-textarea__inner) {
910-
height: 100% !important;
911-
background: transparent;
912-
box-shadow: unset;
913-
padding: unset;
914-
}
915-
}
916922
}
917923
}
918924

0 commit comments

Comments
 (0)