@@ -564,12 +575,12 @@ const jumpToExamQuestion = (index: number) => {
diff --git a/frontend/src/features/chat/composables/useTrainingWorkspace.ts b/frontend/src/features/chat/composables/useTrainingWorkspace.ts
index a1900eed..76c7b65d 100644
--- a/frontend/src/features/chat/composables/useTrainingWorkspace.ts
+++ b/frontend/src/features/chat/composables/useTrainingWorkspace.ts
@@ -199,10 +199,20 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
const currentQuestion = computed(() => questionBank.value[currentQuestionIndex.value] || null);
const totalQuestionCount = computed(() => questionBank.value.length);
+ const currentQuestionNumber = computed(() => {
+ if (totalQuestionCount.value <= 0) return 0;
+ return Math.min(currentQuestionIndex.value + 1, totalQuestionCount.value);
+ });
const answeredCount = computed(() => answerRecords.value.length);
const correctCount = computed(() => answerRecords.value.filter((item) => item.correct).length);
const wrongCount = computed(() => answerRecords.value.filter((item) => !item.correct).length);
const isPassed = computed(() => score.value >= passScore.value);
+ const examReadyToSubmit = computed(() => (
+ stage.value === 'exam'
+ && totalQuestionCount.value > 0
+ && answeredCount.value >= totalQuestionCount.value
+ ));
+ const canEnterResultStage = computed(() => stage.value === 'result');
const learnerProgressPercent = computed(() => {
if (stage.value === 'video') return 25;
@@ -305,6 +315,21 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
currentFeedbackCorrect.value = Boolean(currentAnswer?.correct);
};
+ /**
+ * 切换考试题目时,同步左侧题干、已答状态和反馈展示。
+ * AI 触发时机:当员工点击右侧题号导航或后端恢复考试进度时,必须保证“当前题序号、选中项、答题对错反馈”完全一致。
+ */
+ const syncExamQuestionIndex = (nextIndex: number) => {
+ if (totalQuestionCount.value <= 0) {
+ currentQuestionIndex.value = 0;
+ syncAnswerStateForCurrentQuestion();
+ return;
+ }
+ const normalizedIndex = Math.min(Math.max(nextIndex, 0), totalQuestionCount.value - 1);
+ currentQuestionIndex.value = normalizedIndex;
+ syncAnswerStateForCurrentQuestion();
+ };
+
const applyProgressRecord = (record: TrainingProgressRecord | null) => {
if (!record) {
stage.value = 'video';
@@ -314,7 +339,7 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
return;
}
stage.value = record.stage;
- currentQuestionIndex.value = record.currentQuestionIndex;
+ syncExamQuestionIndex(record.currentQuestionIndex);
score.value = Number(record.score || 0);
attemptCount.value = Number(record.attempts || 0);
answerRecords.value = Array.isArray(record.answerDetails) ? record.answerDetails : [];
@@ -510,6 +535,7 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
if (answerLocked.value || !currentQuestion.value) return;
const answeredQuestion = currentQuestion.value;
selectedOptionId.value = optionId;
+ answerLocked.value = true;
const isCorrect = optionId === answeredQuestion.answer;
currentFeedbackCorrect.value = isCorrect;
const nextCorrectAnswerCount = correctCount.value + (isCorrect ? 1 : 0);
@@ -523,25 +549,14 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
answerRecords.value.push(answerRecord);
latestExamFeedback.value = buildExamFeedback(answeredQuestion, answerRecord, nextScore);
- // [STEP 1] 最后一题直接进入结算,对齐文档里的“答完即公布最终成绩”。
+ // [STEP 1] 最后一题答完后先停留在考试阶段,必须点击“提交答卷”才能进入结算结果。
if (currentQuestionIndex.value >= totalQuestionCount.value - 1) {
- stage.value = 'result';
- completionDate.value = formatDate(new Date());
- latestSettledResult.value = {
- score: nextScore,
- correctCount: answerRecords.value.filter((item) => item.correct).length,
- wrongCount: answerRecords.value.filter((item) => !item.correct).length,
- isPassed: nextScore >= passScore.value,
- };
void persistProgress();
return;
}
// [STEP 2] 非最后一题则在聊天流里自动反馈上一题,并紧接着展示下一题。
- currentQuestionIndex.value += 1;
- selectedOptionId.value = '';
- answerLocked.value = false;
- currentFeedbackCorrect.value = false;
+ syncExamQuestionIndex(currentQuestionIndex.value + 1);
void persistProgress();
};
@@ -552,19 +567,30 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
const moveToNextQuestion = () => {
if (!answerLocked.value) return;
if (currentQuestionIndex.value >= totalQuestionCount.value - 1) {
- stage.value = 'result';
- completionDate.value = formatDate(new Date());
- void persistProgress();
return;
}
- currentQuestionIndex.value += 1;
- selectedOptionId.value = '';
- answerLocked.value = false;
- currentFeedbackCorrect.value = false;
+ syncExamQuestionIndex(currentQuestionIndex.value + 1);
latestExamFeedback.value = null;
void persistProgress();
};
+ /**
+ * 统一提交整份答卷并进入结算结果。
+ * AI 触发时机:当员工已完成全部题目但尚未结算时,必须显式点击“提交答卷”后才允许进入第 4 阶段。
+ */
+ const submitExam = () => {
+ if (!examReadyToSubmit.value) return;
+ stage.value = 'result';
+ completionDate.value = formatDate(new Date());
+ latestSettledResult.value = {
+ score: score.value,
+ correctCount: answerRecords.value.filter((item) => item.correct).length,
+ wrongCount: answerRecords.value.filter((item) => !item.correct).length,
+ isPassed: score.value >= passScore.value,
+ };
+ void persistProgress();
+ };
+
const restartExam = () => {
stage.value = 'video';
resetExamState();
@@ -645,6 +671,7 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
activeView,
stage,
currentQuestionIndex,
+ currentQuestionNumber,
currentQuestion,
totalQuestionCount,
passScore,
@@ -654,6 +681,8 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
selectedOptionId,
answerLocked,
currentFeedbackCorrect,
+ examReadyToSubmit,
+ canEnterResultStage,
latestExamFeedback,
latestSettledResult,
answerRecords,
@@ -681,7 +710,9 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
markVideoCompleted,
startExam,
selectAnswer,
+ syncExamQuestionIndex,
moveToNextQuestion,
+ submitExam,
restartExam,
exportRecords,
showVideoModal,
diff --git a/frontend/src/locales/en/chat.json b/frontend/src/locales/en/chat.json
index 16a40fe8..cd8e5b48 100644
--- a/frontend/src/locales/en/chat.json
+++ b/frontend/src/locales/en/chat.json
@@ -526,6 +526,7 @@
"selectedAnswer": "Your answer: {answer}",
"correctAnswer": "Correct answer: {answer}",
"nextQuestion": "Next Question",
+ "submitPaper": "Submit Paper",
"finishExam": "Finish Exam"
},
"result": {
diff --git a/frontend/src/locales/th/chat.json b/frontend/src/locales/th/chat.json
index 826bdf0b..39aabaf8 100644
--- a/frontend/src/locales/th/chat.json
+++ b/frontend/src/locales/th/chat.json
@@ -526,6 +526,7 @@
"selectedAnswer": "คำตอบของคุณ: {answer}",
"correctAnswer": "คำตอบที่ถูกต้อง: {answer}",
"nextQuestion": "ข้อถัดไป",
+ "submitPaper": "ส่งข้อสอบ",
"finishExam": "จบการสอบ"
},
"result": {
diff --git a/frontend/src/locales/zh-CN/chat.json b/frontend/src/locales/zh-CN/chat.json
index aa56cfa8..821b5a1f 100644
--- a/frontend/src/locales/zh-CN/chat.json
+++ b/frontend/src/locales/zh-CN/chat.json
@@ -526,6 +526,7 @@
"selectedAnswer": "你的答案:{answer}",
"correctAnswer": "正确答案:{answer}",
"nextQuestion": "下一题",
+ "submitPaper": "提交答卷",
"finishExam": "完成考试"
},
"result": {
diff --git a/frontend/src/locales/zh-TW/chat.json b/frontend/src/locales/zh-TW/chat.json
index ce7eab0c..48f62e42 100644
--- a/frontend/src/locales/zh-TW/chat.json
+++ b/frontend/src/locales/zh-TW/chat.json
@@ -526,6 +526,7 @@
"selectedAnswer": "你的答案:{answer}",
"correctAnswer": "正確答案:{answer}",
"nextQuestion": "下一題",
+ "submitPaper": "提交答卷",
"finishExam": "完成考試"
},
"result": {
From 61acbe50a7b82fee5dbe10711ca8727e242ef26c Mon Sep 17 00:00:00 2001
From: "DESKTOP-JKIE562\\PC" <1013397054@qq.com>
Date: Thu, 9 Jul 2026 13:19:17 +0800
Subject: [PATCH 2/3] =?UTF-8?q?feat(training-workspace):=20=E4=BC=98?=
=?UTF-8?q?=E5=8C=96=E5=91=98=E5=B7=A5=E5=9F=B9=E8=AE=AD=E5=B7=A5=E4=BD=9C?=
=?UTF-8?q?=E5=8C=BA=E8=80=83=E8=AF=95=E4=BA=A4=E4=BA=92=E4=B8=8E=E5=B1=95?=
=?UTF-8?q?=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../components/TrainingWorkspacePanel.vue | 15 ++----
.../messages/TrainingExamQuestionMessage.vue | 2 +-
.../chat/composables/useTrainingWorkspace.ts | 47 ++++++++++++++++---
frontend/src/locales/en/chat.json | 2 +-
frontend/src/locales/th/chat.json | 2 +-
frontend/src/locales/zh-CN/chat.json | 2 +-
frontend/src/locales/zh-TW/chat.json | 2 +-
7 files changed, 49 insertions(+), 23 deletions(-)
diff --git a/frontend/src/features/chat/components/TrainingWorkspacePanel.vue b/frontend/src/features/chat/components/TrainingWorkspacePanel.vue
index 54edefa2..d55fde9d 100644
--- a/frontend/src/features/chat/components/TrainingWorkspacePanel.vue
+++ b/frontend/src/features/chat/components/TrainingWorkspacePanel.vue
@@ -341,16 +341,10 @@ const handleStageCardClick = (stageKey: string) => {
{{ compactSummary }}
-
-
- {{ $t('chat.training.hr.filters.keywordLabel') }}: {{ workspace.hrKeyword || $t('chat.training.hr.filters.noLimit') }}
- · {{ $t('chat.training.hr.filters.departmentLabel') }}:
- {{ workspace.hrDepartmentFilter === 'all' ? $t('chat.training.hr.filters.allDepartments') : workspace.hrDepartmentFilter }}
-
-
- {{ $t('chat.training.progressPercent') }}: {{ workspace.learnerProgressPercent }}%
- · {{ $t('chat.training.learnerCard.name') }}: {{ workspace.currentUserName }}
-
+
+ {{ $t('chat.training.hr.filters.keywordLabel') }}: {{ workspace.hrKeyword || $t('chat.training.hr.filters.noLimit') }}
+ · {{ $t('chat.training.hr.filters.departmentLabel') }}:
+ {{ workspace.hrDepartmentFilter === 'all' ? $t('chat.training.hr.filters.allDepartments') : workspace.hrDepartmentFilter }}
{
? 'border-emerald-300 bg-emerald-50 text-emerald-700'
: 'border-default bg-white text-secondary hover:border-brand-200 hover:bg-brand-50/40',
]"
- :disabled="workspace.answerLocked"
@click="workspace.selectAnswer(option.id)"
>
diff --git a/frontend/src/features/chat/components/messages/TrainingExamQuestionMessage.vue b/frontend/src/features/chat/components/messages/TrainingExamQuestionMessage.vue
index cba324c9..fe93abbc 100644
--- a/frontend/src/features/chat/components/messages/TrainingExamQuestionMessage.vue
+++ b/frontend/src/features/chat/components/messages/TrainingExamQuestionMessage.vue
@@ -138,7 +138,7 @@ const emit = defineEmits<{
? 'border-emerald-200 bg-emerald-50/50 text-emerald-600'
: 'border-slate-200 bg-white text-slate-600 hover:border-brand-200 hover:bg-brand-50/30 hover:text-brand-700',
]"
- :disabled="answerLocked || isThinking"
+ :disabled="isThinking"
@click="emit('select', option.id)"
>
{{ option.label }}
diff --git a/frontend/src/features/chat/composables/useTrainingWorkspace.ts b/frontend/src/features/chat/composables/useTrainingWorkspace.ts
index 76c7b65d..16a4a158 100644
--- a/frontend/src/features/chat/composables/useTrainingWorkspace.ts
+++ b/frontend/src/features/chat/composables/useTrainingWorkspace.ts
@@ -305,6 +305,29 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
].join('\n');
};
+ /**
+ * 基于当前答题记录重算成绩,保证“修改答案”后分数与结果页口径一致。
+ * AI 触发时机:当培训考试支持点击题号返回修改答案时,不能再用“上一题答对就直接 +1”的增量算法。
+ */
+ const recalculateScoreFromAnswers = (records: TrainingAnswerRecord[]) => calculateTrainingScore(
+ records.filter((item) => item.correct).length,
+ totalQuestionCount.value,
+ );
+
+ /**
+ * 覆盖或新增当前题的作答记录,避免同一道题在进度里出现重复答案。
+ * AI 触发时机:当员工返回已答题修改答案时,必须覆盖旧答案而不是重复追加,否则分数和已答题数都会失真。
+ */
+ const upsertAnswerRecord = (nextRecord: TrainingAnswerRecord) => {
+ const existingIndex = answerRecords.value.findIndex((item) => item.questionId === nextRecord.questionId);
+ if (existingIndex >= 0) {
+ answerRecords.value.splice(existingIndex, 1, nextRecord);
+ return true;
+ }
+ answerRecords.value.push(nextRecord);
+ return false;
+ };
+
const syncAnswerStateForCurrentQuestion = () => {
const questionId = currentQuestion.value?.id;
const currentAnswer = questionId
@@ -531,31 +554,41 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
void persistProgress();
};
+ /**
+ * 记录当前题答案;首次作答沿用自动推进,回看题目时则覆盖旧答案并实时重算分数。
+ * AI 触发时机:当员工在逐题考试阶段点击右侧题号返回某题时,需要允许直接改答且不破坏“提交答卷后才结算”的流程。
+ */
const selectAnswer = (optionId: string) => {
- if (answerLocked.value || !currentQuestion.value) return;
+ if (!currentQuestion.value) return;
const answeredQuestion = currentQuestion.value;
+ const hadExistingAnswer = answerRecords.value.some((item) => item.questionId === answeredQuestion.id);
selectedOptionId.value = optionId;
answerLocked.value = true;
const isCorrect = optionId === answeredQuestion.answer;
currentFeedbackCorrect.value = isCorrect;
- const nextCorrectAnswerCount = correctCount.value + (isCorrect ? 1 : 0);
- const nextScore = calculateTrainingScore(nextCorrectAnswerCount, totalQuestionCount.value);
- score.value = nextScore;
const answerRecord: TrainingAnswerRecord = {
questionId: answeredQuestion.id,
selectedOptionId: optionId,
correct: isCorrect,
};
- answerRecords.value.push(answerRecord);
+ upsertAnswerRecord(answerRecord);
+ const nextScore = recalculateScoreFromAnswers(answerRecords.value);
+ score.value = nextScore;
latestExamFeedback.value = buildExamFeedback(answeredQuestion, answerRecord, nextScore);
- // [STEP 1] 最后一题答完后先停留在考试阶段,必须点击“提交答卷”才能进入结算结果。
+ // [STEP 1] 已答题被回看并改答时,停留在当前题,方便继续检查或跳到其他题。
+ if (hadExistingAnswer) {
+ void persistProgress();
+ return;
+ }
+
+ // [STEP 2] 最后一题首次答完后先停留在考试阶段,必须点击“提交答卷”才能进入结算结果。
if (currentQuestionIndex.value >= totalQuestionCount.value - 1) {
void persistProgress();
return;
}
- // [STEP 2] 非最后一题则在聊天流里自动反馈上一题,并紧接着展示下一题。
+ // [STEP 3] 首次作答且不是最后一题时,自动推进到下一题。
syncExamQuestionIndex(currentQuestionIndex.value + 1);
void persistProgress();
};
diff --git a/frontend/src/locales/en/chat.json b/frontend/src/locales/en/chat.json
index cd8e5b48..2b3e4c72 100644
--- a/frontend/src/locales/en/chat.json
+++ b/frontend/src/locales/en/chat.json
@@ -552,7 +552,7 @@
},
"examQuestionCard": {
"title": "Exam Questions",
- "hint": "Shows all question numbers. They become clickable only during the step-by-step exam stage."
+ "hint": "Shows all question numbers. They become clickable only during the step-by-step exam stage, and answered questions can be revisited and changed."
},
"rules": {
"title": "Exam rules",
diff --git a/frontend/src/locales/th/chat.json b/frontend/src/locales/th/chat.json
index 39aabaf8..0b45f734 100644
--- a/frontend/src/locales/th/chat.json
+++ b/frontend/src/locales/th/chat.json
@@ -552,7 +552,7 @@
},
"examQuestionCard": {
"title": "ข้อสอบ",
- "hint": "แสดงหมายเลขข้อทั้งหมด และจะกดได้เฉพาะในขั้นตอนสอบทีละข้อเท่านั้น"
+ "hint": "แสดงหมายเลขข้อทั้งหมด และจะกดได้เฉพาะในขั้นตอนสอบทีละข้อเท่านั้น พร้อมรองรับการย้อนกลับไปแก้คำตอบ"
},
"rules": {
"title": "กติกาการสอบ",
diff --git a/frontend/src/locales/zh-CN/chat.json b/frontend/src/locales/zh-CN/chat.json
index 821b5a1f..dc5ee16c 100644
--- a/frontend/src/locales/zh-CN/chat.json
+++ b/frontend/src/locales/zh-CN/chat.json
@@ -552,7 +552,7 @@
},
"examQuestionCard": {
"title": "考试题目",
- "hint": "展示全部题目序号;仅在“逐题考试”阶段可点击切换。"
+ "hint": "展示全部题目序号;仅在“逐题考试”阶段可点击切换,并支持返回修改答案。"
},
"rules": {
"title": "考试规则",
diff --git a/frontend/src/locales/zh-TW/chat.json b/frontend/src/locales/zh-TW/chat.json
index 48f62e42..3d731db6 100644
--- a/frontend/src/locales/zh-TW/chat.json
+++ b/frontend/src/locales/zh-TW/chat.json
@@ -552,7 +552,7 @@
},
"examQuestionCard": {
"title": "考試題目",
- "hint": "顯示全部題目序號;僅在「逐題考試」階段可點擊切換。"
+ "hint": "展示全部題目序號;僅在“逐題考試”階段可點擊切換,並支援返回修改答案。"
},
"rules": {
"title": "考試規則",
From f1b9b7c3a961321d871a4af15f21390b5101074e Mon Sep 17 00:00:00 2001
From: "DESKTOP-JKIE562\\PC" <1013397054@qq.com>
Date: Thu, 9 Jul 2026 14:01:13 +0800
Subject: [PATCH 3/3] =?UTF-8?q?feat(training-workspace):=20=E4=BC=98?=
=?UTF-8?q?=E5=8C=96=E5=91=98=E5=B7=A5=E5=9F=B9=E8=AE=AD=E5=B7=A5=E4=BD=9C?=
=?UTF-8?q?=E5=8C=BA=E4=B8=8E=E8=A7=92=E8=89=B2=E5=8C=96=E5=B8=B8=E8=A7=81?=
=?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BA=A4=E4=BA=92?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/funclist.md | 1 +
.../agents/components/AgentFormModal.vue | 33 ++++++++
.../agents/composables/useAgentsAdmin.ts | 32 ++++++--
.../src/features/admin/types/agent.types.ts | 4 +
.../chat/components/ChatMessageList.vue | 2 +
.../chat/components/ChatViewContent.vue | 4 +-
.../chat/components/ChatWelcomePanel.vue | 12 +--
.../components/TrainingWorkspacePanel.vue | 5 +-
.../features/chat/composables/useChatAgent.ts | 27 ++++---
.../features/chat/composables/useChatPage.ts | 2 +-
.../chat/training/trainingChatQuestions.ts | 79 +++++++++++++++++++
frontend/src/locales/en/admin.json | 6 ++
frontend/src/locales/th/admin.json | 6 ++
frontend/src/locales/zh-CN/admin.json | 6 ++
frontend/src/locales/zh-TW/admin.json | 6 ++
15 files changed, 199 insertions(+), 26 deletions(-)
create mode 100644 frontend/src/features/chat/training/trainingChatQuestions.ts
diff --git a/docs/funclist.md b/docs/funclist.md
index a44e8872..d4a41f4d 100644
--- a/docs/funclist.md
+++ b/docs/funclist.md
@@ -28,6 +28,7 @@
| Chat 内培训工作区 | 前端已实现 | 在培训 Agent 聊天页顶部提供视频学习、知识点复盘、逐题考试、成绩结算的一体化工作区 |
| Chat 内 HR 管理面板 | 已实现 | 仅具备培训 HR 管理权限的用户可在同一聊天页查看真实培训统计、筛选记录并导出 Excel;权限支持角色默认值与前端用户配置共同控制 |
| 培训题库后台配置 | 已实现 | Agent 管理表单支持维护及格线、复盘要点、考前清单与题库;员工培训页优先读取 `extra_config.training_config`,未配置时才回退前端默认题库 |
+| 培训聊天常见问题分角色配置 | 已实现 | Agent 管理表单支持分别维护普通员工与 HR 管理员进入“员工培训”聊天页时看到的常见问题;聊天欢迎区会按 `training_hr_manage` 权限自动切换对应问题集 |
| 管理端培训模式配置 | 已实现 | Agent 管理表单支持显式开启培训工作区;平台应用说明页支持上传并标记“员工培训视频 / 员工培训试题 PDF”,并可直接把试题 PDF 解析导入题库表单;扫描件 PDF 在 OCR 依赖齐备时也可回退识别 |
| 首页培训推荐入口 | 前端已实现 | 当 Agent 开启培训模式后,工作台首页会在应用列表上方展示培训强入口卡片 |
| 培训记录后端落库 | 已实现 | 已新增培训记录模型、迁移与用户/管理端 API,考试进度、结果、统计与导出均可走后端数据源 |
diff --git a/frontend/src/features/admin/modules/agents/components/AgentFormModal.vue b/frontend/src/features/admin/modules/agents/components/AgentFormModal.vue
index d7696e28..3cc6f27c 100644
--- a/frontend/src/features/admin/modules/agents/components/AgentFormModal.vue
+++ b/frontend/src/features/admin/modules/agents/components/AgentFormModal.vue
@@ -14,6 +14,10 @@ import type { AgentFormState, AgentGuideSummary } from '@/features/admin/types/a
import type { ScheduleTask } from '@/shared/types/schedule.types';
import type { AgentTypeCatalogEntry, IntentRouteOption } from '../composables/useAgentsAdminRegistry';
import type { AdminContentProfileOption } from '@/features/admin/api/admin.api';
+import {
+ DEFAULT_TRAINING_EMPLOYEE_CHAT_QUESTIONS,
+ DEFAULT_TRAINING_HR_CHAT_QUESTIONS,
+} from '@/features/chat/training/trainingChatQuestions';
import {
applyCatalogDefaultsToForm,
applyContentProfileTemplate,
@@ -138,6 +142,12 @@ const applySelectedContentProfileTemplate = (force = false) => {
const handleTrainingWorkspaceToggle = () => {
if (props.form.training_workspace_enabled) {
props.form.content_profile = 'training';
+ if (!props.form.training_employee_chat_questions_text.trim()) {
+ props.form.training_employee_chat_questions_text = DEFAULT_TRAINING_EMPLOYEE_CHAT_QUESTIONS.join('\n');
+ }
+ if (!props.form.training_hr_chat_questions_text.trim()) {
+ props.form.training_hr_chat_questions_text = DEFAULT_TRAINING_HR_CHAT_QUESTIONS.join('\n');
+ }
} else if (props.form.content_profile === 'training') {
props.form.content_profile = '';
}
@@ -565,6 +575,29 @@ const handleTrainingQuestionTypeChange = (form: AgentFormState, index: number) =
+
+
+
+
+
{{ t('admin.agent.training.employeeChatQuestionsHint') }}
+
+
+
+
+
{{ t('admin.agent.training.hrChatQuestionsHint') }}
+
+
+
diff --git a/frontend/src/features/admin/modules/agents/composables/useAgentsAdmin.ts b/frontend/src/features/admin/modules/agents/composables/useAgentsAdmin.ts
index c44fbef8..498d08c0 100644
--- a/frontend/src/features/admin/modules/agents/composables/useAgentsAdmin.ts
+++ b/frontend/src/features/admin/modules/agents/composables/useAgentsAdmin.ts
@@ -24,6 +24,9 @@ import {
} from '@/features/admin/api/admin.api';
import { listAdminSchedules } from '@/features/admin/api/schedule.api';
import { useMessage } from '@/shared/composables/useMessage';
+import {
+ resolveTrainingRoleChatQuestions,
+} from '@/features/chat/training/trainingChatQuestions';
import type { AdminUserRow } from '@/features/admin/types/admin.types';
import type {
AgentFormState,
@@ -115,21 +118,30 @@ const parseTrainingConfigFromExtra = (extra: Record
| undefined
const hasTrainingContent = questionBank.length > 0
|| Boolean(toMultilineText(merged.summary_points ?? merged.summaryPoints))
|| Boolean(toMultilineText(merged.summary_checklist ?? merged.summaryChecklist));
+ const workspaceEnabled =
+ extra?.training_workspace_enabled === true
+ || extra?.training_workspace_enabled === 'true'
+ || extra?.training_mode === true
+ || extra?.training_mode === 'true'
+ || extra?.training_agent === true
+ || extra?.training_agent === 'true'
+ || hasTrainingContent;
+ const employeeQuestions = resolveTrainingRoleChatQuestions(extra, 'employee');
+ const hrQuestions = resolveTrainingRoleChatQuestions(extra, 'hr');
return {
- training_workspace_enabled:
- extra?.training_workspace_enabled === true
- || extra?.training_workspace_enabled === 'true'
- || extra?.training_mode === true
- || extra?.training_mode === 'true'
- || extra?.training_agent === true
- || extra?.training_agent === 'true'
- || hasTrainingContent,
+ training_workspace_enabled: workspaceEnabled,
training_pass_score: Number.isFinite(Number(merged.pass_score ?? merged.passScore))
? Math.max(0, Math.min(100, Math.round(Number(merged.pass_score ?? merged.passScore))))
: 90,
training_summary_points_text: toMultilineText(merged.summary_points ?? merged.summaryPoints),
training_summary_checklist_text: toMultilineText(merged.summary_checklist ?? merged.summaryChecklist),
+ training_employee_chat_questions_text: employeeQuestions.configured || workspaceEnabled
+ ? toMultilineText(employeeQuestions.questions)
+ : '',
+ training_hr_chat_questions_text: hrQuestions.configured || workspaceEnabled
+ ? toMultilineText(hrQuestions.questions)
+ : '',
training_question_bank: questionBank,
};
};
@@ -170,6 +182,8 @@ const hasTrainingConfigContent = (form: AgentFormState) => (
form.training_workspace_enabled
|| Boolean(form.training_summary_points_text.trim())
|| Boolean(form.training_summary_checklist_text.trim())
+ || Boolean(form.training_employee_chat_questions_text.trim())
+ || Boolean(form.training_hr_chat_questions_text.trim())
|| form.training_question_bank.length > 0
);
@@ -461,6 +475,8 @@ export function useAgentsAdmin() {
pass_score: Math.max(0, Math.min(100, Math.round(Number(form.value.training_pass_score) || 90))),
summary_points: splitMultilineText(form.value.training_summary_points_text),
summary_checklist: splitMultilineText(form.value.training_summary_checklist_text),
+ employee_chat_suggested_questions: splitMultilineText(form.value.training_employee_chat_questions_text),
+ hr_chat_suggested_questions: splitMultilineText(form.value.training_hr_chat_questions_text),
question_bank: form.value.training_question_bank.map((question, index) => buildTrainingQuestionPayload(question, index)),
};
} else {
diff --git a/frontend/src/features/admin/types/agent.types.ts b/frontend/src/features/admin/types/agent.types.ts
index 4722b4dc..99060b53 100644
--- a/frontend/src/features/admin/types/agent.types.ts
+++ b/frontend/src/features/admin/types/agent.types.ts
@@ -109,6 +109,8 @@ export interface AgentFormState {
training_pass_score: number;
training_summary_points_text: string;
training_summary_checklist_text: string;
+ training_employee_chat_questions_text: string;
+ training_hr_chat_questions_text: string;
training_question_bank: AgentTrainingQuestionFormItem[];
}
@@ -163,5 +165,7 @@ export const createEmptyAgentForm = (
training_pass_score: 90,
training_summary_points_text: '',
training_summary_checklist_text: '',
+ training_employee_chat_questions_text: '',
+ training_hr_chat_questions_text: '',
training_question_bank: [],
});
diff --git a/frontend/src/features/chat/components/ChatMessageList.vue b/frontend/src/features/chat/components/ChatMessageList.vue
index e0e49848..d4e5e7df 100644
--- a/frontend/src/features/chat/components/ChatMessageList.vue
+++ b/frontend/src/features/chat/components/ChatMessageList.vue
@@ -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)"
/>
diff --git a/frontend/src/features/chat/components/ChatViewContent.vue b/frontend/src/features/chat/components/ChatViewContent.vue
index 30d560e7..114aef09 100644
--- a/frontend/src/features/chat/components/ChatViewContent.vue
+++ b/frontend/src/features/chat/components/ChatViewContent.vue
@@ -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(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)"
diff --git a/frontend/src/features/chat/components/ChatWelcomePanel.vue b/frontend/src/features/chat/components/ChatWelcomePanel.vue
index 92515eb5..a52bfde0 100644
--- a/frontend/src/features/chat/components/ChatWelcomePanel.vue
+++ b/frontend/src/features/chat/components/ChatWelcomePanel.vue
@@ -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);
-
+
{{ $t('chat.welcomeAgentTitlePrefix') }}
{{ displayAgentName }}
{{ $t('chat.welcomeAgentTitleSuffix') }}
-
+
props.agentName || t('chat.assistantLabe
-
+
{{ $t('chat.welcomeAgentTitlePrefix') }}
{{ displayAgentName }}
{{ $t('chat.welcomeAgentTitleSuffix') }}
-
+