From b6be9d0eace68b44cca264fb558e640ff22cf739 Mon Sep 17 00:00:00 2001 From: chenyuan Date: Tue, 4 Aug 2026 17:13:06 +0800 Subject: [PATCH] feat: unify student AI learning and assessment panel --- src/views/components/TrainingAiSidebar.vue | 74 ++++++++++++++----- .../components/studentTrainingAiPanel.js | 4 + src/views/training/GenericTrainingPage.vue | 4 +- tests/student-training-ai-panel.test.mjs | 10 +++ 4 files changed, 69 insertions(+), 23 deletions(-) create mode 100644 src/views/components/studentTrainingAiPanel.js create mode 100644 tests/student-training-ai-panel.test.mjs diff --git a/src/views/components/TrainingAiSidebar.vue b/src/views/components/TrainingAiSidebar.vue index e51a304..73e1c02 100644 --- a/src/views/components/TrainingAiSidebar.vue +++ b/src/views/components/TrainingAiSidebar.vue @@ -6,13 +6,14 @@ AI助学 +

点击参考提示词可自动带入问题,AI 将结合当前实训内容给出建议。

{{ displayAssistMessage }}

-
+
+
@@ -29,7 +30,7 @@ AI助评 -
+

{{ displayEvalMessage }}

@@ -37,18 +38,17 @@
-
- - -
+ AI智能评分 @@ -194,6 +224,10 @@ function requestEvaluation() { margin: 0; } } +.ai-instruction { margin: -4px 0 12px; color: #9fcbe2; font-size: 13px; line-height: 1.6; } +.reference-block { width: 100%; border: 0; background: transparent; padding: 14px 0 0; text-align: left; cursor: pointer; } +.reference-block:hover strong { color: #77eaff; } +.assessment-button { width: 100%; margin-top: 14px; min-height: 44px; font-weight: 800; } .output-glow { position: absolute; diff --git a/src/views/components/studentTrainingAiPanel.js b/src/views/components/studentTrainingAiPanel.js new file mode 100644 index 0000000..7c09f6b --- /dev/null +++ b/src/views/components/studentTrainingAiPanel.js @@ -0,0 +1,4 @@ +export function buildReferencePrompt(referenceText) { + const text = String(referenceText || "").trim(); + return text ? `请根据以下参考提示词协助我完成当前任务:\n${text}` : ""; +} diff --git a/src/views/training/GenericTrainingPage.vue b/src/views/training/GenericTrainingPage.vue index d90a329..701d259 100644 --- a/src/views/training/GenericTrainingPage.vue +++ b/src/views/training/GenericTrainingPage.vue @@ -155,9 +155,8 @@
- - @@ -170,7 +169,6 @@ import { Download, Upload } from "@element-plus/icons-vue"; import { getTrainingTaskByKey } from "@/api/trainingTask"; import { getStudentTrainingAnswer, saveStudentTrainingAnswer, uploadStudentTrainingFile } from "@/api/studentTrainingAnswer"; import { getStudentTrainingPage } from "./studentTrainingPages"; -import TrainingAiEvaluation from "@/views/components/TrainingAiEvaluation.vue"; import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue"; import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue"; import { isStudentDemo } from "@/utils/studentDemo"; diff --git a/tests/student-training-ai-panel.test.mjs b/tests/student-training-ai-panel.test.mjs new file mode 100644 index 0000000..bf02bb1 --- /dev/null +++ b/tests/student-training-ai-panel.test.mjs @@ -0,0 +1,10 @@ +import assert from "node:assert/strict"; +import { buildReferencePrompt } from "../src/views/components/studentTrainingAiPanel.js"; + +assert.equal( + buildReferencePrompt("先从案例中拆出核心层、有形层、延伸层。"), + "请根据以下参考提示词协助我完成当前任务:\n先从案例中拆出核心层、有形层、延伸层。" +); +assert.equal(buildReferencePrompt(""), ""); + +console.log("student training AI panel contract passed");