Skip to content

Commit 807cc19

Browse files
feat: paragraph move add top and bottom & Optimize style
1 parent 986e244 commit 807cc19

10 files changed

Lines changed: 73 additions & 17 deletions

File tree

ui/src/components/ai-chat/component/operation-button/ChatOperationButton.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<el-divider direction="vertical" />
4949
<el-tooltip effect="dark" :content="$t('chat.operation.regeneration')" placement="top">
5050
<el-button :disabled="chat_loading" text @click="regeneration">
51-
<AppIcon iconName="app-refresh"></AppIcon>
51+
<AppIcon iconName="app-refresh" class="color-secondary"></AppIcon>
5252
</el-button>
5353
</el-tooltip>
5454
<el-divider direction="vertical" />

ui/src/components/tag-group/index.vue

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@
33
<el-tag :size="props.size" class="default-tag tag-ellipsis" :title="props.tags[0]">
44
{{ i18n_name(props.tags[0]) }}
55
</el-tag>
6-
<el-tooltip effect="light" :disabled="tooltipDisabled">
7-
<el-tag :size="props.size" class="info-tag ml-4 cursor" v-if="props.tags?.length > 1">
8-
+{{ props.tags?.length - 1 }}
9-
</el-tag>
10-
<template #content>
6+
<el-popover
7+
placement="bottom"
8+
:disabled="tooltipDisabled"
9+
:popper-style="{ width: 'auto', maxWidth: '300px' }"
10+
>
11+
<template #reference>
12+
<el-tag :size="props.size" class="info-tag ml-4 cursor" v-if="props.tags?.length > 1">
13+
+{{ props.tags?.length - 1 }}
14+
</el-tag>
15+
</template>
16+
<el-space>
1117
<el-tag
1218
:size="props.size"
1319
v-for="item in props.tags.slice(1)"
@@ -16,12 +22,13 @@
1622
>
1723
{{ item }}
1824
</el-tag>
19-
</template>
20-
</el-tooltip>
25+
</el-space>
26+
</el-popover>
2127
</div>
2228
</template>
2329
<script setup lang="ts">
2430
import { i18n_name } from '@/utils/common'
31+
import type { max } from 'moment'
2532
2633
const props = defineProps<{
2734
tags: string[]
@@ -46,4 +53,13 @@ const props = defineProps<{
4653
}
4754
}
4855
}
56+
.el-popper.is-customized {
57+
background: #ffffff;
58+
box-shadow: 0px 4px 8px 0px rgba(31, 35, 41, 0.1);
59+
}
60+
61+
.el-popper.is-customized .el-popper__arrow::before {
62+
background: #ffffff;
63+
right: 0;
64+
}
4965
</style>

