TangCheng
2025-03-15 7677aff5bfd1bf4c76b65c5888884ba4e932fde8
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>