feat(training-workspace): 优化员工培训工作区与角色化常见问题交互
This commit is contained in:
1 parent
61acbe50a7
commit
f1b9b7c3a9
15 files changed
+199
-26
No files matched your search
@@ -26,6 +26,7 @@ const {
|
||||
suggestedQuestionsStyle: 'plain' | 'styled';
|
||||
styledSections: WelcomeQuestionSection[];
|
||||
suggestedQuestions: WelcomeQuestionItem[];
|
||||
hideWelcomeTitle?: boolean;
|
||||
showThinkingBubble: boolean;
|
||||
isThinking: boolean;
|
||||
showChatRating: boolean;
|
||||
@@ -104,6 +105,7 @@ const isLatestAssistantMessage = (items: ChatMessage[], index: number) => {
|
||||
:suggested-questions-style="suggestedQuestionsStyle"
|
||||
:styled-sections="styledSections"
|
||||
:suggested-questions="suggestedQuestions"
|
||||
:hide-title="hideWelcomeTitle"
|
||||
@select-question="emit('select-question', $event)"
|
||||
/>
|
||||
|
||||
|
||||
@@ -45,7 +45,8 @@ const embeddedIframeSrc = computed(() => {
|
||||
return url ? String(url) : undefined;
|
||||
});
|
||||
const canManageMaintenance = computed(() => ['admin', 'maintenance_manager'].includes(String(page.currentUser?.role || '')));
|
||||
const hideWelcomePanel = computed(() => isTrainingAgentPage.value);
|
||||
const hideWelcomePanel = computed(() => false);
|
||||
const hideWelcomeTitle = computed(() => isTrainingAgentPage.value);
|
||||
const isTrainingWorkspaceExpanded = ref(false);
|
||||
const maintenancePanel = ref<'ledger' | 'record' | null>(null);
|
||||
const maintenanceEditRecord = ref<MaintenanceRecord | null>(null);
|
||||
@@ -243,6 +244,7 @@ watch(() => page.currentAgentId, () => {
|
||||
:tool-run-progress-title="page.toolRunProgressTitle"
|
||||
:show-scroll-to-bottom="page.showScrollToBottom"
|
||||
:hide-welcome-panel="hideWelcomePanel"
|
||||
:hide-welcome-title="hideWelcomeTitle"
|
||||
:pin-messages-to-bottom="!isTrainingAgentPage"
|
||||
:scroll-container-holder="page.scrollContainerHolder"
|
||||
@copy="page.copyToClipboard($event.message, $event.index)"
|
||||
|
||||
@@ -23,6 +23,7 @@ const props = defineProps<{
|
||||
suggestedQuestionsStyle: 'plain' | 'styled';
|
||||
styledSections: WelcomeQuestionSection[];
|
||||
suggestedQuestions: WelcomeQuestionItem[];
|
||||
hideTitle?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -32,18 +33,19 @@ const emit = defineEmits<{
|
||||
const { t } = useI18n();
|
||||
|
||||
const displayAgentName = computed(() => props.agentName || t('chat.assistantLabel'));
|
||||
const shouldShowTitle = computed(() => !props.hideTitle);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex h-full min-h-0 w-full flex-col items-center px-4 pb-2 pt-2 md:pb-3">
|
||||
<template v-if="suggestedQuestionsStyle === 'styled' && styledSections.length > 0">
|
||||
<h2 class="mb-8 mt-12 shrink-0 text-center text-2xl font-bold text-primary md:mt-16 md:text-3xl">
|
||||
<h2 v-if="shouldShowTitle" class="mb-8 mt-12 shrink-0 text-center text-2xl font-bold text-primary md:mt-16 md:text-3xl">
|
||||
<span>{{ $t('chat.welcomeAgentTitlePrefix') }}</span>
|
||||
<span class="mx-1 text-brand-600">{{ displayAgentName }}</span>
|
||||
<span>{{ $t('chat.welcomeAgentTitleSuffix') }}</span>
|
||||
</h2>
|
||||
|
||||
<div class="min-h-0 w-full flex-1 overflow-y-auto pb-2">
|
||||
<div class="min-h-0 w-full flex-1 overflow-y-auto pb-2" :class="shouldShowTitle ? '' : 'pt-4 md:pt-8'">
|
||||
<div class="mx-auto grid w-full max-w-4xl grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div
|
||||
v-for="(section, sectionIndex) in styledSections"
|
||||
@@ -74,13 +76,13 @@ const displayAgentName = computed(() => props.agentName || t('chat.assistantLabe
|
||||
</template>
|
||||
|
||||
<template v-else-if="suggestedQuestions.length > 0">
|
||||
<h2 class="mb-8 mt-12 shrink-0 text-center text-2xl font-bold text-primary md:mt-16 md:text-3xl">
|
||||
<h2 v-if="shouldShowTitle" class="mb-8 mt-12 shrink-0 text-center text-2xl font-bold text-primary md:mt-16 md:text-3xl">
|
||||
<span>{{ $t('chat.welcomeAgentTitlePrefix') }}</span>
|
||||
<span class="mx-1 text-brand-600">{{ displayAgentName }}</span>
|
||||
<span>{{ $t('chat.welcomeAgentTitleSuffix') }}</span>
|
||||
</h2>
|
||||
|
||||
<div class="min-h-0 w-full flex-1 overflow-y-auto pb-2">
|
||||
<div class="min-h-0 w-full flex-1 overflow-y-auto pb-2" :class="shouldShowTitle ? '' : 'pt-6 md:pt-10'">
|
||||
<div class="mx-auto mt-2 flex w-full max-w-3xl flex-wrap justify-center gap-3">
|
||||
<button
|
||||
v-for="(item, index) in suggestedQuestions"
|
||||
@@ -96,7 +98,7 @@ const displayAgentName = computed(() => props.agentName || t('chat.assistantLabe
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<h2 class="mt-12 text-center text-2xl font-bold text-primary md:mt-16 md:text-3xl">
|
||||
<h2 v-if="shouldShowTitle" class="mt-12 text-center text-2xl font-bold text-primary md:mt-16 md:text-3xl">
|
||||
<span>{{ $t('chat.welcomeAgentTitlePrefix') }}</span>
|
||||
<span class="mx-1 text-brand-600">{{ displayAgentName }}</span>
|
||||
<span>{{ $t('chat.welcomeAgentTitleSuffix') }}</span>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* features/chat/components/TrainingWorkspacePanel.vue
|
||||
* 用途:在培训 Agent 的聊天页顶部提供“员工培训 + 培训管理”一体化工作区。
|
||||
* 依赖:useTrainingWorkspace、lucide 图标、聊天页 currentAgent/currentUser。
|
||||
* 逻辑:只在培训 Agent 下渲染;员工角色默认直达展开工作区,管理角色保留问答视图,培训答题不再走聊天链路。
|
||||
* 逻辑:只在培训 Agent 下渲染;普通员工首次进入默认展开工作区,但新建/切换会话后保持收起,避免聊天过程中被自动展开打断。
|
||||
*/
|
||||
import { computed, reactive, ref, watch, type ShallowUnwrapRef } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@@ -123,7 +123,8 @@ watch(
|
||||
() => props.newSessionTick,
|
||||
(tick, prevTick) => {
|
||||
if (!tick || tick === prevTick) return;
|
||||
userExpandedOverride.value = null;
|
||||
// [STEP 1] 新建对话或切换会话后统一收起工作区,避免聊天中因视图重建被自动展开。
|
||||
userExpandedOverride.value = false;
|
||||
applyDefaultExpandedState();
|
||||
},
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user