Skip to content

Commit 9e82c30

Browse files
fix: system home error
1 parent da8b521 commit 9e82c30

9 files changed

Lines changed: 31 additions & 20 deletions

File tree

‎ui/src/api/API_README.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,11 @@ API 对象和工作空间上下文,作为该抽屉的范围选择例外;用
436436
筛选保持一致;分页使用 `ParamsPage` 与 `ResponsePage`。导出沿用 `getExportFile`。
437437
工作空间总量接口返回数值,不与 System 首页的对象响应混用。
438438

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

441446
`admin/workspace/conversation.ts` 集中维护调试对话的打开、发送、取消、续传、历史会话、
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1-
import { postStream } from '@/api/admin/core/request'
2-
import type { PromptGeneratePayload } from '@/api/types'
1+
import { get, postStream } from '@/api/admin/core/request'
2+
import type { ParamsPage, ResponsePage } from '@/api/admin/core/types'
3+
import type { ApplicationDetail, Dict, PromptGeneratePayload } from '@/api/types'
34
import { ADMIN_API_BASE_PATH } from '@/api/constants'
45

56
const prefix = '/system/resource/application'
67

8+
/** 获取 System 资源管理智能体分页列表。 */
9+
const getApplicationPage = (page: ParamsPage, query?: Dict<unknown>) => {
10+
return get<ResponsePage<ApplicationDetail>>(`${prefix}/${page.currentPage}/${page.pageSize}`, query)
11+
}
12+
713
/** 使用指定模型流式生成或优化 System 资源智能体的系统提示词。 */
814
const postPromptGenerate = (applicationId: string, modelId: string, payload: PromptGeneratePayload) => {
915
return postStream(ADMIN_API_BASE_PATH, `${prefix}/${applicationId}/model/${modelId}/prompt_generate`, payload)
1016
}
1117

1218
export default {
19+
getApplicationPage,
1320
postPromptGenerate,
1421
}

