Skip to content

Commit d0f696d

Browse files
Merge remote-tracking branch 'origin/v2' into v2
2 parents 324f836 + fc35a6b commit d0f696d

File tree

8 files changed

+97
-34
lines changed

8 files changed

+97
-34
lines changed

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -583,16 +583,17 @@ function chatMessage(chat?: any, problem?: string, re_chat?: boolean, other_para
583583
if (props.chatId === 'new') {
584584
emit('refresh', chartOpenId.value)
585585
}
586-
if (props.type === 'debug-ai-chat') {
587-
getSourceDetail(chat)
588-
} else {
589-
if (
590-
props.applicationDetails &&
591-
(props.applicationDetails.show_exec || props.applicationDetails.show_source)
592-
) {
593-
getSourceDetail(chat)
594-
}
595-
}
586+
getSourceDetail(chat)
587+
// if (props.type === 'debug-ai-chat') {
588+
// getSourceDetail(chat)
589+
// } else {
590+
// if (
591+
// props.applicationDetails &&
592+
// (props.applicationDetails.show_exec || props.applicationDetails.show_source)
593+
// ) {
594+
// getSourceDetail(chat)
595+
// }
596+
// }
596597
})
597598
.finally(() => {
598599
ChatManagement.close(chat.id)

ui/src/components/common-list/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ defineExpose({
7979
line-height: 24px;
8080
&.active {
8181
background: var(--el-color-primary-light-9);
82-
border-radius: var();
82+
border-radius: var(--app-border-radius-small);
8383
color: var(--el-color-primary);
8484
font-weight: 500;
8585
&:hover {
8686
background: var(--el-color-primary-light-9);
8787
}
8888
}
8989
&:hover {
90-
border-radius: var();
90+
border-radius: var(--app-border-radius-small);
9191
background: var(--app-text-color-light-1);
9292
}
9393
&.is-active {

ui/src/components/folder-tree/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,15 +377,15 @@ onUnmounted(() => {
377377
margin-bottom: 4px;
378378
&.active {
379379
background: var(--el-color-primary-light-9);
380-
border-radius: var();
380+
border-radius: var(--app-border-radius-small);
381381
color: var(--el-color-primary);
382382
font-weight: 500;
383383
&:hover {
384384
background: var(--el-color-primary-light-9);
385385
}
386386
}
387387
&:hover {
388-
border-radius: var();
388+
border-radius: var(--app-border-radius-small);
389389
background: var(--app-text-color-light-1);
390390
}
391391
&.is-active {

ui/src/components/layout-container/index.vue

Lines changed: 74 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<template>
22
<div class="layout-container flex h-full">
3-
<div :class="`layout-container__left border-r ${isCollapse ? 'hidden' : ''}`">
3+
<div
4+
:class="`layout-container__left border-r ${isCollapse ? 'hidden' : ''}`"
5+
:style="{ width: isCollapse ? 0 : `${leftWidth}px` }"
6+
>
47
<div class="layout-container__left_content">
58
<slot name="left"></slot>
69
</div>
@@ -17,6 +20,12 @@
1720
:icon="isCollapse ? 'ArrowRightBold' : 'ArrowLeftBold'"
1821
/>
1922
</el-tooltip>
23+
<div
24+
v-if="props.resizable"
25+
class="splitter-bar-line"
26+
:class="isResizing ? 'hover' : ''"
27+
@mousedown="onSplitterMouseDown"
28+
></div>
2029
</div>
2130
<div class="layout-container__right">
2231
<slot></slot>
@@ -25,20 +34,56 @@
2534
</template>
2635

2736
<script setup lang="ts">
28-
import { computed, useSlots, ref } from 'vue'
37+
import { onUnmounted, ref } from 'vue'
2938
defineOptions({ name: 'LayoutContainer' })
30-
const slots = useSlots()
39+
3140
const props = defineProps({
32-
header: String || null,
33-
backTo: String,
3441
showCollapse: Boolean,
42+
resizable: Boolean,
43+
minLeftWidth: {
44+
type: Number,
45+
default: 240,
46+
},
47+
maxLeftWidth: {
48+
type: Number,
49+
default: 400,
50+
},
3551
})
3652
3753
const isCollapse = ref(false)
54+
const leftWidth = ref(props.minLeftWidth)
55+
const isResizing = ref(false)
56+
57+
const onSplitterMouseDown = (e: MouseEvent) => {
58+
if (!props.resizable) return
59+
e.preventDefault()
60+
isResizing.value = true
61+
document.body.style.userSelect = 'none'
62+
const startX = e.clientX
63+
const startWidth = leftWidth.value
64+
const onMouseMove = (moveEvent: MouseEvent) => {
65+
if (!isResizing.value) return
66+
const deltaX = moveEvent.clientX - startX
67+
let newWidth = startWidth + deltaX
68+
69+
// 限制宽度在最小和最大值之间
70+
newWidth = Math.max(props.minLeftWidth, Math.min(props.maxLeftWidth, newWidth))
71+
leftWidth.value = newWidth
72+
}
73+
74+
const onMouseUp = () => {
75+
isResizing.value = false
76+
document.body.style.userSelect = ''
77+
document.removeEventListener('mousemove', onMouseMove)
78+
document.removeEventListener('mouseup', onMouseUp)
79+
}
80+
document.addEventListener('mousemove', onMouseMove)
81+
document.addEventListener('mouseup', onMouseUp)
82+
}
3883
39-
const showBack = computed(() => {
40-
const { backTo } = props
41-
return backTo
84+
onUnmounted(() => {
85+
document.removeEventListener('mousemove', () => {})
86+
document.removeEventListener('mouseup', () => {})
4287
})
4388
</script>
4489

@@ -47,17 +92,34 @@ const showBack = computed(() => {
4792
&__left {
4893
position: relative;
4994
box-sizing: border-box;
50-
transition: width 0.28s;
95+
// transition: width 0.28s;
5196
width: var(--sidebar-width);
52-
min-width: var(--sidebar-width);
53-
box-sizing: border-box;
97+
.splitter-bar-line {
98+
z-index: 1;
99+
position: absolute;
100+
top: 0;
101+
right: 0;
102+
cursor: col-resize;
103+
width: 4px;
104+
height: 100%;
105+
&.hover:after {
106+
width: 1px;
107+
height: 100%;
108+
content: '';
109+
z-index: 2;
110+
position: absolute;
111+
right: -1px;
112+
top: 0;
113+
background: var(--el-color-primary);
114+
}
115+
}
54116
55117
.collapse {
56118
position: absolute;
57119
top: 36px;
58120
right: -12px;
59121
box-shadow: 0px 5px 10px 0px var(--app-text-color-light-1);
60-
z-index: 1;
122+
z-index: 2;
61123
}
62124
63125
.layout-container__left_content {

ui/src/views/application/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<LayoutContainer showCollapse class="application-manage">
2+
<LayoutContainer showCollapse resizable class="application-manage">
33
<template #left>
44
<h4 class="p-12-16 pb-0 mt-12">{{ $t('views.application.title') }}</h4>
55

ui/src/views/knowledge/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<LayoutContainer showCollapse class="knowledge-manage">
2+
<LayoutContainer showCollapse resizable class="knowledge-manage">
33
<template #left>
44
<h4 class="p-12-16 pb-0 mt-12">{{ $t('views.knowledge.title') }}</h4>
55

ui/src/views/model/component/Provider.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ const handleSharedNodeClick = () => {
160160
padding: 10px 8px;
161161
font-weight: 400;
162162
&:hover {
163-
border-radius: var();
163+
border-radius: var(--app-border-radius-small);
164164
background: var(--app-text-color-light-1);
165165
}
166166
}
167167
.all-mode-active {
168-
border-radius: var();
168+
border-radius: var(--app-border-radius-small);
169169
color: var(--el-color-primary);
170170
font-weight: 500 !important;
171171
background: var(--el-color-primary-light-9);
@@ -185,7 +185,7 @@ const handleSharedNodeClick = () => {
185185
background: none;
186186
&:hover {
187187
background: var(--app-text-color-light-1);
188-
border-radius: var();
188+
border-radius: var(--app-border-radius-small);
189189
}
190190
}
191191
:deep(.el-collapse-item) {
@@ -211,15 +211,15 @@ const handleSharedNodeClick = () => {
211211
margin-bottom: 4px;
212212
&.active {
213213
background: var(--el-color-primary-light-9);
214-
border-radius: var();
214+
border-radius: var(--app-border-radius-small);
215215
color: var(--el-color-primary);
216216
font-weight: 500;
217217
&:hover {
218218
background: var(--el-color-primary-light-9);
219219
}
220220
}
221221
&:hover {
222-
border-radius: var();
222+
border-radius: var(--app-border-radius-small);
223223
background: var(--app-text-color-light-1);
224224
}
225225
&.is-active {

ui/src/views/tool/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<LayoutContainer showCollapse class="tool-manage">
2+
<LayoutContainer showCollapse resizable class="tool-manage">
33
<template #left>
44
<h4 class="p-12-16 pb-0 mt-12">{{ $t('views.tool.title') }}</h4>
55

0 commit comments

Comments
 (0)