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
5 changes: 5 additions & 0 deletions ui/src/api/API_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,11 @@ API 对象和工作空间上下文,作为该抽屉的范围选择例外;用
筛选保持一致;分页使用 `ParamsPage` 与 `ResponsePage`。导出沿用 `getExportFile`。
工作空间总量接口返回数值,不与 System 首页的对象响应混用。

System 首页的智能体选项使用 `system/resource-management/application/application.ts` 的
`getApplicationPage(page, query)`,请求 `/system/resource/application/<currentPage>/<pageSize>`。
工作空间筛选通过 `query.workspace_ids` 传入所选工作空间 ID 的 JSON 数组字符串;名称筛选使用 `name`。
Workspace 智能体分页方法只接收分页与查询条件,从当前资源上下文读取工作空间。

### 对话面板接口

`admin/workspace/conversation.ts` 集中维护调试对话的打开、发送、取消、续传、历史会话、
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import { postStream } from '@/api/admin/core/request'
import type { PromptGeneratePayload } from '@/api/types'
import { get, postStream } from '@/api/admin/core/request'
import type { ParamsPage, ResponsePage } from '@/api/admin/core/types'
import type { ApplicationDetail, Dict, PromptGeneratePayload } from '@/api/types'
import { ADMIN_API_BASE_PATH } from '@/api/constants'

const prefix = '/system/resource/application'

/** 获取 System 资源管理智能体分页列表。 */
const getApplicationPage = (page: ParamsPage, query?: Dict<unknown>) => {
return get<ResponsePage<ApplicationDetail>>(`${prefix}/${page.currentPage}/${page.pageSize}`, query)
}

/** 使用指定模型流式生成或优化 System 资源智能体的系统提示词。 */
const postPromptGenerate = (applicationId: string, modelId: string, payload: PromptGeneratePayload) => {
return postStream(ADMIN_API_BASE_PATH, `${prefix}/${applicationId}/model/${modelId}/prompt_generate`, payload)
}

