Skip to content

Commit b4ee39a

Browse files
fix: optimization chart operation style
1 parent 2991f0b commit b4ee39a

File tree

3 files changed

+41
-26
lines changed

3 files changed

+41
-26
lines changed

ui/src/components/ai-chat/component/chat-input-operate/TouchChat.vue

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@
2323
{{ message }}
2424
</span>
2525
</p>
26-
<div class="close">
27-
<el-icon><Close /></el-icon>
28-
</div>
26+
<el-avatar :size="isTouching ? 43 : 50" icon="Close" class="close" />
27+
<!-- <div class="close"></div> -->
2928
<p class="lighter" :style="{ visibility: isTouching ? 'visible' : 'hidden' }">
3029
{{ message }}
3130
</p>
@@ -40,6 +39,7 @@
4039

4140
<script setup lang="ts">
4241
import { ref, watch } from 'vue'
42+
// import { Close } from '@element-plus/icons-vue'
4343
const props = defineProps({
4444
time: {
4545
type: Number,
@@ -143,12 +143,8 @@ function onTouchEnd() {
143143
box-shadow: 0px 4px 8px 0px rgba(31, 35, 41, 0.1);
144144
border: 1px solid rgba(222, 224, 227, 1);
145145
background: rgba(255, 255, 255, 1);
146-
border-radius: 100px;
147-
display: inline-block;
148-
width: 43px;
149-
height: 43px;
150-
line-height: 50px;
151-
font-size: 1.8rem;
146+
color: var(--app-text-color-secondary);
147+
font-size: 1.6rem;
152148
margin: 20px 0;
153149
}
154150
.speech-img {
@@ -163,9 +159,7 @@ function onTouchEnd() {
163159
.close {
164160
background: #f54a45;
165161
color: #ffffff;
166-
width: 50px;
167-
height: 50px;
168-
line-height: 57px;
162+
border: none;
169163
font-size: 2rem;
170164
}
171165
.speech-img {

ui/src/components/ai-chat/component/chat-input-operate/index.vue

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
</el-space>
114114
</div>
115115
</el-scrollbar>
116-
<div class="flex">
116+
<div class="flex" :style="{ alignItems: isMicrophone ? 'center' : 'end' }">
117117
<TouchChat
118118
v-if="isMicrophone"
119119
@TouchStart="startRecording"
@@ -554,7 +554,7 @@ class RecorderManage {
554554
MsgAlert(
555555
t('common.tip'),
556556
`${err}
557-
<div style="width: 100%;height:1px;border-top:1px var(--el-border-color) var(--el-border-style);margin:10px 0;"></div>
557+
<div style="width: 100%;height:1px;border-top:1px var(--el-border-color) var(--el-border-style);margin:10px 0;"></div>
558558
${t('chat.tip.recorderTip')}
559559
<img src="${new URL(`@/assets/tipIMG.jpg`, import.meta.url).href}" style="width: 100%;" />`,
560560
{
@@ -653,13 +653,23 @@ function autoSendMessage() {
653653
audio_list: uploadAudioList.value,
654654
video_list: uploadVideoList.value
655655
})
656-
inputValue.value = ''
657-
uploadImageList.value = []
658-
uploadDocumentList.value = []
659-
uploadAudioList.value = []
660-
uploadVideoList.value = []
661-
if (quickInputRef.value) {
662-
quickInputRef.value.textareaStyle.height = '45px'
656+
657+
if (
658+
props.sendMessage(inputValue.value, {
659+
image_list: uploadImageList.value,
660+
document_list: uploadDocumentList.value,
661+
audio_list: uploadAudioList.value,
662+
video_list: uploadVideoList.value
663+
}) !== undefined
664+
) {
665+
inputValue.value = ''
666+
uploadImageList.value = []
667+
uploadDocumentList.value = []
668+
uploadAudioList.value = []
669+
uploadVideoList.value = []
670+
if (quickInputRef.value) {
671+
quickInputRef.value.textareaStyle.height = '45px'
672+
}
663673
}
664674
}
665675

ui/src/components/ai-chat/index.vue

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,15 @@
55
:class="type"
66
:style="{ height: firsUserInput ? '100%' : undefined }"
77
>
8-
<div
9-
v-show="showUserInputContent"
10-
:class="firsUserInput ? 'firstUserInput' : 'popperUserInput'"
11-
>
8+
<div v-if="showUserInputContent" :class="firsUserInput ? 'firstUserInput' : 'popperUserInput'">
129
<UserForm
1310
v-model:api_form_data="api_form_data"
1411
v-model:form_data="form_data"
1512
:application="applicationDetails"
1613
:type="type"
1714
:first="firsUserInput"
1815
@confirm="UserFormConfirm"
19-
@cancel="() => (showUserInput = false)"
16+
@cancel="UserFormCancel"
2017
ref="userFormRef"
2118
></UserForm>
2219
</div>
@@ -150,6 +147,9 @@ const userFormRef = ref<InstanceType<typeof UserForm>>()
150147
// 用户输入
151148
const firsUserInput = ref(true)
152149
const showUserInput = ref(false)
150+
// 初始表单数据(用于恢复)
151+
const initialFormData = ref({})
152+
const initialApiFormData = ref({})
153153
154154
const isUserInput = computed(
155155
() =>
@@ -193,6 +193,11 @@ watch(
193193
194194
const toggleUserInput = () => {
195195
showUserInput.value = !showUserInput.value
196+
if (showUserInput.value) {
197+
// 保存当前数据作为初始数据(用于可能的恢复)
198+
initialFormData.value = JSON.parse(JSON.stringify(form_data.value))
199+
initialApiFormData.value = JSON.parse(JSON.stringify(api_form_data.value))
200+
}
196201
}
197202
198203
function UserFormConfirm() {
@@ -201,6 +206,12 @@ function UserFormConfirm() {
201206
showUserInput.value = false
202207
}
203208
}
209+
function UserFormCancel() {
210+
// 恢复初始数据
211+
form_data.value = JSON.parse(JSON.stringify(initialFormData.value))
212+
api_form_data.value = JSON.parse(JSON.stringify(initialApiFormData.value))
213+
showUserInput.value = false
214+
}
204215
205216
function sendMessage(val: string, other_params_data?: any, chat?: chatType) {
206217
if (!userFormRef.value?.checkInputParam()) {

0 commit comments

Comments
 (0)