‎ui/src/api/admin/workspace/application/application.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import type { ApplicationDetail, ApplicationFormPayload, Dict, PromptGeneratePay
44
import { getWorkspaceId } from '@/utils/resource-context'
55
import { ADMIN_API_BASE_PATH } from '@/api/constants'
66

7-
const getPrefix = (workspaceId = getWorkspaceId()) => {
7+
const getPrefix = () => {
8+
const workspaceId = getWorkspaceId()
89
return `/workspace/${workspaceId}/application`
910
}
1011

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

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

2324
/** 获取工作空间智能体详情。 */

‎ui/src/components/mk-edit-avatar/index.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ onBeforeUnmount(() => {
131131
:show-file-list="false"
132132
:on-change="selectImage"
133133
>
134-
<el-image v-if="previewIcon" :src="previewIcon" fit="cover" class="h-20 w-20" />
134+
<el-image v-if="previewIcon" :src="previewIcon" fit="cover" class="h-20! w-20!" />
135135
<div v-else class="flex-center h-20 w-20 rounded-md border border-dashed bg-N200 hover:border-primary">
136136
<MkIcon name="icon_add_outlined" :size="24" />
137137
</div>

‎ui/src/conversation-panel/left-sidebar/conversation-list/index.vue‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ const conversationTime = (conversation: Conversation) => relativeTimeFormat(conv
3333
</MkListItem>
3434
<div class="flex-between pl-2 mt-4">
3535
<div class="text-N600 font-medium">历史对话</div>
36+
37+
<!-- // TODO: 全部清空对话 -->
3638
<el-button text>
3739
<MkIcon name="icon_delete-trash_outlined" />
3840
</el-button>

‎ui/src/views/application-detail/chat-user/index.vue‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,15 @@ onMounted(() => loadChatUserGroups())
145145

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

156-
<section class="flex-column min-w-0 flex-1 pl-6">
156+
<section class="flex-column min-w-0 flex-1 px-6">
157157
<template v-if="currentGroup">
158158
<div class="flex-between shrink-0 gap-4 py-4">
159159
<div class="flex-align-center min-w-0 flex-1 gap-2">

‎ui/src/views/system/chat-management/portal-setting/components/PortalPreview.vue‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
<script setup lang="ts">
2-
import LogoIcon from '@/components/mk-logo/LogoIcon.vue'
3-
42
defineProps<{ name: string; logo: string | null }>()
53
</script>
64

75
<template>
86
<section class="flex min-h-140 min-w-0 flex-1 overflow-hidden rounded-xl border">
97
<div class="flex-column w-chat-sidebar shrink-0 border-r bg-N100 p-4">
108
<div class="flex-align-center mb-5 gap-2">
11-
<img v-if="logo" :src="logo" alt="门户 Logo" :height="24" class="shrink-0 object-contain" />
12-
<LogoIcon v-else :height="24" class="shrink-0" />
9+
<PortalIcon :icon="logo ?? undefined" />
1310
<h4 class="min-w-0 flex-1 truncate" :title="name">{{ name }}</h4>
1411
<MkIcon name="icon_sidebar_outlined" class="shrink-0" />
1512
</div>

‎ui/src/views/system/chat-management/portal-setting/index.vue‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
import { computed, onMounted, reactive, ref, useTemplateRef } from 'vue'
33
import PortalApi from '@/api/admin/system/chat-management/portal-setting.ts'
44
import type { PortalSetting, PortalSettingPayload } from '@/api/types'
5-
import LogoIcon from '@/components/mk-logo/LogoIcon.vue'
65
import { copyText } from '@/utils/clipboard'
7-
import { resetUrl } from '@/utils/icon'
86
import { MsgSuccess } from '@/utils/message'
97
import { perm } from '@/permission'
108
import PortalPreview from './components/PortalPreview.vue'
@@ -99,7 +97,6 @@ const portalCorsOrigins = computed({
9997
},
10098
})
10199
const previewName = computed(() => portalSetting.name)
102-
const previewLogo = computed(() => resetUrl(portalSetting.logo))
103100
104101
onMounted(() => loadPortalSetting())
105102
@@ -114,8 +111,7 @@ const canEditPortal = computed(() => perm.system.portal.edit())
114111
<el-card shadow="never">
115112
<div class="flex-between gap-3">
116113
<div class="flex-align-center min-w-0 gap-2">
117-
<img v-if="previewLogo" :src="previewLogo" alt="门户 Logo" class="size-6 shrink-0 object-contain" />
118-
<LogoIcon v-else :height="24" class="shrink-0" />
114+
<PortalIcon :icon="portalSetting.logo ?? undefined" />
119115
<h4 class="truncate" :title="previewName">{{ previewName }}</h4>
120116
</div>
121117
<!-- 编辑门户名称与 Logo -->
@@ -220,7 +216,7 @@ const canEditPortal = computed(() => perm.system.portal.edit())
220216
</div>
221217
</el-card>
222218
</div>
223-
<PortalPreview :name="previewName" :logo="previewLogo" />
219+
<PortalPreview :name="previewName" :logo="portalSetting.logo" />
224220
</div>
225221
</MkViewLayout>
226222
</template>

‎ui/src/views/system/home/index.vue‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { onMounted, ref, watch } from 'vue'
33
import SystemHomepageApi from '@/api/admin/system/homepage'
44
import WorkspaceApi from '@/api/admin/system/workspace'
5-
import ApplicationApi from '@/api/admin/workspace/application/application'
5+
import SystemApplicationApi from '@/api/admin/system/resource-management/application/application'
66
import type { ApplicationDetail, WorkspaceItem } from '@/api/types'
77
import WorkspaceDropdown from '@/components/business/workspace-dropdown/index.vue'
88
import { useStore } from '@/stores'
@@ -36,7 +36,10 @@ const applicationsLoading = ref(false)
3636
const selectedApplication = ref<ApplicationDetail>()
3737
function loadApplications(query = '') {
3838
applicationsLoading.value = true
39-
return ApplicationApi.getApplicationPage({ currentPage: 1, pageSize: 200 }, { name: query }, selectedWorkspaceId.value)
39+
return SystemApplicationApi.getApplicationPage(
40+
{ currentPage: 1, pageSize: 200 },
41+
{ name: query, workspace_ids: JSON.stringify([selectedWorkspaceId.value]) },
42+
)
4043
.then((result) => {
4144
applications.value = result.records
4245
})

0 commit comments

Comments
 (0)