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
2 changes: 1 addition & 1 deletion ui/src/assets/iconfont.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions ui/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ declare module 'vue' {
MkListItem: typeof import('./components/global/mk-list-item/index.vue')['default']
MkMediaPreview: typeof import('./components/global/mk-media-preview/index.vue')['default']
MkQuickCreate: typeof import('./components/global/mk-table/MkQuickCreate.vue')['default']
MkResourceCard: typeof import('./components/global/mk-resource-card/index.vue')['default']
MkResourceCardAction: typeof import('./components/global/mk-resource-card/MkResourceCardAction.vue')['default']
MkResourceCardActionDropdown: typeof import('./components/global/mk-resource-card/MkResourceCardActionDropdown.vue')['default']
MkSearchInput: typeof import('./components/global/mk-search-input/index.vue')['default']
MkSlider: typeof import('./components/global/mk-slider/index.vue')['default']
MkSourceCard: typeof import('./components/global/mk-source-card/index.vue')['default']
MkSourceCardAction: typeof import('./components/global/mk-source-card/MkSourceCardAction.vue')['default']
MkSourceCardActionDropdown: typeof import('./components/global/mk-source-card/MkSourceCardActionDropdown.vue')['default']
MkStatusLabel: typeof import('./components/global/mk-status-label/index.vue')['default']
MkTable: typeof import('./components/global/mk-table/index.vue')['default']
MkTableFilter: typeof import('./components/global/mk-table/mk-table-filter/index.vue')['default']
Expand Down Expand Up @@ -89,11 +89,11 @@ declare global {
const MkListItem: typeof import('./components/global/mk-list-item/index.vue')['default']
const MkMediaPreview: typeof import('./components/global/mk-media-preview/index.vue')['default']
const MkQuickCreate: typeof import('./components/global/mk-table/MkQuickCreate.vue')['default']
const MkResourceCard: typeof import('./components/global/mk-resource-card/index.vue')['default']
const MkResourceCardAction: typeof import('./components/global/mk-resource-card/MkResourceCardAction.vue')['default']
const MkResourceCardActionDropdown: typeof import('./components/global/mk-resource-card/MkResourceCardActionDropdown.vue')['default']
const MkSearchInput: typeof import('./components/global/mk-search-input/index.vue')['default']
const MkSlider: typeof import('./components/global/mk-slider/index.vue')['default']
const MkSourceCard: typeof import('./components/global/mk-source-card/index.vue')['default']
const MkSourceCardAction: typeof import('./components/global/mk-source-card/MkSourceCardAction.vue')['default']
const MkSourceCardActionDropdown: typeof import('./components/global/mk-source-card/MkSourceCardActionDropdown.vue')['default']
const MkStatusLabel: typeof import('./components/global/mk-status-label/index.vue')['default']
const MkTable: typeof import('./components/global/mk-table/index.vue')['default']
const MkTableFilter: typeof import('./components/global/mk-table/mk-table-filter/index.vue')['default']
Expand Down
3 changes: 2 additions & 1 deletion ui/src/components/COMPONENT_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ Element Plus 的 `v-infinite-scroll`。组件通过 `v-model` 管理已经加载
数据驱动时传 `row`,`labelField` 默认 `name`,`index` 默认 0;默认插槽提供 `{ row, index, active }`。
`action`、`action-dropdown` 提供 `{ row, index }`,有可渲染下拉项时优先下拉,否则显示普通操作。
下拉插槽直接放 `MkDropdownItem`,组件提供 More 触发器并隔离行点击;空菜单不显示入口。
操作区在选中时常显,未选中时悬停或内部聚焦显示。

### MkSearchInput

Expand Down Expand Up @@ -404,7 +405,7 @@ Dialog、Drawer、Popover、嵌套区域等其他大、小表格均禁止开启
`size` 沿用 Element Plus Tag 的尺寸类型,统一作用于首个标签、`+N` 和浮层内标签;
传入 `size="small"` 显示小尺寸标签,不传时沿用 Element Plus 的默认尺寸继承行为。

### MkSourceCard
### MkResourceCard

等高资源卡片,`title` 必填,`nick_name`、`create_time` 提供创建信息;
`icon`、`title`(透出 `{ title }`)、`subtitle`、`tag` 插槽可覆盖头部,默认插槽放详情。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ defineExpose({ open })
</MkCardCheckbox>
</template>
<template #default>
<MkSourceCard :title="application.name" :nick_name="application.nick_name || '-'" :create_time="application.create_time">
<MkResourceCard :title="application.name" :nick_name="application.nick_name || '-'" :create_time="application.create_time">
<template #icon><ApplicationIcon :icon="application.icon" /></template>
<p class="line-clamp-2" :title="application.desc || '-'">{{ application.desc || '-' }}</p>
</MkSourceCard>
</MkResourceCard>
</template>
</el-popover>
</template>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/business/select-tool-dialog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ defineExpose({ open })
</MkCardCheckbox>
</template>
<template #default>
<MkSourceCard :title="tool.name" :nick_name="tool.nick_name || '-'" :create_time="tool.create_time">
<MkResourceCard :title="tool.name" :nick_name="tool.nick_name || '-'" :create_time="tool.create_time">
<template #icon><ToolIcon :icon="tool.icon" :type="tool.tool_type" /></template>
<p class="line-clamp-2" :title="tool.desc || '-'">{{ tool.desc || '-' }}</p>
</MkSourceCard>
</MkResourceCard>
</template>
</el-popover>
</template>
Expand Down
5 changes: 3 additions & 2 deletions ui/src/components/global/mk-list-item/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ const hasActionDropdown = computed(() => hasRenderableSlotContent(slots['action-
{{ itemLabel }}
</span>
</slot>
<!-- 操作区保留布局宽度,hover/focus 时显示,并阻止触发行点击。 -->
<!-- 操作区保留布局宽度,选中或 hover/focus 时显示,并阻止触发行点击。 -->
<div
v-if="$slots.action || hasActionDropdown"
class="group-hover-visible ml-auto flex-align-center shrink-0 font-normal text-N900"
class="ml-auto flex-align-center shrink-0 font-normal text-N900"
:class="{ 'group-hover-visible': !active }"
@click.stop
@keydown.stop
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
defineOptions({ name: 'MkSourceCardAction' })
defineOptions({ name: 'MkResourceCardAction' })

defineSlots<{ default: () => unknown }>()
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { computed, useSlots } from 'vue'
import { hasRenderableSlotContent } from '@/utils/vnode'

defineOptions({ name: 'MkSourceCardActionDropdown' })
defineOptions({ name: 'MkResourceCardActionDropdown' })

defineSlots<{ default: () => unknown }>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { computed, h, type FunctionalComponent } from 'vue'
import { dateFormat } from '@/utils/time'
import { hasRenderableSlotContent } from '@/utils/vnode'
import MkSourceCardAction from './MkSourceCardAction.vue'
import MkSourceCardActionDropdown from './MkSourceCardActionDropdown.vue'
import MkResourceCardAction from './MkResourceCardAction.vue'
import MkResourceCardActionDropdown from './MkResourceCardActionDropdown.vue'

/**

Expand All @@ -27,7 +27,7 @@ import MkSourceCardActionDropdown from './MkSourceCardActionDropdown.vue'
* </component>
* </template>
*/
defineOptions({ name: 'MkSourceCard' })
defineOptions({ name: 'MkResourceCard' })

const props = withDefaults(
defineProps<{
Expand All @@ -45,15 +45,17 @@ const emit = defineEmits<{ selected: [selected: boolean] }>()

const slots = defineSlots<{
default?: () => unknown
footer?: (props: { Action: FunctionalComponent; ActionDropdown: typeof MkSourceCardActionDropdown }) => unknown
footer?: (props: { Action: FunctionalComponent; ActionDropdown: typeof MkResourceCardActionDropdown }) => unknown
icon?: () => unknown
subtitle?: () => unknown
tag?: () => unknown
title?: (props: { title: string }) => unknown
}>()

const SourceCardAction: FunctionalComponent = (_, { slots }) => (props.selectable ? null : h(MkSourceCardAction, null, slots))
const hasFooter = computed(() => hasRenderableSlotContent(slots.footer?.({ Action: SourceCardAction, ActionDropdown: MkSourceCardActionDropdown })))
const ResourceCardAction: FunctionalComponent = (_, { slots }) => (props.selectable ? null : h(MkResourceCardAction, null, slots))
const hasFooter = computed(() =>
hasRenderableSlotContent(slots.footer?.({ Action: ResourceCardAction, ActionDropdown: MkResourceCardActionDropdown })),
)

function handleSelect() {
if (props.selectable) emit('selected', !props.selected)
Expand All @@ -70,7 +72,7 @@ function handleSelectedChange(selected: boolean | string | number) {
:role="props.selectable ? 'checkbox' : undefined"
:tabindex="props.selectable ? 0 : undefined"
:shadow="props.disabled ? 'never' : 'hover'"
class="mk-source-card group relative"
class="mk-resource-card group relative"
body-class="flex-column h-full"
@click="handleSelect"
>
Expand Down Expand Up @@ -108,13 +110,13 @@ function handleSelectedChange(selected: boolean | string | number) {
</div>

<footer v-if="hasFooter" class="flex-align-center gap-2">
<slot name="footer" :Action="SourceCardAction" :ActionDropdown="MkSourceCardActionDropdown" />
<slot name="footer" :Action="ResourceCardAction" :ActionDropdown="MkResourceCardActionDropdown" />
</footer>
</el-card>
</template>

<style lang="scss" scoped>
.mk-source-card {
.mk-resource-card {
min-width: 250px;
min-height: 172px;

Expand Down
20 changes: 9 additions & 11 deletions ui/src/conversation-panel/components/header/portal/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,18 @@ const handleNewConversation = () => (props.newConversation ? props.newConversati
</script>

<template>
<header class="flex-align-center py-4 px-6">
<header class="flex-align-center p-4">
<!-- 左侧收起时才在顶部显示:展开左侧 + 新建对话(展开时它们在侧栏内) -->
<template v-if="!list.leftSideOpen.value">
<!-- 展开左侧 -->
<MkTooltip content="展开侧边栏">
<el-button text @click="list.toggleLeftSide()">
<el-button text @click="list.toggleLeftSide()" class="-ml-1 mr-1">
<MkIcon name="icon_sidebar_outlined" :size="18" class="text-N900!" />
</el-button>
</MkTooltip>

<!-- 新建对话 -->
<MkTooltip content="新建对话">
<el-button text @click="handleNewConversation">
<MkIcon name="icon_new-chat_outlined" :size="18" class="text-N900!" />
</el-button>
</MkTooltip>
<el-divider direction="vertical" class="ml-3! mr-4!" />
</template>

<div class="flex-1 flex-align-center">
<div class="flex-1 flex-align-center gap-2">
<h4 class="truncate">{{ list.currentConversation.value?.abstract || '新建对话' }}</h4>
<el-tag type="info">
<div class="flex-align-center gap-1">
Expand All @@ -49,6 +41,12 @@ const handleNewConversation = () => (props.newConversation ? props.newConversati
</div>
</el-tag>
</div>
<!-- 新建对话 -->
<MkTooltip content="新建对话">
<el-button text @click="handleNewConversation">
<MkIcon name="icon_new-chat_outlined" :size="18" class="text-N900!" />
</el-button>
</MkTooltip>
<!-- 进入分享模式,勾选要分享的对话 -->
<MkTooltip v-if="shareable" content="分享">
<el-button text :disabled="!canShare" @click="emit('share')">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,17 @@ const emit = defineEmits<{ select: [applicationId: string] }>()
</script>

<template>
<!-- 门户智能体卡片:全部智能体页与选择智能体抽屉共用,点击卡片或“去对话”进入该智能体的新建对话 -->
<div class="portal-application-cards">
<el-card
v-for="application in applications"
:key="application.id"
shadow="hover"
class="group cursor-pointer"
@click="emit('select', application.id)"
>
<div class="mb-2 flex-align-center gap-2">
<ApplicationIcon :icon="application.icon" :size="20" class="shrink-0" />
<h4 class="min-w-0 flex-1 truncate" :title="application.name">{{ application.name }}</h4>
<!-- 去对话 -->
<el-button type="primary" size="small" class="invisible shrink-0 group-hover:visible" @click.stop="emit('select', application.id)">
去对话
</el-button>
</div>
<div class="line-clamp-2 h-11 text-sm text-N600" :title="application.desc || ''">{{ application.desc || '暂无描述' }}</div>
</el-card>
<!-- 门户智能体卡片:全部智能体页与选择智能体抽屉共用,点击卡片进入该智能体的新建对话 -->
<div class="portal-application-cards mk-resource-card-grid">
<template v-for="application in applications" :key="application.id">
<MkResourceCard :title="application.name" class="min-h-29!" @click="emit('select', application.id)">
<template #icon>
<ApplicationIcon :icon="application.icon" :size="20" class="shrink-0" />
</template>
<div class="line-clamp-2" :title="application.desc || ''">{{ application.desc || '暂无描述' }}</div>
</MkResourceCard>
</template>
</div>
</template>

<style scoped lang="scss">
.portal-application-cards {
display: grid;
gap: 12px;
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
</style>
<style scoped lang="scss"></style>
8 changes: 7 additions & 1 deletion ui/src/conversation-panel/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,11 @@
width: fit-content;
}

.mk-conversation-message-footer {
/* 门户 */
.portal {
.mk-conversation-side-panel {
&.left {
background: var(--mk-N100);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,17 @@ const conversationTime = (conversation: Conversation) => relativeTimeFormat(conv
<div v-if="conversations.length === 0" class="text-N600 text-center mt-4">暂无历史记录</div>
<div v-else class="space-y-1">
<template v-for="conversation in conversations" :key="conversation.id">
<MkListItem
:active="currentChatId === conversation.id"
:class="{ 'bg-white! text-N900! hover:bg-white!': currentChatId === conversation.id }"
@click="selectConversation(conversation.id)"
>
<template #default>
<MkListItem :active="currentChatId === conversation.id" @click="selectConversation(conversation.id)">
<template #default="{ active }">
<span class="min-w-0 flex-1 truncate" :title="conversation.abstract || '新对话'">
{{ conversation.abstract || '新对话' }}
</span>

<!-- 悬停或聚焦列表行时隐藏时间,显示内置更多操作。 -->
<span class="-mr-6 shrink-0 text-sm font-normal text-N500 group-hover:invisible group-focus-within:invisible">
<!-- 选中、悬停或聚焦列表行时隐藏时间,显示内置更多操作。 -->
<span
class="-mr-6 shrink-0 text-sm font-normal text-N500 group-hover:invisible group-focus-within:invisible"
:class="{ invisible: active }"
>
{{ conversationTime(conversation) }}
</span>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,17 @@ defineExpose({ open })
</script>

<template>
<MkDrawer
v-model="visible"
direction="btt"
size="88%"
:close-on-click-modal="true"
:close-on-press-escape="true"
content-class="p-4"
>
<MkDrawer v-model="visible" direction="btt" :close-on-click-modal="true" :close-on-press-escape="true">
<template #header>
<div class="flex-align-center gap-4">
<h4 class="flex-1">选择智能体</h4>
<MkSearchInput v-model="applicationKeyword" class="w-60!" placeholder="搜索" @input="handleKeywordInput" />
<div class="flex-1" />
<div class="flex w-full">
<h4>选择智能体</h4>
<div class="absolute-center w-85">
<MkSearchInput v-model="applicationKeyword" @input="handleKeywordInput" />
</div>
</div>
</template>

<div v-loading="isLoading" class="min-h-40">
<div v-loading="isLoading">
<MkEmpty
v-if="!isLoading && applications.length === 0"
:type="applicationKeyword ? 'search' : 'default'"
Expand Down
Loading
Loading