Explorar o código

人才评价智能体bugfix

anhuiqiang hai 1 semana
pai
achega
c7ffd2845f

+ 4 - 1
server/src/assessment/graph/nodes/analyzer.node.ts

@@ -23,7 +23,10 @@ export const reportAnalyzerNode = async (
     }
 
     const scoreSummary = Object.entries(scores)
-        .map(([qId, score]) => `Question ${qId}: Score ${score}/10`)
+        .map(([qId, score]) => {
+            const displayId = isNaN(parseInt(qId)) ? qId : (parseInt(qId) + 1).toString();
+            return `Question ${displayId}: Score ${score}/10`;
+        })
         .join("\n");
 
     const isZh = state.language === 'zh';

+ 10 - 3
server/src/assessment/graph/nodes/generator.node.ts

@@ -37,13 +37,15 @@ export const questionGeneratorNode = async (
 1. 问题文本。
 2. 3-5 个关键点或概念,用户在回答中应当提到这些点以证明其掌握程度。
 3. 难度级别(标准、进阶、专家)。
+4. 出题依据(从知识库中提取的、支持此问题的相关文本片段或事实摘要)。
 
 请以 JSON 数组格式返回响应:
 [
   {
     "question_text": "...",
     "key_points": ["...", "..."],
-    "difficulty": "..."
+    "difficulty": "...",
+    "basis": "..."
   }
 ]`;
 
@@ -59,13 +61,15 @@ export const questionGeneratorNode = async (
 1. 問題文。
 2. ユーザーが習熟度を証明するために回答内で言及すべき 3〜5 個のキーポイントまたは概念。
 3. 難易度(標準、上級、スペシャリスト)。
+4. 出題の根拠(この問題を裏付けるナレッジベースから抽出された関連するテキストスニペットまたは事実の要約)。
 
 レスポンスは以下の JSON 配列形式でフォーマットしてください:
 [
   {
     "question_text": "...",
     "key_points": ["...", "..."],
-    "difficulty": "..."
+    "difficulty": "...",
+    "basis": "..."
   }
 ]`;
 
@@ -81,13 +85,15 @@ For each question, you must provide:
 1. The question text.
 2. A list of 3-5 key points or concepts that the user should mention in their answer to demonstrate mastery.
 3. A difficulty level (Standard, Advanced, Specialist).
+4. A basis for the question (the relevant text snippet or fact summary extracted from the knowledge base that supports this question).
 
 Format your response as a JSON array of objects:
 [
   {
     "question_text": "...",
     "key_points": ["...", "..."],
-    "difficulty": "..."
+    "difficulty": "...",
+    "basis": "..."
   }
 ]`;
 
@@ -107,6 +113,7 @@ Format your response as a JSON array of objects:
                 questionText: q.question_text,
                 keyPoints: q.key_points,
                 difficulty: q.difficulty,
+                basis: q.basis,
             })),
             currentQuestionIndex: 0,
         };

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
server/tsconfig.build.tsbuildinfo


+ 33 - 0
web/components/views/AssessmentView.tsx

@@ -43,6 +43,7 @@ export const AssessmentView: React.FC<AssessmentViewProps> = ({
     const [error, setError] = useState<string | null>(null);
     const [history, setHistory] = useState<AssessmentSession[]>([]);
     const [loadingHistoryId, setLoadingHistoryId] = useState<string | null>(null);
+    const [showBasis, setShowBasis] = useState(false);
 
     const messagesEndRef = useRef<HTMLDivElement>(null);
 
@@ -569,6 +570,38 @@ export const AssessmentView: React.FC<AssessmentViewProps> = ({
                         </div>
                     )}
 
+                    {state?.questions && state.questions[state.currentQuestionIndex] && (
+                        <div className="mt-6 pt-6 border-t border-slate-100">
+                            <h4 className="text-[11px] font-black text-slate-400 uppercase tracking-widest flex items-center justify-between mb-4">
+                                <div className="flex items-center gap-2">
+                                    <ClipboardCheck size={14} />
+                                    {t('questionBasis')}
+                                </div>
+                                <button 
+                                    onClick={() => setShowBasis(!showBasis)}
+                                    className="text-indigo-600 hover:text-indigo-800 lowercase tracking-normal font-bold"
+                                >
+                                    {showBasis ? t('hideBasis') : t('viewBasis')}
+                                </button>
+                            </h4>
+                            
+                            <AnimatePresence>
+                                {showBasis && (
+                                    <motion.div
+                                        initial={{ opacity: 0, height: 0 }}
+                                        animate={{ opacity: 1, height: 'auto' }}
+                                        exit={{ opacity: 0, height: 0 }}
+                                        className="overflow-hidden"
+                                    >
+                                        <div className="text-sm text-slate-600 leading-relaxed font-medium bg-indigo-50/30 rounded-2xl p-4 border border-indigo-100/50">
+                                            {state.questions[state.currentQuestionIndex].basis || "No basis provided."}
+                                        </div>
+                                    </motion.div>
+                                )}
+                            </AnimatePresence>
+                        </div>
+                    )}
+
                     <div className="mt-auto pt-6 border-t border-slate-100">
                         <div className="bg-amber-50 rounded-2xl p-4 border border-amber-100 flex items-start gap-3">
                             <AlertCircle size={16} className="text-amber-500 mt-0.5 shrink-0" />

+ 9 - 0
web/utils/translations.ts

@@ -798,6 +798,9 @@ export const translations = {
     assessmentResultsAvailable: "评测结果已就绪",
     knowledgeCoverage: "知识覆盖度",
     precisionScore: "精准度评分",
+    questionBasis: "出题依据",
+    viewBasis: "查看依据",
+    hideBasis: "隐藏依据",
     verified: "已验证",
     fail: "失败",
     comprehensiveMasteryReport: "综合能力报告",
@@ -1667,6 +1670,9 @@ export const translations = {
     assessmentResultsAvailable: "Assessment Results Available",
     knowledgeCoverage: "Knowledge Coverage",
     precisionScore: "Precision Score",
+    questionBasis: "Question Basis",
+    viewBasis: "View Basis",
+    hideBasis: "Hide Basis",
     verified: "Verified",
     fail: "Fail",
     comprehensiveMasteryReport: "Comprehensive Mastery Report",
@@ -2529,6 +2535,9 @@ export const translations = {
     assessmentResultsAvailable: "アセスメント結果あり",
     knowledgeCoverage: "知識カバレッジ",
     precisionScore: "精度スコア",
+    questionBasis: "出題の根拠",
+    viewBasis: "根拠を表示",
+    hideBasis: "根拠を非表示",
     verified: "検証済み",
     fail: "失敗",
     comprehensiveMasteryReport: "包括的習熟度レポート",

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio