From 7677aff5bfd1bf4c76b65c5888884ba4e932fde8 Mon Sep 17 00:00:00 2001
From: TangCheng <tangchengmail@163.com>
Date: 星期六, 15 三月 2025 07:01:45 +0800
Subject: [PATCH] 设备评估添加大模型预测

---
 KETTLE/evaluate/evaluate_device.ktr |   38 ++++++++++++++++++++++++++++++++++----
 1 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/KETTLE/evaluate/evaluate_device.ktr b/KETTLE/evaluate/evaluate_device.ktr
index a55e08a..6984beb 100644
--- a/KETTLE/evaluate/evaluate_device.ktr
+++ b/KETTLE/evaluate/evaluate_device.ktr
@@ -469,7 +469,7 @@
     <created_user>-</created_user>
     <created_date>2025/02/25 17:21:43.254</created_date>
     <modified_user>-</modified_user>
-    <modified_date>2025/02/26 18:14:13.959</modified_date>
+    <modified_date>2025/03/15 07:00:02.029</modified_date>
     <key_for_session_key>H4sIAAAAAAAAAAMAAAAAAAAAAAA=</key_for_session_key>
     <is_key_private>N</is_key_private>
   </info>
@@ -602,12 +602,30 @@
 // 鐢熸垚python闇�瑕佺殑鏁版嵁
 var time = [];
 var value= [];
+var llmPrompt = "璇锋牴鎹互涓嬮噰鏍锋暟鎹垎鏋愯澶囨槸鍚﹁繍琛屾甯竆n鏃堕棿,閲囨牱鍊糪n";
 for(var recIndex in recs)
 {
 	var rec = recs[recIndex];
 	time.push(rec["OTIME"].toString());
 	value.push(parseFloat(rec["SDVAL"]));
+	llmPrompt += rec["OTIME"].toString() + "," + rec["SDVAL"].toString() + "\n";
 }
+
+var web = allocHttpRequest();
+var answerJson = strToJson(web.queryHttpRequest({
+	url : "http://127.0.0.1:8081/llm/call_llm",
+	params : {
+		question : llmPrompt,
+		answer_is_json : false
+	}
+}));
+
+var answer = "";
+if(answerJson.json_ok)
+{
+	answer = answerJson.answer;
+}
+
 
 var pythonInArg = {
 	expected_starttime : TIME_DAY.substring(0, 10) + " 00:00:00",
@@ -644,6 +662,7 @@
 		"time_point_timeliness":result["time_point_timeliness"].toString(),
 		"time_sequence_correctness":result["time_sequence_correctness"].toString(),
 		"total_score":result["total_score"].toString(),
+		"llm_result" :answer.toString(),
 
 	}
 	writeToLog("b", "write eval reuslt : " + otype + "." + oname);
@@ -813,6 +832,14 @@
       <field>
         <name>total_score</name>
         <rename>total_score</rename>
+        <type>String</type>
+        <length>-1</length>
+        <precision>-1</precision>
+        <replace>N</replace>
+      </field>
+      <field>
+        <name>llm_result</name>
+        <rename>llm_result</rename>
         <type>String</type>
         <length>-1</length>
         <precision>-1</precision>
@@ -997,7 +1024,8 @@
 	+ " 	time_period_correctness,"
 	+ " 	time_point_timeliness,"
 	+ "		time_sequence_correctness,"
-	+ " 	total_score"
+	+ " 	total_score,"
+	+ " 	llm_result"
 	+ " )VALUES("
 	+ " 	{otime},{otype},{oname},"
  	+ "		{content_correctness},"
@@ -1010,7 +1038,8 @@
 	+ " 	{time_period_correctness},"
 	+ " 	{time_point_timeliness},"
 	+ "		{time_sequence_correctness},"
-	+ " 	{total_score}"
+	+ " 	{total_score},"
+	+ " 	{llm_result}"
 	+ " )"
 	+ "ON CONFLICT (otime, otype, oname) DO NOTHING"
 	;
@@ -1030,7 +1059,8 @@
 		time_period_correctness : "D" + time_period_correctness,
 		time_point_timeliness : "D" + time_point_timeliness,
 		time_sequence_correctness : "D" + time_sequence_correctness,
-		total_score : "D" + total_score		
+		total_score : "D" + total_score,
+        llm_result : "S" + llm_result		
 	});
 
 </jsScript_script>

--
Gitblit v1.9.3