ui/src/locales/lang/en-US/views/document.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ export default {
186186
title: 'Move position',
187187
moveUp: 'Move up',
188188
moveDown: 'Move down',
189+
moveTop: 'Move top',
190+
moveBottom: 'Move bottom',
189191
},
190192
generateQuestion: {
191193
title: 'Generate Questions',

ui/src/locales/lang/zh-CN/views/document.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ export default {
176176
title: '移动位置',
177177
moveUp: '上移',
178178
moveDown: '下移',
179+
moveTop: '头部',
180+
moveBottom: '末尾',
179181
},
180182
generateQuestion: {
181183
title: '生成问题',

ui/src/locales/lang/zh-Hant/views/document.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ export default {
177177
title: '移動位置',
178178
moveUp: '上移',
179179
moveDown: '下移',
180+
MoveTop: '頭部',
181+
MoveBottom: '末尾',
180182
},
181183
generateQuestion: {
182184
title: '生成問題',

ui/src/styles/element-plus.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@
2323
--el-card-padding: calc(var(--app-base-px) * 2);
2424
--el-card-border-radius: 6px;
2525
box-shadow: 0px 2px 4px 0px rgba(31, 35, 41, 0.12) !important;
26+
2627
&.is-never-shadow {
2728
border: 1px solid var(--el-card-border-color);
2829
box-shadow: none !important;
2930
}
3031
.el-card__body {
3132
overflow: inherit;
3233
}
33-
&.el-card.is-hover-shadow:hover {
34-
box-shadow: var(--el-box-shadow-light) !important;
34+
&.is-hover-shadow:hover {
35+
box-shadow: 0px 6px 24px 0px rgba(31, 35, 41, 0.08) !important;
3536
}
3637
}
3738

ui/src/views/application/index.vue

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,17 +215,22 @@
215215
</template>
216216
<template #mouseEnter>
217217
<div @click.stop>
218+
<el-tooltip
219+
effect="dark"
220+
:content="$t('views.application.operation.toChat')"
221+
placement="top"
222+
>
223+
<el-button text @click.stop="toChat(item)">
224+
<AppIcon iconName="app-create-chat" class="color-secondary"></AppIcon>
225+
</el-button>
226+
</el-tooltip>
227+
<el-divider direction="vertical" />
218228
<el-dropdown trigger="click">
219229
<el-button text @click.stop>
220230
<AppIcon iconName="app-more"></AppIcon>
221231
</el-button>
222232
<template #dropdown>
223233
<el-dropdown-menu>
224-
<el-dropdown-item @click.stop="toChat(item)">
225-
<AppIcon iconName="app-create-chat" class="color-secondary"></AppIcon>
226-
{{ $t('views.application.operation.toChat') }}
227-
</el-dropdown-item>
228-
229234
<el-dropdown-item
230235
@mousedown.stop="settingApplication($event, item)"
231236
v-if="permissionPrecise.edit(item.id)"

ui/src/views/chat/component/HistoryPanel.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
<h4
2424
v-show="!isPcCollapse"
2525
:style="{ color: applicationDetail?.custom_theme?.header_font_color }"
26+
class="ellipsis"
27+
style="max-width: 185px"
28+
:title="applicationDetail?.name"
2629
>
2730
{{ applicationDetail?.name }}
2831
</h4>

ui/src/views/paragraph/component/ParagraphCard.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@
9292
</div>
9393
<template #dropdown>
9494
<el-dropdown-menu>
95+
<el-dropdown-item
96+
:disabled="!props.showMoveUp"
97+
@click.stop="emit('move', 'top')"
98+
>
99+
{{ $t('views.document.movePosition.moveTop') }}
100+
</el-dropdown-item>
95101
<el-dropdown-item
96102
:disabled="!props.showMoveUp"
97103
@click.stop="emit('move', 'up')"
@@ -104,6 +110,12 @@
104110
>
105111
{{ $t('views.document.movePosition.moveDown') }}
106112
</el-dropdown-item>
113+
<el-dropdown-item
114+
:disabled="!props.showMoveDown"
115+
@click.stop="emit('move', 'bottom')"
116+
>
117+
{{ $t('views.document.movePosition.moveBottom') }}
118+
</el-dropdown-item>
107119
</el-dropdown-menu>
108120
</template>
109121
</el-dropdown>

ui/src/views/paragraph/index.vue

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
null,
139139
{
140140
paragraph_id: item.id,
141-
new_position: val === 'up' ? index - 1 : index + 1,
141+
new_position: setPosition(val, index),
142142
},
143143
index,
144144
)
@@ -251,6 +251,18 @@ watch(
251251
dialogVisible.value = val
252252
},
253253
)
254+
255+
function setPosition(val: string, index: number) {
256+
if (val === 'top') {
257+
return 0
258+
} else if (val === 'bottom') {
259+
return paragraphDetail.value.length - 1
260+
} else if (val === 'up') {
261+
return index - 1
262+
} else if (val === 'down') {
263+
return index + 1
264+
}
265+
}
254266
function dialogVisibleChange(val: boolean) {
255267
dialogVisible.value = val
256268
}
@@ -409,7 +421,8 @@ function onEnd(event?: any, params?: any, index?: number) {
409421
}
410422
const obj = p ?? {
411423
paragraph_id: paragraphDetail.value[event.newIndex].id, // 当前拖动的段落ID
412-
new_position: paragraphDetail.value[event.newIndex + 1]?.position || paragraphDetail.value.length, // 新位置的段落位置
424+
new_position:
425+
paragraphDetail.value[event.newIndex + 1]?.position || paragraphDetail.value.length, // 新位置的段落位置
413426
}
414427
// console.log(paragraphDetail.value[event.newIndex], obj)
415428
loadSharedApi({ type: 'paragraph', systemType: apiType.value }).putAdjustPosition(

0 commit comments

Comments
 (0)