-
+
diff --git a/ui/src/conversation-panel/view/chat/index.vue b/ui/src/conversation-panel/view/chat/index.vue
index 262cffa4076..749cdf96ed8 100644
--- a/ui/src/conversation-panel/view/chat/index.vue
+++ b/ui/src/conversation-panel/view/chat/index.vue
@@ -13,7 +13,7 @@ import { MESSAGE_INPUT_KEY } from '../../components/message-input/index'
import { EXECUTION_DETAIL_KEY } from '../../right-sidebar/execution-detail/index'
import { SHARE_LINK_KEY } from '../../components/message-list/share/index'
import { createChatConversation, createChatUserProfileGetter } from './index'
-import { VIEW_KEY, VIEW_TYPE, DEVICE_KEY, CHAT_USER_PROFILE_KEY, createDeviceType } from '../index.ts'
+import { VIEW_KEY, VIEW_TYPE, DEVICE_KEY, CHAT_USER_PROFILE_KEY, SHOW_SHARE_KEY, createDeviceType } from '../index.ts'
const bundle = createChatConversation()
@@ -38,6 +38,11 @@ provide(MESSAGE_INPUT_KEY, bundle.input)
provide(EXECUTION_DETAIL_KEY, bundle.detail)
provide(SHARE_LINK_KEY, bundle.share)
provide(VIEW_KEY, VIEW_TYPE.CHAT)
+// 智能体开启「允许分享对话记录」时显示标题栏、会话菜单、提问与回答上的分享入口
+provide(
+ SHOW_SHARE_KEY,
+ computed(() => Boolean(bundle.list.appInfo.value?.show_share)),
+)
// HTML 内容 iframe 内 chatUserProfile() 取当前对话用户
provide(CHAT_USER_PROFILE_KEY, createChatUserProfileGetter())
@@ -83,7 +88,7 @@ watch([() => bundle.list.currentChatId.value, () => bundle.list.composerResetSig
@mask-click="closeDrawers"
>
-
+
diff --git a/ui/src/conversation-panel/view/index.ts b/ui/src/conversation-panel/view/index.ts
index d6b74cdfbbc..028b3f9c213 100644
--- a/ui/src/conversation-panel/view/index.ts
+++ b/ui/src/conversation-panel/view/index.ts
@@ -49,3 +49,10 @@ export const CHAT_USER_PROFILE_KEY: InjectionKey = Symbol('c
export function useChatUserProfileGetter(): GetChatUserProfile {
return inject(CHAT_USER_PROFILE_KEY, () => Promise.resolve(null))
}
+
+/** 是否显示进入分享选择的入口;Chat、Portal 视图按智能体的 show_share 提供,调试、日志等视图不提供即不显示。 */
+export const SHOW_SHARE_KEY: InjectionKey>> = Symbol('conversation-show-share')
+
+export function useShowShare(): Readonly[> {
+ return inject(SHOW_SHARE_KEY, () => computed(() => false), true)
+}
diff --git a/ui/src/conversation-panel/view/portal/index.vue b/ui/src/conversation-panel/view/portal/index.vue
index c492eb30314..2d261b4cc55 100644
--- a/ui/src/conversation-panel/view/portal/index.vue
+++ b/ui/src/conversation-panel/view/portal/index.vue
@@ -17,7 +17,7 @@ import { PORTAL_CONVERSATION_LIST_KEY } from '../../left-sidebar/portal-conversa
import { SHARE_LINK_KEY } from '../../components/message-list/share/index'
import { createPortalConversation } from './index'
import { createChatUserProfileGetter } from '../chat/index'
-import { VIEW_KEY, VIEW_TYPE, DEVICE_KEY, CHAT_USER_PROFILE_KEY, createDeviceType } from '../index.ts'
+import { VIEW_KEY, VIEW_TYPE, DEVICE_KEY, CHAT_USER_PROFILE_KEY, SHOW_SHARE_KEY, createDeviceType } from '../index.ts'
const applicationSelectorRef = ref>()
const bundle = createPortalConversation({ openApplicationSelector: () => applicationSelectorRef.value?.open() })
@@ -44,6 +44,11 @@ provide(EXECUTION_DETAIL_KEY, bundle.detail)
provide(SHARE_LINK_KEY, bundle.share)
provide(PORTAL_CONVERSATION_LIST_KEY, bundle.portalList)
provide(VIEW_KEY, VIEW_TYPE.PORTAL)
+// 当前智能体开启「允许分享对话记录」时显示标题栏、提问与回答上的分享入口
+provide(
+ SHOW_SHARE_KEY,
+ computed(() => Boolean(bundle.portalList.currentApplicationId.value && bundle.list.appInfo.value?.show_share)),
+)
// HTML 内容 iframe 内 chatUserProfile() 取当前对话用户
provide(CHAT_USER_PROFILE_KEY, createChatUserProfileGetter())
// 响应式:窄屏 drawer,宽屏 push
]