Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ui/src/components/global/markdown-editor/md-editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
--md-scrollbar-thumb-hover-color: var(--el-scrollbar-hover-bg-color, var(--el-text-color-secondary));
border-radius: var(--el-border-radius-base);
font-weight: 400;
line-height: 22px;
line-height: var(--mk-line-height-base);
font-family: var(--mk-font-family) !important;
height: 130px;

Expand Down Expand Up @@ -98,7 +98,7 @@
p {
padding: 0 !important;
margin: 0 !important;
line-height: 22px !important;
line-height: var(--mk-line-height-base) !important;
}

sup[data-title] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,14 @@ const viewCards = computed(() => {
<template>
<div class="progress-table-item">
<el-popover placement="top-start" :title="row[textField]" :width="200" trigger="hover" :persistent="false">
<template #reference> <el-progress v-bind="$attrs" :percentage="row[valueField]"></el-progress></template>
<template #reference><el-progress v-bind="$attrs" :percentage="row[valueField]"></el-progress></template>
<div>
<el-row v-for="(item, index) in viewCards" :key="index">
<el-col :span="6">{{ item.title }}</el-col>
<el-col :span="18"> <span class="value" :innerHTML="getCardValue(item)"> </span></el-col>
<el-col :span="18"><span class="value" :innerHTML="getCardValue(item)"></span></el-col>
</el-row>
</div>
</el-popover>
</div>
</template>
<style lang="scss" scoped>
@mixin valueScss() {
color: var(--el-text-color-primary);
font-weight: 500;
font-size: 12px;
line-height: 22px;
height: 22px;
}
.progress-table-item {
.value {
float: right;
@include valueScss;
}
}
</style>
<style lang="scss" scoped></style>
24 changes: 1 addition & 23 deletions ui/src/components/mk-dynamics-form/items/table/TableCheckbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,26 +166,4 @@ const activeText = computed(() => {
</div>
</div>
</template>
<style lang="scss" scoped>
.table-checkbox {
.header {
display: flex;
justify-content: space-between;
margin-bottom: 16px;
.title {
color: var(--el-text-color-primary);
font-weight: 400;
font-size: 14px;
line-height: 22px;
}
}
.msg {
margin-top: 12px;
color: rgba(100, 106, 115, 1);
.active {
margin-left: 3px;
color: var(--el-color-primary);
}
}
}
</style>
<style lang="scss" scoped></style>
24 changes: 1 addition & 23 deletions ui/src/components/mk-dynamics-form/items/table/TableRadio.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,26 +156,4 @@ const activeText = computed(() => {
</div>
</div>
</template>
<style lang="scss" scoped>
.table-radio {
.header {
display: flex;
justify-content: space-between;
margin-bottom: 16px;
.title {
color: var(--el-text-color-primary);
font-weight: 400;
font-size: 14px;
line-height: 22px;
}
}
.msg {
margin-top: 12px;
color: rgba(100, 106, 115, 1);
.active {
margin-left: 3px;
color: var(--el-color-primary);
}
}
}
</style>
<style lang="scss" scoped></style>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ defineOptions({ name: 'HistoryPopover' })
const conversationList = useConversationListStore()
const visible = ref(false)
const clearing = ref(false)
// 菜单挂在历史浮层内、滚动区外,避免裁切并保留外层点击判断。
const historyMenuTarget = ref<HTMLDivElement>()

// 每次打开重新加载第一页,滚动到底部时续载。
const handleShow = () => conversationList.loadConversations()
Expand Down Expand Up @@ -55,15 +57,7 @@ function handleClearConversations() {
</script>

<template>
<el-popover
v-model:visible="visible"
trigger="click"
placement="bottom-end"
:width="280"
popper-class="p-2!"
:popper-style="{ '--el-bg-color-overlay': 'var(--mk-N100)' }"
@show="handleShow"
>
<el-popover v-model:visible="visible" trigger="click" placement="bottom-end" :width="280" popper-class="p-2! bg-N100!" @show="handleShow">
<template #reference>
<span class="inline-flex">
<MkTooltip content="历史对话">
Expand Down Expand Up @@ -106,14 +100,14 @@ function handleClearConversations() {
</span>
</template>
<template #action>
<MkDropdown trigger="click" persistent :teleported="false">
<MkDropdown trigger="click" persistent :append-to="historyMenuTarget">
<!-- 打开历史对话操作菜单 -->
<el-button text><MkIcon name="icon_more_outlined" /></el-button>
<template #dropdown>
<MkDropdownMenu>
<RenameConversation :conversation="conversation" />
<!-- 删除历史对话 -->
<MkDropdownItem @click="handleDeleteConversation(conversation)">
<MkDropdownItem divided @click="handleDeleteConversation(conversation)">
<template #icon><MkIcon name="icon_delete-trash_outlined" /></template>
<span>删除</span>
</MkDropdownItem>
Expand All @@ -124,5 +118,6 @@ function handleClearConversations() {
</MkListItem>
</div>
</el-scrollbar>
<div ref="historyMenuTarget" />
</el-popover>
</template>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { useConversationListStore } from '../../../left-sidebar/conversation-list/index'
import HistoryPopover from '../../history-popover/index.vue'
import HistoryPopover from './history-popover/index.vue'

// 左栏放外部设置表单,开合沿用会话列表 store 的侧栏状态。
const { appInfo, leftSideOpen, toggleLeftSide, newConversation } = useConversationListStore()
Expand All @@ -25,7 +25,7 @@ const { appInfo, leftSideOpen, toggleLeftSide, newConversation } = useConversati
</MkTooltip>
<!-- 历史记录 -->
<span class="ml-1">
<HistoryPopover></HistoryPopover>
<HistoryPopover />
</span>
</header>
</template>
8 changes: 2 additions & 6 deletions ui/src/conversation-panel/left-sidebar/account-menu/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,12 @@ const goLogin = () => {
<template>
<MkDropdown v-if="account" class="w-full" trigger="click" placement="top-start" @visible-change="menuVisible = $event">
<!-- 展开账户菜单 -->
<button
type="button"
class="flex-align-center w-full cursor-pointer gap-2 rounded-md py-1 px-2 hover:bg-N900/10"
:class="{ 'bg-N900/10': menuVisible }"
>
<div class="flex-align-center w-full cursor-pointer gap-2 rounded-md py-1 px-2 hover:bg-N900/10" :class="{ 'bg-N900/10': menuVisible }">
<el-avatar :size="32" class="bg-primary-gradient!">
<img src="@/assets/mk_icon_user_gradient.svg" alt="" style="width: 54%" />
</el-avatar>
<span class="truncate" :title="displayName">{{ displayName }}</span>
</button>
</div>
<template #dropdown>
<div class="w-60">
<div class="p-3">
Expand Down
61 changes: 51 additions & 10 deletions ui/src/conversation-panel/left-sidebar/conversation-list/index.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,43 @@
<script setup lang="ts">
import { ref } from 'vue'
import { MsgConfirm } from '@/utils/message'
import RenameConversation from '../../components/rename/index.vue'
import { relativeTimeFormat } from '@/utils/time'
import type { Conversation } from '../../core/types'
import { useConversationListStore } from './index'
import AccountMenu from '../account-menu/index.vue'

defineOptions({ name: 'ConversationList' })

const { appInfo, conversations, currentChatId, selectConversation, newConversation, deleteChat, toggleLeftSide } = useConversationListStore()
const { appInfo, conversations, currentChatId, selectConversation, newConversation, deleteChat, toggleLeftSide, hasMore, loadMore } =
useConversationListStore()

// 历史时间优先使用更新时间,缺少时间的记录不显示占位文案。
const conversationTime = (conversation: Conversation) => relativeTimeFormat(conversation.update_time || conversation.create_time)
// 会话维护沿用调试历史记录的确认与请求流程。
const clearing = ref(false)

function handleDeleteConversation(conversation: Conversation) {
MsgConfirm('确认删除该对话?', '删除后无法恢复。')
.then(() => deleteChat(conversation.id))
.catch(() => {})
}

// 先加载全部分页,再切到新对话并逐条删除;失败时保留未删除记录。
function handleClearConversations() {
if (clearing.value) return
MsgConfirm('确认清空全部历史对话?', '清空后无法恢复。', { confirmButtonText: '清空' })
.then(async () => {
clearing.value = true
while (hasMore.value) await loadMore()
newConversation()
for (const { id } of [...conversations.value]) await deleteChat(id)
})
.catch(() => {})
.finally(() => {
clearing.value = false
})
}
</script>

<template>
Expand Down Expand Up @@ -38,10 +66,12 @@ const conversationTime = (conversation: Conversation) => relativeTimeFormat(conv
<div class="flex-between pl-2 mt-4">
<h6 class="text-N600">历史对话</h6>

<!-- // TODO: 全部清空对话 -->
<el-button text>
<MkIcon name="icon_delete-trash_outlined" />
</el-button>
<MkTooltip content="清空">
<!-- 批量清空历史对话 -->
<el-button text :loading="clearing" :disabled="!conversations.length" @click="handleClearConversations">
<MkIcon name="icon_delete-trash_outlined" />
</el-button>
</MkTooltip>
</div>

<!-- 历史列表独立滚动,应用信息和新建入口保持固定。 -->
Expand All @@ -63,11 +93,22 @@ const conversationTime = (conversation: Conversation) => relativeTimeFormat(conv
{{ conversationTime(conversation) }}
</span>
</template>
<template #action-dropdown>
<MkDropdownItem divided @click="deleteChat(conversation.id)">
<template #icon><MkIcon name="icon_info_outlined" /></template>
<span>删除</span>
</MkDropdownItem>
<template #action>
<MkDropdown trigger="click" persistent>
<!-- 打开历史对话操作菜单 -->
<el-button text><MkIcon name="icon_more_outlined" /></el-button>
<template #dropdown>
<MkDropdownMenu>
<!-- 重命名 -->
<RenameConversation :conversation="conversation" />
<!-- 删除历史对话 -->
<MkDropdownItem divided @click="handleDeleteConversation(conversation)">
<template #icon><MkIcon name="icon_delete-trash_outlined" /></template>
<span>删除</span>
</MkDropdownItem>
</MkDropdownMenu>
</template>
</MkDropdown>
</template>
</MkListItem>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const handleDeleteConversation = (conversation: PortalConversationSummary) => {
<el-button text><MkIcon name="icon_more_outlined" /></el-button>
<template #dropdown>
<MkDropdownMenu>
<!-- 重命名 -->
<RenameConversation
:conversation="conversation"
:application-id="selectedApplicationId"
Expand Down
11 changes: 6 additions & 5 deletions ui/src/styles/element-plus.scss
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@
margin: 0;
height: unset;
&__label {
line-height: 22px;
line-height: var(--mk-line-height-base);
font-weight: 400;
}
&__inner {
Expand Down Expand Up @@ -577,6 +577,7 @@
/* dropdown */
.el-dropdown {
color: currentColor;
line-height: var(--mk-line-height-base);
}

.el-dropdown-menu {
Expand Down Expand Up @@ -628,7 +629,7 @@
color: var(--el-text-color-primary);
}
&__content {
line-height: 22px;
line-height: var(--mk-line-height-base);
}
}

Expand Down Expand Up @@ -911,7 +912,7 @@
}
&__wrapper {
padding: 4px 12px;
line-height: 22px;
line-height: var(--mk-line-height-base);
&.is-disabled {
background-color: var(--mk-N200);
.el-select__caret {
Expand Down Expand Up @@ -1310,7 +1311,7 @@
font-weight: 400;
}
height: auto;
line-height: 22px;
line-height: var(--mk-line-height-base);
align-items: inherit;
}

Expand Down Expand Up @@ -1421,7 +1422,7 @@
--el-upload-dragger-padding-horizontal: 40px;
--el-upload-dragger-padding-vertical: 32px;
&__text {
line-height: 22px;
line-height: var(--mk-line-height-base);
color: var(--el-text-color-primary) !important;
em:hover {
color: var(--el-color-primary-light-5);
Expand Down
Loading