export default {
getApplicationPage,
postPromptGenerate,
}
7 changes: 4 additions & 3 deletions ui/src/api/admin/workspace/application/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import type { ApplicationDetail, ApplicationFormPayload, Dict, PromptGeneratePay
import { getWorkspaceId } from '@/utils/resource-context'
import { ADMIN_API_BASE_PATH } from '@/api/constants'

const getPrefix = (workspaceId = getWorkspaceId()) => {
const getPrefix = () => {
const workspaceId = getWorkspaceId()
return `/workspace/${workspaceId}/application`
}

Expand All @@ -16,8 +17,8 @@ const getAllApplication = (query?: Dict<unknown>) => {
}

/** 获取工作空间智能体列表。 */
const getApplicationPage = (page: ParamsPage, query?: Dict<unknown>, workspaceId?: string) => {
return get<ResponsePage<ApplicationDetail>>(`${getPrefix(workspaceId)}/${page.currentPage}/${page.pageSize}`, query)
const getApplicationPage = (page: ParamsPage, query?: Dict<unknown>) => {
return get<ResponsePage<ApplicationDetail>>(`${getPrefix()}/${page.currentPage}/${page.pageSize}`, query)
}

/** 获取工作空间智能体详情。 */
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/mk-edit-avatar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ onBeforeUnmount(() => {
:show-file-list="false"
:on-change="selectImage"
>
<el-image v-if="previewIcon" :src="previewIcon" fit="cover" class="h-20 w-20" />
<el-image v-if="previewIcon" :src="previewIcon" fit="cover" class="h-20! w-20!" />
<div v-else class="flex-center h-20 w-20 rounded-md border border-dashed bg-N200 hover:border-primary">
<MkIcon name="icon_add_outlined" :size="24" />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const conversationTime = (conversation: Conversation) => relativeTimeFormat(conv
</MkListItem>
<div class="flex-between pl-2 mt-4">
<div class="text-N600 font-medium">历史对话</div>

<!-- // TODO: 全部清空对话 -->
<el-button text>
<MkIcon name="icon_delete-trash_outlined" />
</el-button>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/views/application-detail/chat-user/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ onMounted(() => loadChatUserGroups())

<template>
<div v-loading="loading" class="-mx-6 -mb-6 flex min-h-0 flex-1">
<aside class="flex-column w-sidebar-expanded shrink-0 border-r">
<aside class="flex-column h-layout-content w-sidebar-expanded shrink-0 border-r">
<div class="shrink-0 p-4">
<h4>用户组</h4>
</div>
<!-- 搜索并切换用户组 -->
<MkSearchList :data="chatUserGroups" :default-active="currentGroup?.id" @click="handleSelectGroup" />
</aside>

<section class="flex-column min-w-0 flex-1 pl-6">
<section class="flex-column min-w-0 flex-1 px-6">
<template v-if="currentGroup">
<div class="flex-between shrink-0 gap-4 py-4">
<div class="flex-align-center min-w-0 flex-1 gap-2">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<script setup lang="ts">
import LogoIcon from '@/components/mk-logo/LogoIcon.vue'

defineProps<{ name: string; logo: string | null }>()
</script>

<template>
<section class="flex min-h-140 min-w-0 flex-1 overflow-hidden rounded-xl border">
<div class="flex-column w-chat-sidebar shrink-0 border-r bg-N100 p-4">
<div class="flex-align-center mb-5 gap-2">
<img v-if="logo" :src="logo" alt="门户 Logo" :height="24" class="shrink-0 object-contain" />
<LogoIcon v-else :height="24" class="shrink-0" />
<PortalIcon :icon="logo ?? undefined" />
<h4 class="min-w-0 flex-1 truncate" :title="name">{{ name }}</h4>
<MkIcon name="icon_sidebar_outlined" class="shrink-0" />
</div>
Expand Down
8 changes: 2 additions & 6 deletions ui/src/views/system/chat-management/portal-setting/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
import { computed, onMounted, reactive, ref, useTemplateRef } from 'vue'
import PortalApi from '@/api/admin/system/chat-management/portal-setting.ts'
import type { PortalSetting, PortalSettingPayload } from '@/api/types'
import LogoIcon from '@/components/mk-logo/LogoIcon.vue'
import { copyText } from '@/utils/clipboard'
import { resetUrl } from '@/utils/icon'
import { MsgSuccess } from '@/utils/message'
import { perm } from '@/permission'
import PortalPreview from './components/PortalPreview.vue'
Expand Down Expand Up @@ -99,7 +97,6 @@ const portalCorsOrigins = computed({
},
})
const previewName = computed(() => portalSetting.name)
const previewLogo = computed(() => resetUrl(portalSetting.logo))

onMounted(() => loadPortalSetting())

Expand All @@ -114,8 +111,7 @@ const canEditPortal = computed(() => perm.system.portal.edit())
<el-card shadow="never">
<div class="flex-between gap-3">
<div class="flex-align-center min-w-0 gap-2">
<img v-if="previewLogo" :src="previewLogo" alt="门户 Logo" class="size-6 shrink-0 object-contain" />
<LogoIcon v-else :height="24" class="shrink-0" />
<PortalIcon :icon="portalSetting.logo ?? undefined" />
<h4 class="truncate" :title="previewName">{{ previewName }}</h4>
</div>
<!-- 编辑门户名称与 Logo -->
Expand Down Expand Up @@ -220,7 +216,7 @@ const canEditPortal = computed(() => perm.system.portal.edit())
</div>
</el-card>
</div>
<PortalPreview :name="previewName" :logo="previewLogo" />
<PortalPreview :name="previewName" :logo="portalSetting.logo" />
</div>
</MkViewLayout>
</template>
7 changes: 5 additions & 2 deletions ui/src/views/system/home/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { onMounted, ref, watch } from 'vue'
import SystemHomepageApi from '@/api/admin/system/homepage'
import WorkspaceApi from '@/api/admin/system/workspace'
import ApplicationApi from '@/api/admin/workspace/application/application'
import SystemApplicationApi from '@/api/admin/system/resource-management/application/application'
import type { ApplicationDetail, WorkspaceItem } from '@/api/types'
import WorkspaceDropdown from '@/components/business/workspace-dropdown/index.vue'
import { useStore } from '@/stores'
Expand Down Expand Up @@ -36,7 +36,10 @@ const applicationsLoading = ref(false)
const selectedApplication = ref<ApplicationDetail>()
function loadApplications(query = '') {
applicationsLoading.value = true
return ApplicationApi.getApplicationPage({ currentPage: 1, pageSize: 200 }, { name: query }, selectedWorkspaceId.value)
return SystemApplicationApi.getApplicationPage(
{ currentPage: 1, pageSize: 200 },
{ name: query, workspace_ids: JSON.stringify([selectedWorkspaceId.value]) },
)
.then((result) => {
applications.value = result.records
})
Expand Down
Loading