Merge branch 'dev' into hugo-shipping-notice
This commit is contained in:
commit
0d68048b8e
16 files changed
+420
-384
No files matched your search
@@ -22,14 +22,14 @@ AUTH_JWT_AUDIENCE=758be5fcba2df784fdb4
|
||||
AUTH_JWT_JWKS_URL=http://192.168.100.230:8870/.well-known/jwks
|
||||
|
||||
# Casdoor
|
||||
CASDOOR_BASE_URL=http://ai.well-trust.com:8870
|
||||
CASDOOR_BASE_URL=https://auth.well-trust.com
|
||||
# 与 Casdoor 里 Application「hxops-prod」(或你当前生产应用)的 Client ID 一致
|
||||
CASDOOR_CLIENT_ID=758be5fcba2df784fdb4
|
||||
CASDOOR_CLIENT_SECRET=522161bea5bb4f90b63f77c41dc26d223f1244ab
|
||||
# 兜底 redirect_uri;实际 OAuth 以浏览器地址为准,Casdoor「hxops-prod」应用须登记例如:
|
||||
# http://192.168.100.230:8881/casdoor-callback
|
||||
# http://ai.well-trust.com:8881/casdoor-callback
|
||||
CASDOOR_REDIRECT_URI=http://192.168.100.230:8881/casdoor-callback
|
||||
CASDOOR_REDIRECT_URI=https://ai.well-trust.com/casdoor-callback
|
||||
CASDOOR_SCOPE=openid profile email
|
||||
CASDOOR_ORGANIZATION=organization_HX
|
||||
# Casdoor Providers → wecom:Name 字段(截图即为 wecom);Organization=organization_HX,Sub type=Internal,Scope=snsapi_userinfo
|
||||
|
||||
@@ -22,14 +22,14 @@ AUTH_JWT_AUDIENCE=758be5fcba2df784fdb4
|
||||
AUTH_JWT_JWKS_URL=http://192.168.100.192:8870/.well-known/jwks
|
||||
|
||||
# Casdoor
|
||||
CASDOOR_BASE_URL=http://192.168.100.192:8870
|
||||
CASDOOR_BASE_URL=https://autht.well-trust.com
|
||||
# 与 Casdoor 里 Application「hxops-prod」(或你当前生产应用)的 Client ID 一致
|
||||
CASDOOR_CLIENT_ID=758be5fcba2df784fdb4
|
||||
CASDOOR_CLIENT_SECRET=522161bea5bb4f90b63f77c41dc26d223f1244ab
|
||||
# 兜底 redirect_uri;实际 OAuth 以浏览器地址为准,Casdoor「hxops-prod」应用须登记例如:
|
||||
# http://192.168.100.192:8881/casdoor-callback
|
||||
# http://ai.well-trust.com:8881/casdoor-callback
|
||||
CASDOOR_REDIRECT_URI=http://192.168.100.192:8881/casdoor-callback
|
||||
CASDOOR_REDIRECT_URI=https://ait.well-trust.com/casdoor-callback
|
||||
CASDOOR_SCOPE=openid profile email
|
||||
CASDOOR_ORGANIZATION=organization_HX
|
||||
# Casdoor Providers → wecom:Name 字段(截图即为 wecom);Organization=organization_HX,Sub type=Internal,Scope=snsapi_userinfo
|
||||
|
||||
@@ -38,6 +38,7 @@ def build_dify_inputs_for_context(ctx: ChatStreamContext) -> dict[str, Any]:
|
||||
session_id=str(getattr(ctx.session, 'session_id', '') or ''),
|
||||
request_id=ctx.request_id,
|
||||
trigger_source='frontend_chat',
|
||||
user_role=str(getattr(ctx.user, 'role', '') or '').strip() or None,
|
||||
adapter_hints=ctx.adapter_hints,
|
||||
)
|
||||
|
||||
|
||||
@@ -531,200 +531,202 @@ const handleTrainingQuestionTypeChange = (form: AgentFormState, index: number) =
|
||||
{{ form.training_workspace_enabled ? t('admin.agent.training.enableHint') : t('admin.agent.training.disabledHint') }}
|
||||
</p>
|
||||
|
||||
<div class="mt-4 grid grid-cols-1 gap-4 md:grid-cols-3">
|
||||
<div class="space-y-2">
|
||||
<label class="text-xs font-semibold text-secondary">{{ t('admin.agent.training.passScore') }}</label>
|
||||
<input
|
||||
v-model.number="form.training_pass_score"
|
||||
type="number"
|
||||
min="0"
|
||||
max="100"
|
||||
step="1"
|
||||
class="w-full input-field text-sm"
|
||||
/>
|
||||
<p class="text-xs leading-5 text-muted">{{ t('admin.agent.training.passScoreHint') }}</p>
|
||||
</div>
|
||||
<div class="space-y-2 md:col-span-2">
|
||||
<label class="text-xs font-semibold text-secondary">{{ t('admin.agent.training.summaryPoints') }}</label>
|
||||
<textarea
|
||||
v-model="form.training_summary_points_text"
|
||||
rows="5"
|
||||
class="w-full input-field text-sm"
|
||||
:placeholder="t('admin.agent.training.summaryPointsPlaceholder')"
|
||||
/>
|
||||
</div>
|
||||
<div class="space-y-2 md:col-span-3">
|
||||
<label class="text-xs font-semibold text-secondary">{{ t('admin.agent.training.summaryChecklist') }}</label>
|
||||
<textarea
|
||||
v-model="form.training_summary_checklist_text"
|
||||
rows="4"
|
||||
class="w-full input-field text-sm"
|
||||
:placeholder="t('admin.agent.training.summaryChecklistPlaceholder')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-5 space-y-3">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<div>
|
||||
<div class="text-sm font-semibold text-primary">{{ t('admin.agent.training.questionBank') }}</div>
|
||||
<p class="mt-1 text-xs leading-5 text-muted">{{ t('admin.agent.training.questionHint') }}</p>
|
||||
<template v-if="form.training_workspace_enabled">
|
||||
<div class="mt-4 grid grid-cols-1 gap-4 md:grid-cols-3">
|
||||
<div class="space-y-2">
|
||||
<label class="text-xs font-semibold text-secondary">{{ t('admin.agent.training.passScore') }}</label>
|
||||
<input
|
||||
v-model.number="form.training_pass_score"
|
||||
type="number"
|
||||
min="0"
|
||||
max="100"
|
||||
step="1"
|
||||
class="w-full input-field text-sm"
|
||||
/>
|
||||
<p class="text-xs leading-5 text-muted">{{ t('admin.agent.training.passScoreHint') }}</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1 rounded-lg border border-default bg-white px-3 py-1.5 text-xs font-medium text-secondary transition-colors hover:bg-surface-soft disabled:cursor-not-allowed disabled:opacity-60"
|
||||
:disabled="!isEditing || trainingExamPdfGuides.length === 0 || isImportingTrainingPdf"
|
||||
@click="emit('importTrainingPdf', trainingExamPdfGuides[0]?.id || null)"
|
||||
>
|
||||
<FileDown class="h-4 w-4" />
|
||||
{{ isImportingTrainingPdf ? t('admin.agent.training.importingPdf') : t('admin.agent.training.importFromPdf') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1 rounded-lg border border-default bg-white px-3 py-1.5 text-xs font-medium text-secondary transition-colors hover:bg-surface-soft"
|
||||
@click="emit('addTrainingQuestion')"
|
||||
>
|
||||
<Plus class="h-4 w-4" />
|
||||
{{ t('admin.agent.training.addQuestion') }}
|
||||
</button>
|
||||
<div class="space-y-2 md:col-span-2">
|
||||
<label class="text-xs font-semibold text-secondary">{{ t('admin.agent.training.summaryPoints') }}</label>
|
||||
<textarea
|
||||
v-model="form.training_summary_points_text"
|
||||
rows="5"
|
||||
class="w-full input-field text-sm"
|
||||
:placeholder="t('admin.agent.training.summaryPointsPlaceholder')"
|
||||
/>
|
||||
</div>
|
||||
<div class="space-y-2 md:col-span-3">
|
||||
<label class="text-xs font-semibold text-secondary">{{ t('admin.agent.training.summaryChecklist') }}</label>
|
||||
<textarea
|
||||
v-model="form.training_summary_checklist_text"
|
||||
rows="4"
|
||||
class="w-full input-field text-sm"
|
||||
:placeholder="t('admin.agent.training.summaryChecklistPlaceholder')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="text-xs leading-5 text-muted">
|
||||
{{
|
||||
!isEditing
|
||||
? t('admin.agent.training.importPdfCreateFirst')
|
||||
: trainingExamPdfGuides.length > 0
|
||||
? t('admin.agent.training.importPdfHint', { fileName: trainingExamPdfGuides[0]?.file_name || '--' })
|
||||
: t('admin.agent.training.importPdfMissing')
|
||||
}}
|
||||
</p>
|
||||
|
||||
<div v-if="form.training_question_bank.length === 0" class="rounded-xl border border-dashed border-default bg-white px-4 py-5 text-sm text-muted">
|
||||
{{ t('admin.agent.training.emptyQuestionBank') }}
|
||||
</div>
|
||||
|
||||
<div v-else class="space-y-4">
|
||||
<div
|
||||
v-for="(question, questionIndex) in form.training_question_bank"
|
||||
:key="questionIndex"
|
||||
class="rounded-2xl border border-default bg-white p-4"
|
||||
>
|
||||
<div class="mb-4 flex flex-wrap items-center justify-between gap-3">
|
||||
<div class="text-sm font-semibold text-primary">
|
||||
{{ t('admin.agent.training.questionCardTitle', { index: questionIndex + 1 }) }}
|
||||
</div>
|
||||
<div class="mt-5 space-y-3">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<div>
|
||||
<div class="text-sm font-semibold text-primary">{{ t('admin.agent.training.questionBank') }}</div>
|
||||
<p class="mt-1 text-xs leading-5 text-muted">{{ t('admin.agent.training.questionHint') }}</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1 rounded-lg border border-red-200 bg-red-50 px-3 py-1.5 text-xs font-medium text-red-600 transition-colors hover:bg-red-100"
|
||||
@click="emit('removeTrainingQuestion', questionIndex)"
|
||||
class="inline-flex items-center gap-1 rounded-lg border border-default bg-white px-3 py-1.5 text-xs font-medium text-secondary transition-colors hover:bg-surface-soft disabled:cursor-not-allowed disabled:opacity-60"
|
||||
:disabled="!isEditing || trainingExamPdfGuides.length === 0 || isImportingTrainingPdf"
|
||||
@click="emit('importTrainingPdf', trainingExamPdfGuides[0]?.id || null)"
|
||||
>
|
||||
<Trash2 class="h-4 w-4" />
|
||||
{{ t('admin.agent.training.removeQuestion') }}
|
||||
<FileDown class="h-4 w-4" />
|
||||
{{ isImportingTrainingPdf ? t('admin.agent.training.importingPdf') : t('admin.agent.training.importFromPdf') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1 rounded-lg border border-default bg-white px-3 py-1.5 text-xs font-medium text-secondary transition-colors hover:bg-surface-soft"
|
||||
@click="emit('addTrainingQuestion')"
|
||||
>
|
||||
<Plus class="h-4 w-4" />
|
||||
{{ t('admin.agent.training.addQuestion') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-3">
|
||||
<div class="space-y-2">
|
||||
<label class="text-xs font-semibold text-secondary">{{ t('admin.agent.training.questionId') }}</label>
|
||||
<input
|
||||
v-model="question.id"
|
||||
type="text"
|
||||
class="w-full input-field text-sm"
|
||||
:placeholder="t('admin.agent.training.questionIdPlaceholder')"
|
||||
/>
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<label class="text-xs font-semibold text-secondary">{{ t('admin.agent.training.questionType') }}</label>
|
||||
<select
|
||||
v-model="question.type"
|
||||
class="w-full input-field text-sm"
|
||||
@change="handleTrainingQuestionTypeChange(form, questionIndex)"
|
||||
<p class="text-xs leading-5 text-muted">
|
||||
{{
|
||||
!isEditing
|
||||
? t('admin.agent.training.importPdfCreateFirst')
|
||||
: trainingExamPdfGuides.length > 0
|
||||
? t('admin.agent.training.importPdfHint', { fileName: trainingExamPdfGuides[0]?.file_name || '--' })
|
||||
: t('admin.agent.training.importPdfMissing')
|
||||
}}
|
||||
</p>
|
||||
|
||||
<div v-if="form.training_question_bank.length === 0" class="rounded-xl border border-dashed border-default bg-white px-4 py-5 text-sm text-muted">
|
||||
{{ t('admin.agent.training.emptyQuestionBank') }}
|
||||
</div>
|
||||
|
||||
<div v-else class="space-y-4">
|
||||
<div
|
||||
v-for="(question, questionIndex) in form.training_question_bank"
|
||||
:key="questionIndex"
|
||||
class="rounded-2xl border border-default bg-white p-4"
|
||||
>
|
||||
<div class="mb-4 flex flex-wrap items-center justify-between gap-3">
|
||||
<div class="text-sm font-semibold text-primary">
|
||||
{{ t('admin.agent.training.questionCardTitle', { index: questionIndex + 1 }) }}
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1 rounded-lg border border-red-200 bg-red-50 px-3 py-1.5 text-xs font-medium text-red-600 transition-colors hover:bg-red-100"
|
||||
@click="emit('removeTrainingQuestion', questionIndex)"
|
||||
>
|
||||
<option value="single">{{ t('admin.agent.training.single') }}</option>
|
||||
<option value="boolean">{{ t('admin.agent.training.boolean') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<label class="text-xs font-semibold text-secondary">{{ t('admin.agent.training.correctAnswer') }}</label>
|
||||
<select v-model="question.answer" class="w-full input-field text-sm">
|
||||
<template v-if="question.type === 'boolean'">
|
||||
<option value="true">{{ t('admin.agent.training.booleanTrue') }}</option>
|
||||
<option value="false">{{ t('admin.agent.training.booleanFalse') }}</option>
|
||||
</template>
|
||||
<template v-else>
|
||||
<option
|
||||
v-for="(_, optionIndex) in question.options.filter((item) => String(item || '').trim())"
|
||||
:key="`${questionIndex}-${optionIndex}`"
|
||||
:value="String.fromCharCode(97 + optionIndex)"
|
||||
>
|
||||
{{ t('admin.agent.training.optionLabel', { label: optionLabels[optionIndex] || optionIndex + 1 }) }}
|
||||
</option>
|
||||
</template>
|
||||
</select>
|
||||
<Trash2 class="h-4 w-4" />
|
||||
{{ t('admin.agent.training.removeQuestion') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="space-y-2 md:col-span-3">
|
||||
<label class="text-xs font-semibold text-secondary">{{ t('admin.agent.training.questionPrompt') }}</label>
|
||||
<textarea
|
||||
v-model="question.prompt"
|
||||
rows="3"
|
||||
class="w-full input-field text-sm"
|
||||
:placeholder="t('admin.agent.training.questionPromptPlaceholder')"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="space-y-2 md:col-span-3">
|
||||
<label class="text-xs font-semibold text-secondary">{{ t('admin.agent.training.questionExplanation') }}</label>
|
||||
<textarea
|
||||
v-model="question.explanation"
|
||||
rows="3"
|
||||
class="w-full input-field text-sm"
|
||||
:placeholder="t('admin.agent.training.questionExplanationPlaceholder')"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-if="question.type === 'single'" class="space-y-3 md:col-span-3">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<label class="text-xs font-semibold text-secondary">{{ t('admin.agent.training.questionOptions') }}</label>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1 rounded-lg border border-default bg-surface-soft px-3 py-1.5 text-xs font-medium text-secondary transition-colors hover:bg-slate-100"
|
||||
@click="emit('addTrainingOption', questionIndex)"
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-3">
|
||||
<div class="space-y-2">
|
||||
<label class="text-xs font-semibold text-secondary">{{ t('admin.agent.training.questionId') }}</label>
|
||||
<input
|
||||
v-model="question.id"
|
||||
type="text"
|
||||
class="w-full input-field text-sm"
|
||||
:placeholder="t('admin.agent.training.questionIdPlaceholder')"
|
||||
/>
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<label class="text-xs font-semibold text-secondary">{{ t('admin.agent.training.questionType') }}</label>
|
||||
<select
|
||||
v-model="question.type"
|
||||
class="w-full input-field text-sm"
|
||||
@change="handleTrainingQuestionTypeChange(form, questionIndex)"
|
||||
>
|
||||
<Plus class="h-4 w-4" />
|
||||
{{ t('admin.agent.training.addOption') }}
|
||||
</button>
|
||||
<option value="single">{{ t('admin.agent.training.single') }}</option>
|
||||
<option value="boolean">{{ t('admin.agent.training.boolean') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<label class="text-xs font-semibold text-secondary">{{ t('admin.agent.training.correctAnswer') }}</label>
|
||||
<select v-model="question.answer" class="w-full input-field text-sm">
|
||||
<template v-if="question.type === 'boolean'">
|
||||
<option value="true">{{ t('admin.agent.training.booleanTrue') }}</option>
|
||||
<option value="false">{{ t('admin.agent.training.booleanFalse') }}</option>
|
||||
</template>
|
||||
<template v-else>
|
||||
<option
|
||||
v-for="(_, optionIndex) in question.options.filter((item) => String(item || '').trim())"
|
||||
:key="`${questionIndex}-${optionIndex}`"
|
||||
:value="String.fromCharCode(97 + optionIndex)"
|
||||
>
|
||||
{{ t('admin.agent.training.optionLabel', { label: optionLabels[optionIndex] || optionIndex + 1 }) }}
|
||||
</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-3 md:grid-cols-2">
|
||||
<div
|
||||
v-for="(_, optionIndex) in question.options"
|
||||
:key="`${questionIndex}-option-${optionIndex}`"
|
||||
class="flex items-center gap-2 rounded-xl border border-default bg-surface-soft/40 p-3"
|
||||
>
|
||||
<span class="min-w-6 text-xs font-semibold text-muted">{{ optionLabels[optionIndex] || optionIndex + 1 }}.</span>
|
||||
<input
|
||||
v-model="question.options[optionIndex]"
|
||||
type="text"
|
||||
class="w-full input-field text-sm"
|
||||
:placeholder="t('admin.agent.training.optionPlaceholder')"
|
||||
/>
|
||||
<div class="space-y-2 md:col-span-3">
|
||||
<label class="text-xs font-semibold text-secondary">{{ t('admin.agent.training.questionPrompt') }}</label>
|
||||
<textarea
|
||||
v-model="question.prompt"
|
||||
rows="3"
|
||||
class="w-full input-field text-sm"
|
||||
:placeholder="t('admin.agent.training.questionPromptPlaceholder')"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="space-y-2 md:col-span-3">
|
||||
<label class="text-xs font-semibold text-secondary">{{ t('admin.agent.training.questionExplanation') }}</label>
|
||||
<textarea
|
||||
v-model="question.explanation"
|
||||
rows="3"
|
||||
class="w-full input-field text-sm"
|
||||
:placeholder="t('admin.agent.training.questionExplanationPlaceholder')"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-if="question.type === 'single'" class="space-y-3 md:col-span-3">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<label class="text-xs font-semibold text-secondary">{{ t('admin.agent.training.questionOptions') }}</label>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex h-10 w-10 items-center justify-center rounded-lg border border-red-200 bg-red-50 text-red-600 transition-colors hover:bg-red-100"
|
||||
@click="emit('removeTrainingOption', questionIndex, optionIndex)"
|
||||
class="inline-flex items-center gap-1 rounded-lg border border-default bg-surface-soft px-3 py-1.5 text-xs font-medium text-secondary transition-colors hover:bg-slate-100"
|
||||
@click="emit('addTrainingOption', questionIndex)"
|
||||
>
|
||||
<Trash2 class="h-4 w-4" />
|
||||
<Plus class="h-4 w-4" />
|
||||
{{ t('admin.agent.training.addOption') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-3 md:grid-cols-2">
|
||||
<div
|
||||
v-for="(_, optionIndex) in question.options"
|
||||
:key="`${questionIndex}-option-${optionIndex}`"
|
||||
class="flex items-center gap-2 rounded-xl border border-default bg-surface-soft/40 p-3"
|
||||
>
|
||||
<span class="min-w-6 text-xs font-semibold text-muted">{{ optionLabels[optionIndex] || optionIndex + 1 }}.</span>
|
||||
<input
|
||||
v-model="question.options[optionIndex]"
|
||||
type="text"
|
||||
class="w-full input-field text-sm"
|
||||
:placeholder="t('admin.agent.training.optionPlaceholder')"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex h-10 w-10 items-center justify-center rounded-lg border border-red-200 bg-red-50 text-red-600 transition-colors hover:bg-red-100"
|
||||
@click="emit('removeTrainingOption', questionIndex, optionIndex)"
|
||||
>
|
||||
<Trash2 class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<AgentToolRunProgressConfig
|
||||
|
||||
@@ -119,9 +119,11 @@ const openBlankMaintenanceRecordCreate = (): void => {
|
||||
maintenancePanel.value = 'record';
|
||||
};
|
||||
|
||||
// 切换 Agent 时,重置工作区展开状态,确保每次进入都是收起状态(聊天优先)
|
||||
// 切换非培训 Agent 时,重置工作区展开状态;培训 Agent 的默认展开策略交给 TrainingWorkspacePanel 按角色决定。
|
||||
watch(() => page.currentAgentId, () => {
|
||||
isTrainingWorkspaceExpanded.value = false;
|
||||
if (!isTrainingAgentPage.value) {
|
||||
isTrainingWorkspaceExpanded.value = false;
|
||||
}
|
||||
maintenancePanel.value = null;
|
||||
isMaintenancePanelFullscreen.value = false;
|
||||
});
|
||||
@@ -198,12 +200,9 @@ watch(() => page.currentAgentId, () => {
|
||||
:current-agent="page.currentAgent"
|
||||
:current-user="page.currentUser"
|
||||
:agent-guides="page.agentGuides"
|
||||
:has-messages="page.messages.length > 0"
|
||||
:new-session-tick="page.viewId"
|
||||
:training="page.training"
|
||||
@open-guide="page.openGuideModal"
|
||||
@send-chat-prompt="page.handleSend($event)"
|
||||
@push-local-assistant-message="page.pushLocalAssistantMessage($event)"
|
||||
@update:expanded="isTrainingWorkspaceExpanded = $event"
|
||||
/>
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* features/chat/components/TrainingWorkspacePanel.vue
|
||||
* 用途:在培训 Agent 的聊天页顶部提供“学员考试流 + HR 管理流”一体化工作区。
|
||||
* 用途:在培训 Agent 的聊天页顶部提供“员工培训 + 培训管理”一体化工作区。
|
||||
* 依赖:useTrainingWorkspace、lucide 图标、聊天页 currentAgent/currentUser。
|
||||
* 逻辑:只在培训 Agent 下渲染;学员端负责前端交互闭环,HR 端负责本地筛选统计与 Excel 导出,并可把上下文同步回聊天区。
|
||||
* 逻辑:只在培训 Agent 下渲染;员工角色默认直达展开工作区,管理角色保留问答视图,培训答题不再走聊天链路。
|
||||
*/
|
||||
import { computed, reactive, ref, watch, type ShallowUnwrapRef } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@@ -18,7 +18,6 @@ import {
|
||||
RefreshCcw,
|
||||
ShieldCheck,
|
||||
Target,
|
||||
Users,
|
||||
XCircle,
|
||||
} from 'lucide-vue-next';
|
||||
import { useTrainingWorkspace } from '@/features/chat/composables/useTrainingWorkspace';
|
||||
@@ -28,13 +27,11 @@ const props = defineProps<{
|
||||
currentAgent: Record<string, unknown> | null;
|
||||
currentUser: Record<string, unknown> | null;
|
||||
agentGuides: TrainingGuideLike[];
|
||||
hasMessages: boolean;
|
||||
newSessionTick: number;
|
||||
training: ShallowUnwrapRef<ReturnType<typeof useTrainingWorkspace>>;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
'push-local-assistant-message': [content: string];
|
||||
'open-guide': [guideId?: number];
|
||||
'update:expanded': [expanded: boolean];
|
||||
}>();
|
||||
@@ -64,7 +61,8 @@ const stageItems = computed(() => ([
|
||||
{ key: 'result', label: 'chat.training.steps.result', icon: ShieldCheck },
|
||||
]));
|
||||
|
||||
const userExpandedOverride = ref(false);
|
||||
const userExpandedOverride = ref<boolean | null>(null);
|
||||
const shouldDefaultExpanded = computed(() => workspace.isTrainingAgent && !workspace.isAdminViewer);
|
||||
|
||||
const handleVideoTimeUpdate = (e: Event) => {
|
||||
const video = e.target as HTMLVideoElement;
|
||||
@@ -91,7 +89,7 @@ const setWorkspaceExpanded = (expanded: boolean, manual = false) => {
|
||||
if (manual) {
|
||||
userExpandedOverride.value = expanded;
|
||||
} else if (!expanded) {
|
||||
userExpandedOverride.value = false;
|
||||
userExpandedOverride.value = null;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -103,53 +101,30 @@ const currentAnswerLabel = computed(() => {
|
||||
|
||||
const trainingExamPdfGuide = computed(() => resolveTrainingExamPdfGuide(props.agentGuides));
|
||||
|
||||
// 默认进入 Chat 聊天页面(即收起工作区状态)
|
||||
const workspaceExpanded = ref(false);
|
||||
|
||||
const autoSyncInitialPrompt = () => {
|
||||
if (
|
||||
workspace.isTrainingAgent
|
||||
&& workspace.isHydrated
|
||||
&& !props.hasMessages
|
||||
&& workspace.shouldShowNewSessionReminder
|
||||
) {
|
||||
emit('push-local-assistant-message', workspace.newSessionReminderMessage);
|
||||
}
|
||||
const applyDefaultExpandedState = () => {
|
||||
const nextExpanded = userExpandedOverride.value ?? shouldDefaultExpanded.value;
|
||||
workspaceExpanded.value = nextExpanded;
|
||||
emit('update:expanded', nextExpanded);
|
||||
};
|
||||
|
||||
// 监听 Agent 切换,重置所有本地交互状态,确保每次进入都是初始、收起且触发引导的状态
|
||||
// 监听 Agent/角色切换,重置本地展开态:员工默认展开工作区,培训管理角色默认保留问答视图。
|
||||
watch(
|
||||
() => props.currentAgent?.id,
|
||||
() => [props.currentAgent?.id, workspace.isAdminViewer],
|
||||
() => {
|
||||
userExpandedOverride.value = false;
|
||||
workspaceExpanded.value = false;
|
||||
emit('update:expanded', false);
|
||||
userExpandedOverride.value = null;
|
||||
applyDefaultExpandedState();
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
watch(() => props.hasMessages, () => {
|
||||
// 如果用户没有手动展开,且消息状态变化,我们保持在聊天模式(收起工作区)
|
||||
if (!userExpandedOverride.value) {
|
||||
workspaceExpanded.value = false;
|
||||
emit('update:expanded', false);
|
||||
}
|
||||
});
|
||||
|
||||
watch(
|
||||
() => workspace.isHydrated,
|
||||
(ready) => {
|
||||
if (ready && workspace.isTrainingAgent && !props.hasMessages) {
|
||||
autoSyncInitialPrompt();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
watch(
|
||||
() => props.newSessionTick,
|
||||
(tick, prevTick) => {
|
||||
if (!tick || tick === prevTick) return;
|
||||
autoSyncInitialPrompt();
|
||||
userExpandedOverride.value = null;
|
||||
applyDefaultExpandedState();
|
||||
},
|
||||
);
|
||||
|
||||
@@ -163,7 +138,7 @@ const compactSummary = computed(() => {
|
||||
if (workspace.stage === 'summary') return t('chat.training.summary.title');
|
||||
if (workspace.stage === 'exam') {
|
||||
return t('chat.training.exam.questionCounter', {
|
||||
current: workspace.answeredCount + 1,
|
||||
current: workspace.currentQuestionNumber,
|
||||
total: workspace.totalQuestionCount,
|
||||
});
|
||||
}
|
||||
@@ -177,6 +152,29 @@ const ruleItems = computed(() => ([
|
||||
t('chat.training.rules.rule3', { passScore: workspace.passScore }),
|
||||
t('chat.training.rules.rule4'),
|
||||
]));
|
||||
const learnerIdentityItems = computed(() => ([
|
||||
{ key: 'name', label: t('chat.training.learnerCard.name'), value: workspace.currentUserName },
|
||||
{ key: 'employee-id', label: t('chat.training.learnerCard.employeeId'), value: workspace.currentUserEmployeeId },
|
||||
{ key: 'department', label: t('chat.training.learnerCard.department'), value: workspace.currentUserDepartment },
|
||||
]));
|
||||
const examQuestionItems = computed(() => Array.from({ length: workspace.totalQuestionCount }, (_, index) => ({
|
||||
index,
|
||||
label: String(index + 1).padStart(2, '0'),
|
||||
isActive: workspace.currentQuestionIndex === index,
|
||||
})));
|
||||
const canNavigateExamQuestions = computed(() => workspace.stage === 'exam');
|
||||
const jumpToExamQuestion = (index: number) => {
|
||||
if (!canNavigateExamQuestions.value) return;
|
||||
workspace.syncExamQuestionIndex(index);
|
||||
};
|
||||
const canSwitchToStage = (stageKey: string) => {
|
||||
if (stageKey !== 'result') return true;
|
||||
return workspace.canEnterResultStage;
|
||||
};
|
||||
const handleStageCardClick = (stageKey: string) => {
|
||||
if (!canSwitchToStage(stageKey)) return;
|
||||
workspace.stage = stageKey as typeof workspace.stage;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -262,10 +260,14 @@ const ruleItems = computed(() => ([
|
||||
· {{ $t('chat.training.hr.filters.departmentLabel') }}:
|
||||
{{ workspace.hrDepartmentFilter === 'all' ? $t('chat.training.hr.filters.allDepartments') : workspace.hrDepartmentFilter }}
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ $t('chat.training.progressPercent') }}: {{ workspace.learnerProgressPercent }}%
|
||||
· {{ $t('chat.training.learnerCard.name') }}: {{ workspace.currentUserName }}
|
||||
</template>
|
||||
</div>
|
||||
<div
|
||||
v-if="workspace.activeView === 'learner'"
|
||||
class="mt-1 flex flex-wrap gap-x-4 gap-y-1 text-xs leading-5 text-secondary"
|
||||
>
|
||||
<span v-for="item in learnerIdentityItems" :key="item.key">
|
||||
{{ item.label }}: {{ item.value }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-2 text-xs">
|
||||
@@ -339,16 +341,18 @@ const ruleItems = computed(() => ([
|
||||
<div class="truncate text-sm font-semibold text-primary">
|
||||
{{ compactSummary }}
|
||||
</div>
|
||||
<div class="mt-1 text-xs leading-5 text-secondary">
|
||||
<template v-if="workspace.activeView === 'admin'">
|
||||
{{ $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 }}
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ $t('chat.training.progressPercent') }}: {{ workspace.learnerProgressPercent }}%
|
||||
· {{ $t('chat.training.learnerCard.name') }}: {{ workspace.currentUserName }}
|
||||
</template>
|
||||
<div v-if="workspace.activeView === 'admin'" class="mt-1 text-xs leading-5 text-secondary">
|
||||
{{ $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 }}
|
||||
</div>
|
||||
<div
|
||||
v-if="workspace.activeView === 'learner'"
|
||||
class="mt-1 flex flex-wrap gap-x-4 gap-y-1 text-xs leading-5 text-secondary"
|
||||
>
|
||||
<span v-for="item in learnerIdentityItems" :key="item.key">
|
||||
{{ item.label }}: {{ item.value }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-2 text-xs">
|
||||
@@ -385,8 +389,11 @@ const ruleItems = computed(() => ([
|
||||
v-for="(item, index) in stageItems"
|
||||
:key="item.key"
|
||||
class="rounded-xl border px-3 py-2.5 transition cursor-pointer hover:border-brand-300"
|
||||
:class="stageStep >= index + 1 ? 'border-brand-200 bg-brand-50/70' : 'border-default bg-surface-soft/70'"
|
||||
@click="workspace.stage = item.key as any"
|
||||
:class="[
|
||||
stageStep >= index + 1 ? 'border-brand-200 bg-brand-50/70' : 'border-default bg-surface-soft/70',
|
||||
canSwitchToStage(String(item.key)) ? 'cursor-pointer hover:border-brand-300' : 'cursor-not-allowed opacity-60',
|
||||
]"
|
||||
@click="handleStageCardClick(String(item.key))"
|
||||
>
|
||||
<div class="flex items-center gap-2">
|
||||
<div
|
||||
@@ -490,7 +497,7 @@ const ruleItems = computed(() => ([
|
||||
{{ $t('chat.training.exam.title') }}
|
||||
</div>
|
||||
<h3 class="mt-1 text-lg font-semibold text-primary">
|
||||
{{ $t('chat.training.exam.questionCounter', { current: workspace.answeredCount + 1, total: workspace.totalQuestionCount }) }}
|
||||
{{ $t('chat.training.exam.questionCounter', { current: workspace.currentQuestionNumber, total: workspace.totalQuestionCount }) }}
|
||||
</h3>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-2 text-sm text-secondary">
|
||||
@@ -526,7 +533,6 @@ const ruleItems = computed(() => ([
|
||||
? '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)"
|
||||
>
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
@@ -562,12 +568,12 @@ const ruleItems = computed(() => ([
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-2 rounded-xl bg-brand-600 px-4 py-2.5 text-sm font-medium text-white transition hover:bg-brand-700"
|
||||
@click="workspace.moveToNextQuestion"
|
||||
@click="workspace.examReadyToSubmit ? workspace.submitExam() : workspace.moveToNextQuestion()"
|
||||
>
|
||||
<ClipboardCheck class="h-4 w-4" />
|
||||
{{
|
||||
workspace.answeredCount >= workspace.totalQuestionCount
|
||||
? $t('chat.training.exam.finishExam')
|
||||
workspace.examReadyToSubmit
|
||||
? $t('chat.training.exam.submitPaper')
|
||||
: $t('chat.training.exam.nextQuestion')
|
||||
}}
|
||||
</button>
|
||||
@@ -636,22 +642,30 @@ const ruleItems = computed(() => ([
|
||||
<div class="min-w-0 md:sticky md:top-4 md:self-start">
|
||||
<div class="rounded-2xl border border-default bg-white p-3 shadow-sm">
|
||||
<div class="flex items-center gap-2">
|
||||
<Users class="h-4 w-4 text-brand-600" />
|
||||
<div class="text-sm font-semibold text-primary">{{ $t('chat.training.learnerCard.title') }}</div>
|
||||
<ClipboardCheck class="h-4 w-4 text-brand-600" />
|
||||
<div class="text-sm font-semibold text-primary">{{ $t('chat.training.examQuestionCard.title') }}</div>
|
||||
</div>
|
||||
<div class="mt-2.5 grid gap-1.5 text-sm text-secondary">
|
||||
<div class="flex items-center justify-between rounded-xl bg-surface-soft px-3 py-2">
|
||||
<span>{{ $t('chat.training.learnerCard.name') }}</span>
|
||||
<span class="font-medium text-primary">{{ workspace.currentUserName }}</span>
|
||||
</div>
|
||||
<div class="flex items-center justify-between rounded-xl bg-surface-soft px-3 py-2">
|
||||
<span>{{ $t('chat.training.learnerCard.employeeId') }}</span>
|
||||
<span class="font-medium text-primary">{{ workspace.currentUserEmployeeId }}</span>
|
||||
</div>
|
||||
<div class="flex items-center justify-between rounded-xl bg-surface-soft px-3 py-2">
|
||||
<span>{{ $t('chat.training.learnerCard.department') }}</span>
|
||||
<span class="font-medium text-primary">{{ workspace.currentUserDepartment }}</span>
|
||||
</div>
|
||||
<div class="mt-2 text-xs leading-5 text-secondary">
|
||||
{{ $t('chat.training.examQuestionCard.hint') }}
|
||||
</div>
|
||||
<div class="mt-3 grid grid-cols-4 gap-2">
|
||||
<button
|
||||
v-for="item in examQuestionItems"
|
||||
:key="item.index"
|
||||
type="button"
|
||||
class="flex h-10 items-center justify-center rounded-xl border text-sm font-semibold transition"
|
||||
:class="[
|
||||
item.isActive
|
||||
? 'border-brand-500 bg-brand-600 text-white shadow-sm'
|
||||
: canNavigateExamQuestions
|
||||
? 'border-brand-200 bg-brand-50/60 text-brand-700 hover:bg-brand-100'
|
||||
: 'cursor-not-allowed border-default bg-surface-soft text-muted',
|
||||
]"
|
||||
:disabled="!canNavigateExamQuestions"
|
||||
@click="jumpToExamQuestion(item.index)"
|
||||
>
|
||||
{{ item.label }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="my-3 h-px bg-slate-100" />
|
||||
|
||||
@@ -93,49 +93,11 @@ const isLeaveMessage = computed(() =>
|
||||
|| message.type === 'leave-result',
|
||||
);
|
||||
|
||||
const isTrainingExamMessage = computed(() => {
|
||||
if (message.role !== 'assistant') return false;
|
||||
// 必须是最后一条助手消息,且包含题目特征文字(确保只在当前正在进行的题目上显示交互组件)
|
||||
if (!isLastMessage.value) return false;
|
||||
const content = message.content || '';
|
||||
return content.includes('正在进行新人培训考试')
|
||||
|| (content.includes('第') && content.includes('题') && (content.includes('共') || content.includes('/')));
|
||||
});
|
||||
|
||||
const isTrainingVideoMessage = computed(() => {
|
||||
if (message.role !== 'assistant') return false;
|
||||
// 只要包含特定引导文案,就显示视频占位符,不限于最后一条消息
|
||||
const content = message.content || '';
|
||||
return content.includes('专属入职培训助手')
|
||||
|| content.includes('onboarding training assistant')
|
||||
|| content.includes('ผู้ช่วยอบรมพนักงานใหม่')
|
||||
|| content.includes('入职培训视频')
|
||||
|| content.includes('training video');
|
||||
});
|
||||
|
||||
const isTrainingSummaryMessage = computed(() => {
|
||||
if (message.role !== 'assistant') return false;
|
||||
const content = message.content || '';
|
||||
return content.includes('完成视频学习')
|
||||
|| content.includes('复盘重点知识')
|
||||
|| content.includes('复盘知识点')
|
||||
|| content.includes('总结重点知识')
|
||||
|| content.includes('核心知识点')
|
||||
|| content.includes('key knowledge points')
|
||||
|| content.includes('ประเด็นสำคัญ');
|
||||
});
|
||||
|
||||
const isTrainingResultMessage = computed(() => {
|
||||
if (message.role !== 'assistant') return false;
|
||||
// 只要是结果文案,就显示结算卡片,不限于最后一条消息
|
||||
const content = message.content || '';
|
||||
return content.includes('考试结束')
|
||||
|| content.includes('顺利通过新人考核')
|
||||
|| content.includes('Exam finished')
|
||||
|| content.includes('passed the onboarding assessment')
|
||||
|| content.includes('สอบเสร็จแล้ว')
|
||||
|| content.includes('ผ่านการประเมินพนักงานใหม่');
|
||||
});
|
||||
// 员工培训的答题、结果与视频步骤统一收口到工作区,聊天区仅保留普通问答,不再承接培训操作卡片。
|
||||
const isTrainingExamMessage = computed(() => false);
|
||||
const isTrainingVideoMessage = computed(() => false);
|
||||
const isTrainingSummaryMessage = computed(() => false);
|
||||
const isTrainingResultMessage = computed(() => false);
|
||||
|
||||
const retrieverResources = computed(() => handlers.getDisplayRetrieverResources(message));
|
||||
const sourceLinks = computed(() => handlers.getSourceLinks(retrieverResources.value));
|
||||
|
||||
@@ -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)"
|
||||
>
|
||||
<span class="font-medium">{{ option.label }}</span>
|
||||
|
||||
@@ -27,10 +27,10 @@ const TRAINING_AGENT_DESCRIPTION =
|
||||
'我是你的新人培训助手,会在同一个聊天页面内带你完成视频学习、知识点复盘、逐题考试和结果复盘。';
|
||||
|
||||
const TRAINING_AGENT_QUESTIONS: AgentSuggestedQuestionItem[] = [
|
||||
{ question: '开始新人培训', group: '培训流程' },
|
||||
{ question: '我已看完视频,请总结知识点', group: '培训流程' },
|
||||
{ question: '开始考试', group: '培训流程' },
|
||||
{ question: '导出本月培训成绩', group: 'HR 管理' },
|
||||
{ question: '这次员工培训主要学习什么内容?', group: '培训问答' },
|
||||
{ question: '员工培训的通过规则是什么?', group: '培训问答' },
|
||||
{ question: '这次培训的试题范围有哪些?', group: '培训问答' },
|
||||
{ question: '培训记录会如何统计?', group: '培训问答' },
|
||||
];
|
||||
|
||||
const normalizeAgentSuggestedQuestions = (value: unknown): AgentSuggestedQuestionItem[] => {
|
||||
|
||||
@@ -371,26 +371,10 @@ export function useChatPage() {
|
||||
t,
|
||||
});
|
||||
|
||||
const pushLocalUserMessage = async (content: string) => {
|
||||
const msgText = String(content || '').trim();
|
||||
if (!msgText) return;
|
||||
const userMsg: ChatMessage = {
|
||||
role: 'user',
|
||||
type: 'text',
|
||||
content: msgText,
|
||||
local_id: newLocalMessageId('local-user'),
|
||||
local_only: true,
|
||||
};
|
||||
messages.value.push(userMsg);
|
||||
await saveLocalMessageToBackend(userMsg);
|
||||
};
|
||||
|
||||
const training = useTrainingWorkspace({
|
||||
currentAgent: computed(() => agent.currentAgent.value),
|
||||
currentUser: computed(() => currentUser.value),
|
||||
currentGuides: computed(() => chatGuides.guides.value),
|
||||
pushLocalAssistantMessage,
|
||||
pushLocalUserMessage,
|
||||
});
|
||||
|
||||
const markdown = createChatPageMarkdownApi({
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* features/chat/composables/useTrainingWorkspace.ts
|
||||
* 用途:封装员工培训 Agent 的工作区状态,包括学员考试流、进度持久化与 HR 真实统计导出。
|
||||
* 依赖:Vue reactivity、vue-i18n、training.api,以及 training.types。
|
||||
* 逻辑:仅在培训 Agent 下启用;学员端按“视频 -> 知识点 -> 一题一答 -> 结算”推进,并把进度同步到后端。
|
||||
* 逻辑:仅在培训 Agent 下启用;学员端按“视频 -> 知识点 -> 一题一答 -> 结算”推进,并把进度同步到后端,聊天区只保留问答能力。
|
||||
*/
|
||||
import { computed, ref, watch, type ComputedRef } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@@ -56,8 +56,6 @@ export interface UseTrainingWorkspaceOptions {
|
||||
currentAgent: ComputedRef<TrainingAgentLike>;
|
||||
currentUser: ComputedRef<TrainingUserLike>;
|
||||
currentGuides: ComputedRef<TrainingGuideLike[]>;
|
||||
pushLocalAssistantMessage?: (content: string) => Promise<void>;
|
||||
pushLocalUserMessage?: (content: string) => Promise<void>;
|
||||
}
|
||||
|
||||
const DEFAULT_TRAINING_VIDEO_URL = 'https://www.w3schools.com/html/mov_bbb.mp4';
|
||||
@@ -75,13 +73,14 @@ const calculateTrainingScore = (correctAnswerCount: number, totalQuestionCount:
|
||||
};
|
||||
|
||||
export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
|
||||
const { currentAgent, currentUser, currentGuides, pushLocalAssistantMessage, pushLocalUserMessage } = options;
|
||||
const { currentAgent, currentUser, currentGuides } = options;
|
||||
const { t, tm } = useI18n();
|
||||
const msg = useMessage();
|
||||
|
||||
const isTrainingAgent = computed(() => matchesTrainingAgent(currentAgent.value));
|
||||
const hasAuthenticatedUser = computed(() => Boolean(String(currentUser.value?.username || '').trim()));
|
||||
const isAdminViewer = computed(() => Boolean(currentUser.value?.feature_permissions?.training_hr_manage));
|
||||
const defaultActiveView = computed<TrainingWorkspaceView>(() => (isAdminViewer.value ? 'admin' : 'learner'));
|
||||
const activeView = ref<TrainingWorkspaceView>('learner');
|
||||
|
||||
const stage = ref<TrainingStage>('video');
|
||||
@@ -127,6 +126,15 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
|
||||
}
|
||||
});
|
||||
|
||||
watch(
|
||||
[isTrainingAgent, isAdminViewer],
|
||||
([enabled]) => {
|
||||
if (!enabled) return;
|
||||
activeView.value = defaultActiveView.value;
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
const defaultSummaryPoints = computed(() => {
|
||||
const raw = tm('chat.training.summaryPoints');
|
||||
return Array.isArray(raw) ? raw.map((item) => String(item)) : [];
|
||||
@@ -191,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;
|
||||
@@ -287,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
|
||||
@@ -297,6 +338,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';
|
||||
@@ -306,7 +362,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 : [];
|
||||
@@ -484,8 +540,6 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
|
||||
|
||||
const markVideoCompleted = () => {
|
||||
stage.value = 'summary';
|
||||
// 立即推入本地助手消息(复盘卡片)
|
||||
void pushLocalAssistantMessage?.(learnerAssistantMessage.value);
|
||||
void persistProgress();
|
||||
};
|
||||
|
||||
@@ -497,54 +551,45 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
|
||||
stage.value = 'exam';
|
||||
attemptCount.value += 1;
|
||||
resetExamState();
|
||||
void pushLocalUserMessage?.(t('chat.training.chatPrompts.startExamCommand'));
|
||||
// 立即推入第一题的消息引导
|
||||
void pushLocalAssistantMessage?.(learnerAssistantMessage.value);
|
||||
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);
|
||||
|
||||
// 推入用户选择的答案到聊天流
|
||||
const label = getQuestionOptionLabel(answeredQuestion, optionId);
|
||||
void pushLocalUserMessage?.(label);
|
||||
|
||||
// [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 pushLocalAssistantMessage?.(learnerAssistantMessage.value);
|
||||
// [STEP 1] 已答题被回看并改答时,停留在当前题,方便继续检查或跳到其他题。
|
||||
if (hadExistingAnswer) {
|
||||
void persistProgress();
|
||||
return;
|
||||
}
|
||||
|
||||
// [STEP 2] 非最后一题则在聊天流里自动反馈上一题,并紧接着展示下一题。
|
||||
currentQuestionIndex.value += 1;
|
||||
selectedOptionId.value = '';
|
||||
answerLocked.value = false;
|
||||
currentFeedbackCorrect.value = false;
|
||||
void pushLocalAssistantMessage?.(learnerAssistantMessage.value);
|
||||
// [STEP 2] 最后一题首次答完后先停留在考试阶段,必须点击“提交答卷”才能进入结算结果。
|
||||
if (currentQuestionIndex.value >= totalQuestionCount.value - 1) {
|
||||
void persistProgress();
|
||||
return;
|
||||
}
|
||||
|
||||
// [STEP 3] 首次作答且不是最后一题时,自动推进到下一题。
|
||||
syncExamQuestionIndex(currentQuestionIndex.value + 1);
|
||||
void persistProgress();
|
||||
};
|
||||
|
||||
@@ -555,29 +600,33 @@ 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 pushLocalAssistantMessage?.(learnerAssistantMessage.value);
|
||||
void persistProgress();
|
||||
return;
|
||||
}
|
||||
currentQuestionIndex.value += 1;
|
||||
selectedOptionId.value = '';
|
||||
answerLocked.value = false;
|
||||
currentFeedbackCorrect.value = false;
|
||||
syncExamQuestionIndex(currentQuestionIndex.value + 1);
|
||||
latestExamFeedback.value = null;
|
||||
// 推入下一题消息
|
||||
void pushLocalAssistantMessage?.(learnerAssistantMessage.value);
|
||||
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();
|
||||
void pushLocalUserMessage?.(t('chat.training.chatPrompts.restartExamCommand'));
|
||||
// 重新推回视频导学,强制补考再次完整经过“视频 -> 复盘 -> 开考”链路。
|
||||
void pushLocalAssistantMessage?.(learnerAssistantMessage.value);
|
||||
// 不立即覆盖后端已结算成绩,避免刷新页面或重新进入历史对话时丢失上一轮考试结果与 HR 统计事实。
|
||||
};
|
||||
|
||||
@@ -655,6 +704,7 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
|
||||
activeView,
|
||||
stage,
|
||||
currentQuestionIndex,
|
||||
currentQuestionNumber,
|
||||
currentQuestion,
|
||||
totalQuestionCount,
|
||||
passScore,
|
||||
@@ -664,6 +714,8 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
|
||||
selectedOptionId,
|
||||
answerLocked,
|
||||
currentFeedbackCorrect,
|
||||
examReadyToSubmit,
|
||||
canEnterResultStage,
|
||||
latestExamFeedback,
|
||||
latestSettledResult,
|
||||
answerRecords,
|
||||
@@ -691,7 +743,9 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
|
||||
markVideoCompleted,
|
||||
startExam,
|
||||
selectAnswer,
|
||||
syncExamQuestionIndex,
|
||||
moveToNextQuestion,
|
||||
submitExam,
|
||||
restartExam,
|
||||
exportRecords,
|
||||
showVideoModal,
|
||||
|
||||
@@ -485,8 +485,8 @@
|
||||
"title": "",
|
||||
"subtitle": "Complete video learning, knowledge review, one-question-at-a-time testing, and HR reporting in the same chat page.",
|
||||
"tabs": {
|
||||
"learner": "Learner",
|
||||
"admin": "HR Admin"
|
||||
"learner": "Employee Training",
|
||||
"admin": "Training Management"
|
||||
},
|
||||
"actions": {
|
||||
"syncLearnerToChat": "Sync learner context to chat",
|
||||
@@ -531,6 +531,7 @@
|
||||
"selectedAnswer": "Your answer: {answer}",
|
||||
"correctAnswer": "Correct answer: {answer}",
|
||||
"nextQuestion": "Next Question",
|
||||
"submitPaper": "Submit Paper",
|
||||
"finishExam": "Finish Exam"
|
||||
},
|
||||
"result": {
|
||||
@@ -554,6 +555,10 @@
|
||||
"employeeId": "Employee ID",
|
||||
"department": "Department"
|
||||
},
|
||||
"examQuestionCard": {
|
||||
"title": "Exam Questions",
|
||||
"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",
|
||||
"rule1": "There are {total} questions, and the system calculates the result on a 100-point scale.",
|
||||
@@ -608,12 +613,12 @@
|
||||
"examInProgress": "I am taking the onboarding training exam and am currently on question {index}/{total}. Please stay in proctor mode and continue.",
|
||||
"assistantVideoIntro": "👋 Welcome aboard! I am your onboarding training assistant. Today's training has three steps: watch the video ➡️ review the key knowledge points ➡️ take the quiz ({passScore} points to pass).\n\n▶️ Please start with the onboarding training video. After watching it, move on to the knowledge review.",
|
||||
"assistantSummaryIntro": "Great. Based on the video, I pulled together the key knowledge points you are most likely to be tested on:",
|
||||
"assistantSummaryReady": "Ready for the challenge? Click Start Exam directly or reply \"Start Exam\" in the chat.",
|
||||
"assistantSummaryReady": "Ready for the challenge? Click Start Exam directly in the workspace.",
|
||||
"assistantQuestionSingleType": "Single choice",
|
||||
"assistantQuestionBooleanType": "True or false",
|
||||
"assistantQuestionReplyHint": "Reply with the option or the answer text directly.",
|
||||
"assistantResultPass": "🎉 **Congratulations!** Your final score is **{score}**. You passed the onboarding assessment, and your score has been synced to HR automatically.",
|
||||
"assistantResultFail": "📊 **Exam finished!** Your final score is **{score}**. The passing line is {passScore}. Reply \"Retake Exam\" to try again.",
|
||||
"assistantResultFail": "📊 **Exam finished!** Your final score is **{score}**. The passing line is {passScore}. Click Retake Exam in the workspace to try again.",
|
||||
"startExamCommand": "Start Exam",
|
||||
"restartExamCommand": "Retake Exam"
|
||||
},
|
||||
|
||||
@@ -485,8 +485,8 @@
|
||||
"title": "",
|
||||
"subtitle": "ทำวิดีโอเรียนรู้ ทบทวนความรู้ สอบทีละข้อ และดูสถิติ HR ได้ในหน้าแชตเดียวกัน",
|
||||
"tabs": {
|
||||
"learner": "ผู้เรียน",
|
||||
"admin": "HR Admin"
|
||||
"learner": "อบรมพนักงาน",
|
||||
"admin": "จัดการอบรม"
|
||||
},
|
||||
"actions": {
|
||||
"syncLearnerToChat": "ส่งบริบทผู้เรียนเข้าแชต",
|
||||
@@ -531,6 +531,7 @@
|
||||
"selectedAnswer": "คำตอบของคุณ: {answer}",
|
||||
"correctAnswer": "คำตอบที่ถูกต้อง: {answer}",
|
||||
"nextQuestion": "ข้อถัดไป",
|
||||
"submitPaper": "ส่งข้อสอบ",
|
||||
"finishExam": "จบการสอบ"
|
||||
},
|
||||
"result": {
|
||||
@@ -554,6 +555,10 @@
|
||||
"employeeId": "รหัสพนักงาน",
|
||||
"department": "แผนก"
|
||||
},
|
||||
"examQuestionCard": {
|
||||
"title": "ข้อสอบ",
|
||||
"hint": "แสดงหมายเลขข้อทั้งหมด และจะกดได้เฉพาะในขั้นตอนสอบทีละข้อเท่านั้น พร้อมรองรับการย้อนกลับไปแก้คำตอบ"
|
||||
},
|
||||
"rules": {
|
||||
"title": "กติกาการสอบ",
|
||||
"rule1": "มีทั้งหมด {total} ข้อ และระบบจะคำนวณผลสอบบนสเกล 100 คะแนน",
|
||||
@@ -608,12 +613,12 @@
|
||||
"examInProgress": "ฉันกำลังสอบอบรมพนักงานใหม่ ตอนนี้อยู่ที่ข้อ {index}/{total} โปรดทำหน้าที่เป็นผู้คุมสอบและถามต่อ",
|
||||
"assistantVideoIntro": "👋 ยินดีต้อนรับสู่บริษัท! ฉันคือผู้ช่วยอบรมพนักงานใหม่ของคุณ วันนี้มี 3 ขั้นตอนคือ ดูวิดีโอ ➡️ ทบทวนความรู้ ➡️ ทำแบบทดสอบ (ผ่านที่ {passScore} คะแนน)\n\n▶️ โปรดเริ่มจากการดูวิดีโออบรมพนักงานใหม่ แล้วจึงเข้าสู่ช่วงทบทวนความรู้",
|
||||
"assistantSummaryIntro": "ยอดเยี่ยม จากวิดีโอเมื่อครู่นี้ ฉันสรุปประเด็นสำคัญที่มีโอกาสออกสอบไว้ให้แล้ว:",
|
||||
"assistantSummaryReady": "พร้อมรับความท้าทายหรือยัง? กดเริ่มสอบได้เลย หรือพิมพ์ \"เริ่มสอบ\" ในแชตก็ได้",
|
||||
"assistantSummaryReady": "พร้อมรับความท้าทายหรือยัง? โปรดกดเริ่มสอบจากพื้นที่ทำงานได้เลย",
|
||||
"assistantQuestionSingleType": "ปรนัย",
|
||||
"assistantQuestionBooleanType": "ถูกหรือผิด",
|
||||
"assistantQuestionReplyHint": "ตอบด้วยตัวเลือกหรือข้อความคำตอบได้โดยตรง",
|
||||
"assistantResultPass": "🎉 **ยินดีด้วย!** คุณได้คะแนนสุดท้าย **{score}** และผ่านการประเมินพนักงานใหม่แล้ว ระบบได้ซิงก์คะแนนไปยัง HR โดยอัตโนมัติ",
|
||||
"assistantResultFail": "📊 **สอบเสร็จแล้ว!** คะแนนสุดท้ายของคุณคือ **{score}** เกณฑ์ผ่านคือ {passScore} คะแนน พิมพ์ \"สอบใหม่\" เพื่อเริ่มอีกครั้ง",
|
||||
"assistantResultFail": "📊 **สอบเสร็จแล้ว!** คะแนนสุดท้ายของคุณคือ **{score}** เกณฑ์ผ่านคือ {passScore} คะแนน โปรดกดสอบใหม่จากพื้นที่ทำงานเพื่อเริ่มอีกครั้ง",
|
||||
"startExamCommand": "เริ่มสอบ",
|
||||
"restartExamCommand": "สอบใหม่"
|
||||
},
|
||||
|
||||
@@ -485,8 +485,8 @@
|
||||
"title": "",
|
||||
"subtitle": "在同一个 Chat 页面内完成视频学习、知识点复盘、逐题考试以及 HR 管理统计。",
|
||||
"tabs": {
|
||||
"learner": "学员端",
|
||||
"admin": "HR 管理"
|
||||
"learner": "员工培训",
|
||||
"admin": "培训管理"
|
||||
},
|
||||
"actions": {
|
||||
"syncLearnerToChat": "同步学员上下文到聊天",
|
||||
@@ -531,6 +531,7 @@
|
||||
"selectedAnswer": "你的答案:{answer}",
|
||||
"correctAnswer": "正确答案:{answer}",
|
||||
"nextQuestion": "下一题",
|
||||
"submitPaper": "提交答卷",
|
||||
"finishExam": "完成考试"
|
||||
},
|
||||
"result": {
|
||||
@@ -554,6 +555,10 @@
|
||||
"employeeId": "工号",
|
||||
"department": "部门"
|
||||
},
|
||||
"examQuestionCard": {
|
||||
"title": "考试题目",
|
||||
"hint": "展示全部题目序号;仅在“逐题考试”阶段可点击切换,并支持返回修改答案。"
|
||||
},
|
||||
"rules": {
|
||||
"title": "考试规则",
|
||||
"rule1": "共 {total} 题,系统按百分制自动计算成绩。",
|
||||
@@ -608,12 +613,12 @@
|
||||
"examInProgress": "我正在进行新人培训考试,目前做到第 {index}/{total} 题。题目是:{question}。请保持考官模式,评价我的表现并引导我继续。",
|
||||
"assistantVideoIntro": "👋 欢迎加入公司!我是你的专属入职培训助手。今天的培训分为三个步骤:看视频 ➡️ 知识点复盘 ➡️ 随堂测试({passScore} 分及格)。\n\n▶️ 请先点击观看【入职培训视频】。观看完毕后,点击进入【知识点复盘】。",
|
||||
"assistantSummaryIntro": "太棒了!结合刚才的视频,我为你提炼了以下核心知识点(必考哦):",
|
||||
"assistantSummaryReady": "准备好接受挑战了吗?直接点击【开始考试】或在 Chat 中回复【开始考试】。",
|
||||
"assistantSummaryReady": "准备好接受挑战了吗?请直接在工作区点击【开始考试】。",
|
||||
"assistantQuestionSingleType": "单选题",
|
||||
"assistantQuestionBooleanType": "判断题",
|
||||
"assistantQuestionReplyHint": "请直接回复选项或内容。",
|
||||
"assistantResultPass": "🎉 **恭喜!** 您的最终得分是 **{score} 分**,已顺利通过新人考核!您的成绩已自动同步至人事部门。",
|
||||
"assistantResultFail": "📊 **考试结束!** 您的最终得分是 **{score} 分**。及格线为 {passScore} 分。请回复【重新考试】再次挑战!",
|
||||
"assistantResultFail": "📊 **考试结束!** 您的最终得分是 **{score} 分**。及格线为 {passScore} 分。请在工作区点击【重新考试】再次挑战!",
|
||||
"startExamCommand": "开始考试",
|
||||
"restartExamCommand": "重新考试"
|
||||
},
|
||||
|
||||
@@ -485,8 +485,8 @@
|
||||
"title": "",
|
||||
"subtitle": "在同一個 Chat 頁面內完成影片學習、知識點複盤、逐題考試與 HR 管理統計。",
|
||||
"tabs": {
|
||||
"learner": "學員端",
|
||||
"admin": "HR 管理"
|
||||
"learner": "員工培訓",
|
||||
"admin": "培訓管理"
|
||||
},
|
||||
"actions": {
|
||||
"syncLearnerToChat": "同步學員上下文到聊天",
|
||||
@@ -531,6 +531,7 @@
|
||||
"selectedAnswer": "你的答案:{answer}",
|
||||
"correctAnswer": "正確答案:{answer}",
|
||||
"nextQuestion": "下一題",
|
||||
"submitPaper": "提交答卷",
|
||||
"finishExam": "完成考試"
|
||||
},
|
||||
"result": {
|
||||
@@ -554,6 +555,10 @@
|
||||
"employeeId": "工號",
|
||||
"department": "部門"
|
||||
},
|
||||
"examQuestionCard": {
|
||||
"title": "考試題目",
|
||||
"hint": "展示全部題目序號;僅在“逐題考試”階段可點擊切換,並支援返回修改答案。"
|
||||
},
|
||||
"rules": {
|
||||
"title": "考試規則",
|
||||
"rule1": "共 {total} 題,系統按百分制自動計算成績。",
|
||||
@@ -608,12 +613,12 @@
|
||||
"examInProgress": "我正在進行新人培訓考試,目前做到第 {index}/{total} 題,請保持考官模式繼續出題。",
|
||||
"assistantVideoIntro": "👋 歡迎加入公司!我是你的專屬入職培訓助手。今天的培訓分為三個步驟:看影片 ➡️ 知識點複盤 ➡️ 隨堂測試({passScore} 分及格)。\n\n▶️ 請先點擊觀看【入職培訓影片】。觀看完畢後,點擊進入【知識點複盤】。",
|
||||
"assistantSummaryIntro": "太棒了!結合剛才的影片,我為你提煉了以下核心知識點(必考哦):",
|
||||
"assistantSummaryReady": "準備好接受挑戰了嗎?直接點擊【開始考試】或在 Chat 中回覆【開始考試】。",
|
||||
"assistantSummaryReady": "準備好接受挑戰了嗎?請直接在工作區點擊【開始考試】。",
|
||||
"assistantQuestionSingleType": "單選題",
|
||||
"assistantQuestionBooleanType": "判斷題",
|
||||
"assistantQuestionReplyHint": "請直接回覆選項或內容。",
|
||||
"assistantResultPass": "🎉 **恭喜!** 你的最終得分是 **{score} 分**,已順利通過新人考核!成績已自動同步至人事部門。",
|
||||
"assistantResultFail": "📊 **考試結束!** 你的最終得分是 **{score} 分**。及格線為 {passScore} 分。請回覆【重新考試】再次挑戰!",
|
||||
"assistantResultFail": "📊 **考試結束!** 你的最終得分是 **{score} 分**。及格線為 {passScore} 分。請在工作區點擊【重新考試】再次挑戰!",
|
||||
"startExamCommand": "開始考試",
|
||||
"restartExamCommand": "重新考試"
|
||||
},
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user