Skip to content

Commit 0c53e31

Browse files
feat: Add a back to bottom button to the chat page(#2957)
1 parent 1fb280a commit 0c53e31

File tree

9 files changed

+145
-66
lines changed

9 files changed

+145
-66
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
<div class="text-center mb-8" v-if="loading">
44
<el-button class="border-primary video-stop-button" @click="stopChat">
55
<app-icon iconName="app-video-stop" class="mr-8"></app-icon>
6-
{{ $t('chat.operation.stopChat') }}</el-button>
6+
{{ $t('chat.operation.stopChat') }}</el-button
7+
>
78
</div>
9+
810
<div class="operate-textarea">
911
<el-scrollbar max-height="136">
1012
<div
@@ -332,7 +334,7 @@ const props = withDefaults(
332334
available: true,
333335
},
334336
)
335-
const emit = defineEmits(['update:chatId', 'update:loading', 'update:showUserInput'])
337+
const emit = defineEmits(['update:chatId', 'update:loading', 'update:showUserInput', 'backBottom'])
336338
const chartOpenId = ref<string>()
337339
const chatId_context = computed({
338340
get: () => {

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
position: relative;
88
color: var(--app-text-color);
99
box-sizing: border-box;
10+
11+
.back-bottom-button {
12+
position: absolute;
13+
right: 14px;
14+
top: -30px;
15+
}
1016
&__content {
1117
padding-top: 0;
1218
box-sizing: border-box;
@@ -16,7 +22,6 @@
1622
}
1723

1824
.content {
19-
2025
:deep(ol) {
2126
margin-left: 16px !important;
2227
}

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

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -66,35 +66,39 @@
6666
</TransitionContent>
6767
</div>
6868
</el-scrollbar>
69-
70-
<ChatInputOperate
71-
:app-id="appId"
72-
:application-details="applicationDetails"
73-
:is-mobile="isMobile"
74-
:type="type"
75-
:send-message="sendMessage"
76-
:open-chat-id="openChatId"
77-
:validate="validate"
78-
:chat-management="ChatManagement"
79-
v-model:chat-id="chartOpenId"
80-
v-model:loading="loading"
81-
v-model:show-user-input="showUserInput"
82-
v-if="type !== 'log'"
83-
>
84-
<template #userInput>
85-
<el-button
86-
v-if="isUserInput || isAPIInput"
87-
class="user-input-button mb-8"
88-
@click="toggleUserInput"
89-
>
90-
<AppIcon iconName="app-edit" :size="16" class="mr-4"></AppIcon>
91-
<span class="ellipsis">
92-
{{ userInputTitle || $t('chat.userInput') }}
93-
</span>
94-
</el-button>
95-
</template>
96-
</ChatInputOperate>
97-
69+
<div style="position: relative">
70+
<!-- 置底按钮 -->
71+
<el-button v-if="isBottom" circle class="back-bottom-button" @click="setScrollBottom">
72+
<el-icon><ArrowDownBold /></el-icon>
73+
</el-button>
74+
<ChatInputOperate
75+
:app-id="appId"
76+
:application-details="applicationDetails"
77+
:is-mobile="isMobile"
78+
:type="type"
79+
:send-message="sendMessage"
80+
:open-chat-id="openChatId"
81+
:validate="validate"
82+
:chat-management="ChatManagement"
83+
v-model:chat-id="chartOpenId"
84+
v-model:loading="loading"
85+
v-model:show-user-input="showUserInput"
86+
v-if="type !== 'log'"
87+
>
88+
<template #userInput>
89+
<el-button
90+
v-if="isUserInput || isAPIInput"
91+
class="user-input-button mb-8"
92+
@click="toggleUserInput"
93+
>
94+
<AppIcon iconName="app-edit" :size="16" class="mr-4"></AppIcon>
95+
<span class="ellipsis">
96+
{{ userInputTitle || $t('chat.userInput') }}
97+
</span>
98+
</el-button>
99+
</template>
100+
</ChatInputOperate>
101+
</div>
98102
<Control></Control>
99103
</template>
100104
</div>
@@ -603,10 +607,12 @@ function chatMessage(chat?: any, problem?: string, re_chat?: boolean, other_para
603607
const scrollTop = ref(0)
604608
605609
const scorll = ref(true)
610+
const isBottom = ref(false)
606611
607612
const getMaxHeight = () => {
608613
return dialogScrollbar.value!.scrollHeight
609614
}
615+
610616
/**
611617
* 滚动滚动条到最上面
612618
* @param $event
@@ -621,6 +627,8 @@ const handleScrollTop = ($event: any) => {
621627
} else {
622628
scorll.value = false
623629
}
630+
isBottom.value =
631+
scrollTop.value + scrollDiv.value.wrapRef.offsetHeight < dialogScrollbar.value!.scrollHeight
624632
emit('scroll', { ...$event, dialogScrollbar: dialogScrollbar.value, scrollDiv: scrollDiv.value })
625633
}
626634
/**

ui/src/components/app-table/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<el-pagination
3737
v-model:current-page="paginationConfig.current_page"
3838
v-model:page-size="paginationConfig.page_size"
39-
:page-sizes="pageSizes"
39+
:page-sizes="paginationConfig.page_sizes|| pageSizes"
4040
:total="paginationConfig.total"
4141
layout="total, prev, pager, next, sizes"
4242
@size-change="handleSizeChange"

ui/src/styles/element-plus.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,11 @@
290290
height: 20px;
291291
font-weight: 400;
292292
}
293+
.el-tag--plain.el-tag--info {
294+
color: var(--app-text-color-secondary);
295+
font-weight: 500;
296+
border-color: var(--app-text-color-light-1);
297+
}
293298

294299
// el-select
295300
.el-select__selected-item {

ui/src/views/problem/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ const paginationConfig = reactive({
207207
current_page: 1,
208208
page_size: 10,
209209
total: 0,
210+
page_sizes: [10, 20, 50, 100, 1000],
210211
})
211212
212213
const filterText = ref('')

ui/src/views/tool/component/ToolListContainer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179
<template #title>
180180
<div>
181181
{{ item.name }}
182-
<el-tag v-if="item.version" class="ml-4">
182+
<el-tag v-if="item.version" class="ml-4" type="info" effect="plain">
183183
{{ item.version }}
184184
</el-tag>
185185
</div>

ui/src/views/tool/toolStore/ToolCard.vue

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
11
<template>
22
<CardBox :title="props.tool.name" :description="props.tool.desc" class="cursor">
33
<template #icon>
4-
<el-avatar v-if="isAppIcon(props.tool?.icon)" shape="square" :size="32" style="background: none">
4+
<el-avatar
5+
v-if="isAppIcon(props.tool?.icon)"
6+
shape="square"
7+
:size="32"
8+
style="background: none"
9+
>
510
<img :src="resetUrl(props.tool?.icon)" alt="" />
611
</el-avatar>
7-
<el-avatar v-else-if="props.tool?.name" :name="props.tool?.name" pinyinColor shape="square" :size="32" />
12+
<el-avatar
13+
v-else-if="props.tool?.name"
14+
:name="props.tool?.name"
15+
pinyinColor
16+
shape="square"
17+
:size="32"
18+
/>
19+
</template>
20+
<template #title>
21+
<div>
22+
{{ props.tool?.name }}
23+
<el-tag v-if="props.tool?.version" class="ml-4" type="info" effect="plain">
24+
{{ props.tool?.version }}
25+
</el-tag>
26+
</div>
827
</template>
928
<template #subTitle>
1029
<el-text class="color-secondary" size="small">
@@ -29,24 +48,24 @@
2948

3049
<script setup lang="ts">
3150
import { ref } from 'vue'
32-
import {isAppIcon, resetUrl} from '@/utils/common'
51+
import { isAppIcon, resetUrl } from '@/utils/common'
3352
3453
const props = defineProps<{
35-
tool: any,
54+
tool: any
3655
getSubTitle: (v: any) => string
3756
addLoading: boolean
3857
}>()
3958
4059
const emit = defineEmits<{
41-
(e: 'handleAdd'): void;
42-
(e: 'handleDetail'): void;
43-
}>();
60+
(e: 'handleAdd'): void
61+
(e: 'handleDetail'): void
62+
}>()
4463
</script>
4564

4665
<style lang="scss" scoped>
4766
.el-card {
4867
:deep(.card-footer) {
49-
&>div:first-of-type {
68+
& > div:first-of-type {
5069
flex: 1;
5170
}
5271

0 commit comments

Comments
 (0)