Răsfoiți Sursa

adapt to az

997842115 1 săptămână în urmă
părinte
comite
32e9df169f
14 a modificat fișierele cu 1751 adăugiri și 5 ștergeri
  1. 0 0
      az_basic_rule
  2. 0 0
      az_name_label
  3. 0 0
      basic_rule
  4. 271 0
      buchong.py
  5. 25 0
      huansuan.py
  6. 42 0
      huansuan0304.py
  7. 22 0
      huansuan0308.py
  8. 22 0
      huansuan0309.py
  9. 9 0
      postprocess.py
  10. 179 0
      postprocess0304.py
  11. 393 0
      postprocess0308.py
  12. 160 0
      postprocess0310.py
  13. 129 5
      tasks.py
  14. 499 0
      tihuan_az.py

Fișier diff suprimat deoarece este prea mare
+ 0 - 0
az_basic_rule


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
az_name_label


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
basic_rule


+ 271 - 0
buchong.py

@@ -0,0 +1,271 @@
+import json
+def only(tz, aiclient):
+    completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+        {"role": "user", "content": "给定一段文字,其中描述了一项安装工作的工作内容。这段文字可能会注明,该项工作不用考虑安装的设备本身的费用,只需考虑安装费。这段文字也可能不做任何注明。"+'''
+              例如,给定文字如下:
+              1、名称:高真空焊烟净化机组控制箱(箱随设备提供计安装费)
+              这段文字注明了仅计安装费
+              再例如,给定文字如下:
+              1、名称:母线槽始端箱(超高)
+              2、型号:15C
+              3、容量(A):1800A
+              这段文字没有注明
+
+        ''' + '现在给定文字如下:'+tz+"\n请判断是否注明了仅计安装费,请直接回答是或者否"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        )
+    mc = completion.choices[0].message.content
+    if '是' in mc:
+        return True
+    return False
+
+def need_buchong(debm, tz, aiclient):
+    if debm == '4-266' or debm == '4-267' or debm =='4-268' or debm=='4-269' or debm=='4-270':
+        return not only(tz, aiclient)
+    if debm == '4-265':
+        return not only(tz, aiclient)
+    if debm == '4-203' or debm =='4-204' or debm=='4-205' or debm=='4-206':
+        return not only(tz, aiclient)
+    if debm == '4-918' or debm =='4-919':
+        return not only(tz, aiclient)
+    if debm in ['1-'+str(x) for x in range(684,702)]:
+        return not only(tz, aiclient)
+    if debm in ['9-'+str(x) for x in range(153,163)]:
+        return not only(tz, aiclient)
+    if debm in ['9-'+str(x) for x in range(200,206)]:
+        return not only(tz, aiclient)
+    if debm in ['6-'+str(x) for x in range(23,36)]:
+        return not only(tz, aiclient)
+    if debm in ['6-'+str(x) for x in range(64,92)]:
+        return not only(tz, aiclient)
+    return False
+def buchong_cailiao(aiclient, debm, tz):
+    if debm in ['6-'+str(x) for x in range(64,92)]:
+        bh = '610000F'
+        completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+        {"role": "user", "content": "给定一段文字,请抽取出流量表的关键信息并返回。"+'''
+              例如,给定文字如下:
+              1、名称:热式动力气体质量流量计
+              2、型号:50-5000Nm,141/h,PN1.6MPa
+              你应该返回    "热式动力气体质量流量计50-5000Nm,141/h,PN1.6MPa"
+
+        ''' + '现在给定文字如下:'+tz+"\n请返回结果"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        )
+        mc = completion.choices[0].message.content
+        print(mc)
+    if debm in ['6-'+str(x) for x in range(23,36)]:
+        bh = '610000F'
+        completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+        {"role": "user", "content": "给定一段文字,请抽取出压力表的关键信息并返回。"+'''
+              例如,给定文字如下:
+              1、名称:压力表
+              2、型号:含表阀及弯管
+              3、规格:Y-100型,0-1.6MPa
+              你应该返回    "压力表Y-100型 含表阀及弯管"
+
+        ''' + '现在给定文字如下:'+tz+"\n请返回结果"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        )
+        mc = completion.choices[0].message.content
+        print(mc)
+    if debm in ['9-'+str(x) for x in range(200,206)]:
+        bh = '910000F'
+        completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+        {"role": "user", "content": "给定一段文字,请抽取出显示器、报警器、控制器的关键信息并返回。"+'''
+              例如,给定文字如下:
+              名称: 燃气声光报警器
+              你应该返回    "燃气声光报警器"
+
+        ''' + '现在给定文字如下:'+tz+"\n请返回结果"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        )
+        mc = completion.choices[0].message.content
+        print(mc)
+    if debm in ['9-'+str(x) for x in range(153,163)]:
+        bh = '910000F'
+        completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+        {"role": "user", "content": "给定一段文字,请抽取出探测器的关键信息并返回。"+'''
+              例如,给定文字如下:
+              名称:可燃气体探测器
+              你应该返回    "可燃气体探测器"
+
+        ''' + '现在给定文字如下:'+tz+"\n请返回结果"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        )
+        mc = completion.choices[0].message.content
+        print(mc)
+    if debm in ['1-'+str(x) for x in range(684,702)]:
+        bh = '110000F'
+        completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+        {"role": "user", "content": "给定一段文字,请抽取出轴流通风机的关键信息并返回。"+'''
+              例如,给定文字如下:
+              名称:侧墙轴流风机
+              你应该返回    "侧墙轴流风机"
+
+        ''' + '现在给定文字如下:'+tz+"\n请返回结果"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        )
+        mc = completion.choices[0].message.content
+        print(mc)
+    if debm.startswith('4-918') or debm.startswith('4-919'):
+        bh = '410000F'
+        completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+        {"role": "user", "content": "给定一段文字,请抽取出避雷网的关键信息并返回。"+'''
+              例如,给定文字如下:
+              1、名称:防雷网
+              2、材质:镀锌扁钢
+              3、规格:25*4
+              你应该返回    "镀锌扁钢 25*4"
+
+        ''' + '现在给定文字如下:'+tz+"\n请返回结果"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        )
+        mc = completion.choices[0].message.content
+        print(mc)
+    if debm.startswith('4-203') or debm.startswith('4-204') or debm.startswith('4-205') or debm.startswith('4-206'):
+        bh = '410000F'
+        completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+        {"role": "user", "content": "给定一段文字,请抽取出始端箱(分线箱)的关键信息(电流容量)并返回。"+'''
+              例如,给定文字如下:
+              1、名称:母线槽始端箱(超高)
+              2. 型号2D
+              3. 容量(A):800A
+              你应该返回    "母线槽始端箱800A"
+
+        ''' + '现在给定文字如下:'+tz+"\n请返回结果"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        )
+        mc = completion.choices[0].message.content
+        print(mc)
+    if debm.startswith('4-265'):
+        bh = '410000F'
+        completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+        {"role": "user", "content": "给定一段文字,请抽取出控制箱的关键信息并返回。"+'''
+              例如,给定文字如下:
+              1、名称:照明按钮控制箱
+              你应该返回    "照明按钮控制箱"
+
+        ''' + '现在给定文字如下:'+tz+"\n请返回结果"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        )
+        mc = completion.choices[0].message.content
+        print(mc)
+    if debm.startswith('4-266') or debm.startswith('4-267') or debm.startswith('4-268') or debm.startswith('4-269') or debm.startswith('4-230'):
+        bh = '410000F'
+        completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+        {"role": "user", "content": "给定一段文字,请抽取出配电箱的关键信息并返回。"+'''
+              例如,给定文字如下:
+              1、名称:配电箱
+              2、型号:L5A
+              3、规格:600*1500*400
+              4、基础形式、材质、规格:10#槽钢
+              5、安装方式:落地安装
+              6、电气元器件,模块按设计配置齐全
+              7、详见设计图纸,满足设计及规范要求
+              你应该返回    "配电箱L5A"
+              再例如,给定文字如下:
+              1、名称:消火栓泵配电柜XFX
+              2、型号:600*1500*400
+              4、基础形式、材质、规格:10#槽钢
+              5、安装方式:落地安装
+              6、电气元器件,模块按设计配置齐全
+              7、详见设计图纸,满足设计及规范要求
+              你应该返回    "消火栓泵配电柜XFX"
+              再例如,给定文字如下:
+              1、名称:配电箱C-AT
+              2、型号:非标,详见系统图
+              4、基础形式、材质、规格:10#槽钢
+              5、安装方式:落地安装
+              6、电气元器件,模块按设计配置齐全
+              7、详见设计图纸,满足设计及规范要求
+              你应该返回    "配电箱C-AT"
+
+        ''' + '现在给定文字如下:'+tz+"\n请返回结果"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        )
+        mc = completion.choices[0].message.content
+        print(mc)
+    return {'CLBH': bh, 'CLMC': mc, 'JLDW': '台', 'YSJG': 0, 'SL': 1, 'HJ': 0}
+def tihuan(aiclient, old_name, tz):
+    completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+        {"role": "user", "content": "给定一段文字,再给定一个材料,请抽取出该材料的关键信息并返回。"+'''
+              例如,给定文字如下:
+              1、名称:密集型铜母线(超高)
+              2、型号:XL-M-63A/5P
+              3、容量(A):63A
+              4、含配套支架
+              给定材料为 “母线槽 每相400A以下”,
+              你应该返回 “密集型铜母线XL-M-63A/5P”
+              再例如,给定文字如下:
+              1、名称:接地母线
+              2、材质:镀锌扁钢
+              3、规格:-40*4
+              给定材料为 “接地母线”,
+              你应该返回 “镀锌扁钢 40*4”
+              再例如,给定文字如下:
+              1、名称:消防电源通讯管理机
+              2、型号:配DPD信号
+              3、安装方式:落地安装
+              给定材料为 “槽钢”,
+              因为文字没有提及槽钢,所以你原封不动返回材料名,这里你应该返回“槽钢”
+        ''' + '现在给定文字如下:'+tz+"\n给定材料为 "+old_name+"\n请返回结果"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        )
+    mc = completion.choices[0].message.content
+    print(mc)
+    return mc
+
+def buchong(aiclient, json_string, debm, tz):
+    obj = json.loads(json_string)
+    print(debm)
+    if need_buchong(debm, tz, aiclient):
+        obj['clde'].append(buchong_cailiao(aiclient, debm, tz))
+    for entry in obj['clde']:
+        if entry['CLBH'].startswith('CL'):
+            entry['CLMC']=tihuan(aiclient, entry['CLMC'], tz)
+    return json.dumps(obj, ensure_ascii=False)

+ 25 - 0
huansuan.py

@@ -12,6 +12,10 @@ from huansuan0111 import callzaihuansuan0111_1
 from huansuan0111 import callzaihuansuan0111_2
 from huansuan0111 import callzaihuansuan0111_3
 from huansuan0112 import callzaihuansuan0112_1
+from huansuan0304 import callzaihuansuan030404017
+from huansuan0304 import callzaihuansuan030411001
+from huansuan0309 import callzaihuansuan030901013
+from huansuan0308 import callzaihuansuan030801
 import time
 def callzaihuansuan(bianma, label, A,B,C, aiclient, qwclient, sfclient):
     time.sleep(1)
@@ -78,6 +82,27 @@ def callzaihuansuan(bianma, label, A,B,C, aiclient, qwclient, sfclient):
         if bianma.startswith("0108"):
             if '樘' in A and 'm2' in B:
                 return callzaihuansuan0108_1(bianma, label, A, B, C, aiclient, qwclient, sfclient)
+    if bianma.startswith("030404017"):##配电箱
+        print(A)
+        print(B)
+        if '基础槽钢' in label:
+            return callzaihuansuan030404017(bianma, label, A, B, C, aiclient, qwclient, sfclient)
+    if bianma.startswith("030411001"):##配管
+        print(A)
+        print(B)
+        if '刚性防水套管' in label:
+            return callzaihuansuan030411001(bianma, label, A, B, C, aiclient, qwclient, sfclient)
+    if bianma.startswith("030901013"):##灭火器
+        print(A)
+        print(B)
+        if '灭火器' in label:
+            return callzaihuansuan030901013(bianma, label, A, B, C, aiclient, qwclient, sfclient)
+    if bianma.startswith("030801"):##工业管道
+        print(A)
+        print(B)
+        if '管道刷油' in label or '手工除锈':
+            return callzaihuansuan030801(bianma, label, A, B, C, aiclient, qwclient, sfclient)
+
 
     return """
        {"answer": "0"}

+ 42 - 0
huansuan0304.py

@@ -0,0 +1,42 @@
+from template import expression
+from config import simplemodel
+def callzaihuansuan030404017(bianma, label, A,B,C, aiclient, qwclient, sfclient ):
+    completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+        {"role": "user", "content": "问题描述:  计量单位可以用名称或者符号表示,常用的符号包括表示米的符号m,表示千米的符号km,表示吨的符号t,表示千克的符号kg,表示平方米的符号m2,表示立方米的符号m3。给定一段工作内容描述,内容为" + C + ",给定其工作量计量单位,内容为" + A + ",记作A,再给定一个工作量计量单位,内容为" + B + ",记作B。若A表示数量'个',B表长度10米,且工作内容涉及配电箱,则可以计算配电箱占地的周长,作为换算系数coefficient, 最终返回A=coefficient*B。例如,工作内容描述配电箱尺寸为800*1500*600,三个数字代表长、宽、高,最大的数字1500代表高,剩下的两个数字800(mm)跟600(mm)代表占地的长方形的两条边,则周长为(800+600)*2=2800mm=2.8m。因为单位是10m,所以换算成0.28,最终你应该返回A=0.28*B。若工作内容中没有配电箱的具体尺寸,请返回A=0.2*B。"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    completion = sfclient.chat.completions.create(
+        model=simplemodel(),
+        messages=expression(json_string),
+        extra_body={"thinking": {"type": "disabled"}},
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    return json_string
+
+def callzaihuansuan030411001(bianma, label, A,B,C, aiclient, qwclient, sfclient ):
+    completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+        {"role": "user", "content": "问题描述:  计量单位可以用名称或者符号表示,常用的符号包括表示米的符号m,表示千米的符号km,表示吨的符号t,表示千克的符号kg,表示平方米的符号m2,表示立方米的符号m3。给定一段工作内容描述,内容为" + C + ",给定其工作量计量单位,内容为" + A + ",记作A,再给定一个工作量计量单位,内容为" + B + ",记作B。若A表示长度'm',B表示数量‘10个’,且工作内容涉及刚性防水套管(翼环),则应该考虑每米管道配置的翼环数目,作为换算系数coefficient, 最终返回A=coefficient*B。例如,工作内容描述翼环配置42个(默认表示每100米管道),则换算成每米为0.42个,再换算成单位‘10个’,所以换算成0.042,最终你应该返回A=0.042*B。若工作内容中没有提及具体配置,请返回A=0.1*B。"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    completion = sfclient.chat.completions.create(
+        model=simplemodel(),
+        messages=expression(json_string),
+        extra_body={"thinking": {"type": "disabled"}},
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    return json_string
+

+ 22 - 0
huansuan0308.py

@@ -0,0 +1,22 @@
+from template import expression
+from config import simplemodel
+def callzaihuansuan030801(bianma, label, A,B,C, aiclient, qwclient, sfclient ):
+    completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+        {"role": "user", "content": "问题描述:  计量单位可以用名称或者符号表示,常用的符号包括表示米的符号m,表示千米的符号km,表示吨的符号t,表示千克的符号kg,表示平方米的符号m2,表示立方米的符号m3。给定一段工作内容描述,内容为" + C + ",给定其工作量计量单位,内容为" + A + ",记作A,再给定一个工作量计量单位,内容为" + B + ",记作B。若A表示长度m,B表示面积10m2,且工作内容涉及管道,则可以分析管道直径,由直径计算圆周长,作为换算系数coefficient, 最终返回A=coefficient*B。例如,工作内容描述管道规格为D273*8,则管道外径为273mm,圆周长273*3.14=857mm,则每米管道面积为0.857m2, 因为单位是10m2,所以换算成0.0857,最终你应该返回A=0.0857*B。若工作内容中没有明确含管道外径,请返回A=0*B。"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    completion = sfclient.chat.completions.create(
+        model=simplemodel(),
+        messages=expression(json_string),
+        extra_body={"thinking": {"type": "disabled"}},
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    return json_string
+

+ 22 - 0
huansuan0309.py

@@ -0,0 +1,22 @@
+from template import expression
+from config import simplemodel
+def callzaihuansuan030901013(bianma, label, A,B,C, aiclient, qwclient, sfclient ):
+    completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+        {"role": "user", "content": "问题描述:  计量单位可以用名称或者符号表示,常用的符号包括表示米的符号m,表示千米的符号km,表示吨的符号t,表示千克的符号kg,表示平方米的符号m2,表示立方米的符号m3。给定一段工作内容描述,内容为" + C + ",给定其工作量计量单位,内容为" + A + ",记作A,再给定一个工作量计量单位,内容为" + B + ",记作B。若A表示数量'套',B表数量10具,且工作内容涉及灭火器,则可以分析每套设施含有几具灭火器,作为换算系数coefficient, 最终返回A=coefficient*B。例如,工作内容描述每套含两具灭火器,则系数为2具,因为单位是10具,所以换算成0.2,最终你应该返回A=0.2*B。若工作内容中没有明确含多少具灭火器,请返回A=0.1*B。"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    completion = sfclient.chat.completions.create(
+        model=simplemodel(),
+        messages=expression(json_string),
+        extra_body={"thinking": {"type": "disabled"}},
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    return json_string
+

+ 9 - 0
postprocess.py

@@ -12,6 +12,9 @@ from postprocess0112 import postprocess0112
 from postprocess0113 import postprocess0113
 from postprocess0114 import postprocess0114
 from postprocess0115 import postprocess0115
+from postprocess0304 import postprocess0304
+from postprocess0310 import postprocess0310
+from postprocess0308 import postprocess0308
 from mianji import adjust
 def postprocess(selected, data, aiclient, qwclient, sfclient, label_name, name_dw, candidates,yqspecial):
     l = postprocess_(selected,data,aiclient,qwclient,sfclient,label_name,name_dw,candidates,yqspecial)
@@ -47,5 +50,11 @@ def postprocess_(selected, data, aiclient, qwclient, sfclient, label_name, name_
         return postprocess0114(selected, data, aiclient, qwclient, sfclient, label_name, name_dw, candidates)
     elif data['bianma'].startswith("0115"):
         return postprocess0115(selected, data, aiclient, qwclient, sfclient, label_name, name_dw, candidates)
+    elif data['bianma'].startswith("0304"):
+        return postprocess0304(selected, data, aiclient, qwclient, sfclient, label_name, name_dw, candidates)
+    elif data['bianma'].startswith("0310"):
+        return postprocess0310(selected, data, aiclient, qwclient, sfclient, label_name, name_dw, candidates)
+    elif data['bianma'].startswith("0308"):
+        return postprocess0308(selected, data, aiclient, qwclient, sfclient, label_name, name_dw, candidates)
     else: 
         return selected

+ 179 - 0
postprocess0304.py

@@ -0,0 +1,179 @@
+import time
+from fallback import fallback
+from config import simplemodel
+from template import xuanxiang
+from fallback import fallback
+zhijing=['公称直径(mm以内)50', '公称直径(mm以内)80', '公称直径(mm以内)100', '公称直径(mm以内)150' , '公称直径(mm以内)200', '公称直径(mm以内)250', '公称直径(mm以内)300']
+def select_zhijing(
+       B, #data
+       aiclient,
+             qwclient,
+              sfclient,
+             dw):
+    options=[]
+    letters = "ABCDEFGHIJKLMN"
+    for i in range(len(zhijing)):
+        options.append("给定选项" + letters[i]+",内容为"+zhijing[i] )
+
+    completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        #model="THUDM/GLM-Z1-9B-0414",
+        #model="ernie-speed-128k",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+            {"role": "user", "content": "问题描述: 给定一段工作内容: " + B['label'] + " " +  B['mc'] + " " + B['tz'] +  ",".join(options) + "。请选择最合适的选项,并返回字母代号,例如,返回 A"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": True},
+        #stream=True
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    if len([x for x in json_string if x != ',' and x != '[' and x != ']' and x != ' ' and (x < 'A' or x > 'M')]) < 5:
+        answer=[]
+        if 'A' in json_string and len(zhijing) > 0:
+            answer.append('A')
+        if 'B' in json_string and len(zhijing) > 1:
+            answer.append('B')
+        if 'C' in json_string and len(zhijing) > 2:
+            answer.append('C')
+        if 'D' in json_string and len(zhijing) > 3:
+            answer.append('D')
+        if 'E' in json_string and len(zhijing) > 4:
+            answer.append('E')
+        if 'F' in json_string and len(zhijing) > 5:
+            answer.append('F')
+        if 'G' in json_string and len(zhijing) > 6:
+            answer.append('G')
+        return answer
+    completion = sfclient.chat.completions.create(
+        #model="glm-4.5-flash",
+        model=simplemodel(),
+        messages=xuanxiang(json_string),
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": False},
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    answer=[]
+    if 'A' in json_string and len(zhijing) > 0:
+        answer.append('A')
+    if 'B' in json_string and len(zhijing) > 1:
+        answer.append('B')
+    if 'C' in json_string and len(zhijing) > 2:
+        answer.append('C')
+    if 'D' in json_string and len(zhijing) > 3:
+        answer.append('D')
+    if 'E' in json_string and len(zhijing) > 4:
+        answer.append('E')
+    if 'F' in json_string and len(zhijing) > 5:
+        answer.append('F')
+    if 'G' in json_string and len(zhijing) > 6:
+        answer.append('G')
+    
+    return answer
+def aifilter1(A, #options
+       B, #data
+       aiclient,
+             qwclient,
+              sfclient,
+             dw):
+    options=[]
+    letters = "ABCDEFGHIJKLMN"
+    for i in range(len(A)):
+        options.append("给定选项" + letters[i]+",内容为"+A[i] )
+
+    completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        #model="THUDM/GLM-Z1-9B-0414",
+        #model="ernie-speed-128k",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+            {"role": "user", "content": " 特殊处理要求一:如果工作内容描述是配电箱安装,并且安装方式是悬挂而非落地式,则去掉所有基础槽钢、角钢的选项"},
+            {"role": "user", "content": " 重要提示:选项指的是给定的A、B、C之类的选项,不是指的工作内容中的可能的1、2、3这样罗列的特征"},
+            {"role": "user", "content": " 重要提示:除特殊处理要求提及的内容外,不需考虑选项内容与工作内容是否符合,只需要根据特殊处理要求做出处理"},
+            {"role": "user", "content": "问题描述: 给定一段工作内容: " + B['label'] + " " +  B['mc'] + " " + B['tz'] +  ",".join(options) + "。请根据处理要求做出处理,并返回结果, 删除选项必须对应到明确的特殊处理要求,不要擅自删除选项。例如,如果处理完后剩余A,B,C三个选项,请返回[A,B,C]"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": True},
+        #stream=True
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    if len([x for x in json_string if x != ',' and x != '[' and x != ']' and x != ' ' and (x < 'A' or x > 'M')]) < 5:
+        answer=[]
+        if 'A' in json_string and len(A) > 0:
+            answer.append(A[0])
+        if 'B' in json_string and len(A) > 1:
+            answer.append(A[1])
+        if 'C' in json_string and len(A) > 2:
+            answer.append(A[2])
+        if 'D' in json_string and len(A) > 3:
+            answer.append(A[3])
+        if 'E' in json_string and len(A) > 4:
+            answer.append(A[4])
+        if 'F' in json_string and len(A) > 5:
+            answer.append(A[5])
+        if 'G' in json_string and len(A) > 6:
+            answer.append(A[6])
+        if 'H' in json_string and len(A) > 7:
+            answer.append(A[7])
+        if 'I' in json_string and len(A) > 8:
+            answer.append(A[8])
+        if 'J' in json_string and len(A) > 9:
+            answer.append(A[9])
+        return answer
+    completion = sfclient.chat.completions.create(
+        #model="glm-4.5-flash",
+        model=simplemodel(),
+        messages=xuanxiang(json_string),
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": False},
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    answer=[]
+    if 'A' in json_string and len(A) > 0:
+        answer.append(A[0])
+    if 'B' in json_string and len(A) > 1:
+        answer.append(A[1])
+    if 'C' in json_string and len(A) > 2:
+        answer.append(A[2])
+    if 'D' in json_string and len(A) > 3:
+        answer.append(A[3])
+    if 'E' in json_string and len(A) > 4:
+        answer.append(A[4])
+    if 'F' in json_string and len(A) > 5:
+        answer.append(A[5])
+    if 'G' in json_string and len(A) > 6:
+        answer.append(A[6])
+    if 'H' in json_string and len(A) > 7:
+        answer.append(A[7])
+    if 'I' in json_string and len(A) > 8:
+        answer.append(A[8])
+    if 'J' in json_string and len(A) > 9:
+        answer.append(A[9])
+    return answer
+
+def postprocess0304(selected, data, aiclient, qwclient, sfclient, label_name, name_dw, candidates):
+    prime = aifilter1(selected, data, aiclient, qwclient, sfclient, name_dw)
+    if data['bianma'].startswith('030411001'):#配管
+        if '翼环' in data['tz']:
+            if len([x for x in prime if '刚性防水套管' in x]) == 0:
+                t = select_zhijing(data, aiclient, qwclient, sfclient, name_dw)
+                if 'A' in t:
+                    prime.append('第十册 给排水、采暖、燃气工程 第二章 支架及其它 2.3 刚性防水套管制作、安装 刚性防水套管制作、安装 公称直径(mm以内) 50')
+                elif 'B' in t:
+                    prime.append('第十册 给排水、采暖、燃气工程 第二章 支架及其它 2.3 刚性防水套管制作、安装 刚性防水套管制作、安装 公称直径(mm以内) 80')
+                elif 'C' in t:
+                    prime.append('第十册 给排水、采暖、燃气工程 第二章 支架及其它 2.3 刚性防水套管制作、安装 刚性防水套管制作、安装 公称直径(mm以内) 100')
+                elif 'D' in t:
+                    prime.append('第十册 给排水、采暖、燃气工程 第二章 支架及其它 2.3 刚性防水套管制作、安装 刚性防水套管制作、安装 公称直径(mm以内) 150')
+                elif 'E' in t:
+                    prime.append('第十册 给排水、采暖、燃气工程 第二章 支架及其它 2.3 刚性防水套管制作、安装 刚性防水套管制作、安装 公称直径(mm以内) 200')
+                elif 'F' in t:
+                    prime.append('第十册 给排水、采暖、燃气工程 第二章 支架及其它 2.3 刚性防水套管制作、安装 刚性防水套管制作、安装 公称直径(mm以内) 250')
+                elif 'G' in t:
+                    prime.append('第十册 给排水、采暖、燃气工程 第二章 支架及其它 2.3 刚性防水套管制作、安装 刚性防水套管制作、安装 公称直径(mm以内) 300')
+
+    return prime

+ 393 - 0
postprocess0308.py

@@ -0,0 +1,393 @@
+import time
+from fallback import fallback
+from config import simplemodel
+from template import xuanxiang
+from fallback import fallback
+zhijing=['公称直径(mm以内)15', '公称直径(mm以内)20', '公称直径(mm以内)25', '公称直径(mm以内)32' , '公称直径(mm以内)40', '公称直径(mm以内)50', '公称直径(mm以内)65',  '公称直径(mm以内)80',  '公称直径(mm以内)100',  '公称直径(mm以内)125',  '公称直径(mm以内)150',  '公称直径(mm以内)200',  '公称直径(mm以内)250',  '公称直径(mm以内)300',  '公称直径(mm以内)350',  '公称直径(mm以内)400',  '公称直径(mm以内)450',  '公称直径(mm以内)500']
+kqcs=['公称直径(mm以内)50', '公称直径(mm以内)100', '公称直径(mm以内)200', '公称直径(mm以内)300', '公称直径(mm以内)400', '公称直径(mm以内)500', '公称直径(mm以内)600']
+def select_chuisao(
+       B, #data
+       aiclient,
+             qwclient,
+              sfclient,
+             dw):
+    options=[]
+    letters = "ABCDEFGHIJKLMNOPQR"
+    for i in range(len(kqcs)):
+        options.append("给定选项" + letters[i]+",内容为"+kqcs[i] )
+
+    completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        #model="THUDM/GLM-Z1-9B-0414",
+        #model="ernie-speed-128k",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+            {"role": "user", "content": "背景知识:管道规格D273*8表示管径273mm,壁厚8mm"},
+            {"role": "user", "content": "问题描述: 给定一段工作内容: " + B['label'] + " " +  B['mc'] + " " + B['tz'] +  ",".join(options) + "。请选择最合适的选项,并返回字母代号,例如,返回 A"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": True},
+        #stream=True
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    if len([x for x in json_string if x != ',' and x != '[' and x != ']' and x != ' ' and (x < 'A' or x > 'R')]) < 5:
+        answer=[]
+        if 'A' in json_string and len(kqcs) > 0:
+            answer.append('A')
+        if 'B' in json_string and len(kqcs) > 1:
+            answer.append('B')
+        if 'C' in json_string and len(kqcs) > 2:
+            answer.append('C')
+        if 'D' in json_string and len(kqcs) > 3:
+            answer.append('D')
+        if 'E' in json_string and len(kqcs) > 4:
+            answer.append('E')
+        if 'F' in json_string and len(kqcs) > 5:
+            answer.append('F')
+        if 'G' in json_string and len(kqcs) > 6:
+            answer.append('G')
+        return answer
+    completion = sfclient.chat.completions.create(
+        #model="glm-4.5-flash",
+        model=simplemodel(),
+        messages=xuanxiang(json_string),
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": False},
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    answer=[]
+    if 'A' in json_string and len(kqcs) > 0:
+        answer.append('A')
+    if 'B' in json_string and len(kqcs) > 1:
+        answer.append('B')
+    if 'C' in json_string and len(kqcs) > 2:
+        answer.append('C')
+    if 'D' in json_string and len(kqcs) > 3:
+        answer.append('D')
+    if 'E' in json_string and len(kqcs) > 4:
+        answer.append('E')
+    if 'F' in json_string and len(kqcs) > 5:
+        answer.append('F')
+    if 'G' in json_string and len(kqcs) > 6:
+        answer.append('G')
+    
+    return answer
+def youqi(
+       B, #data
+       aiclient,
+             qwclient,
+              sfclient,
+             dw):
+
+    completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        #model="THUDM/GLM-Z1-9B-0414",
+        #model="ernie-speed-128k",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+            {"role": "user", "content": "问题描述: 给定一段工作内容: " + B['label'] + " " +  B['mc'] + " " + B['tz'] +  '\n请问,工作内容是否要求管道刷油漆?请回答是或者否'},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": True},
+        #stream=True
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    if '否' in json_string:
+        return False
+    return True
+def kongqichuisao(
+       B, #data
+       aiclient,
+             qwclient,
+              sfclient,
+             dw):
+    options=[]
+    letters = "ABCDEFG"
+    for i in range(len(kqcs)):
+        options.append("给定选项" + letters[i]+",内容为"+kqcs[i] )
+
+    completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        #model="THUDM/GLM-Z1-9B-0414",
+        #model="ernie-speed-128k",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+            {"role": "user", "content": "背景知识:管道规格D273*8表示管径273mm,壁厚8mm"},
+            {"role": "user", "content": "问题描述: 给定一段工作内容: " + B['label'] + " " +  B['mc'] + " " + B['tz'] +  '\n请问,工作内容是否要求空气吹扫?请回答是或者否'},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": True},
+        #stream=True
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    if '否' in json_string:
+        return False
+    return True
+def select_zhijing(
+       B, #data
+       aiclient,
+             qwclient,
+              sfclient,
+             dw):
+    options=[]
+    letters = "ABCDEFGHIJKLMNOPQR"
+    for i in range(len(zhijing)):
+        options.append("给定选项" + letters[i]+",内容为"+zhijing[i] )
+
+    completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        #model="THUDM/GLM-Z1-9B-0414",
+        #model="ernie-speed-128k",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+            {"role": "user", "content": "背景知识:管道规格D273*8表示管径273mm,壁厚8mm"},
+            {"role": "user", "content": "问题描述: 给定一段工作内容: " + B['label'] + " " +  B['mc'] + " " + B['tz'] +  ",".join(options) + "。请选择最合适的选项,并返回字母代号,例如,返回 A"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": True},
+        #stream=True
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    if len([x for x in json_string if x != ',' and x != '[' and x != ']' and x != ' ' and (x < 'A' or x > 'R')]) < 5:
+        answer=[]
+        if 'A' in json_string and len(zhijing) > 0:
+            answer.append('A')
+        if 'B' in json_string and len(zhijing) > 1:
+            answer.append('B')
+        if 'C' in json_string and len(zhijing) > 2:
+            answer.append('C')
+        if 'D' in json_string and len(zhijing) > 3:
+            answer.append('D')
+        if 'E' in json_string and len(zhijing) > 4:
+            answer.append('E')
+        if 'F' in json_string and len(zhijing) > 5:
+            answer.append('F')
+        if 'G' in json_string and len(zhijing) > 6:
+            answer.append('G')
+        if 'H' in json_string and len(zhijing) > 7:
+            answer.append('H')
+        if 'I' in json_string and len(zhijing) > 8:
+            answer.append('I')
+        if 'J' in json_string and len(zhijing) > 9:
+            answer.append('J')
+        if 'K' in json_string and len(zhijing) > 10:
+            answer.append('K')
+        if 'L' in json_string and len(zhijing) > 11:
+            answer.append('L')
+        if 'M' in json_string and len(zhijing) > 12:
+            answer.append('M')
+        if 'N' in json_string and len(zhijing) > 13:
+            answer.append('N')
+        if 'O' in json_string and len(zhijing) > 14:
+            answer.append('O')
+        if 'P' in json_string and len(zhijing) > 15:
+            answer.append('P')
+        if 'Q' in json_string and len(zhijing) > 16:
+            answer.append('Q')
+        if 'R' in json_string and len(zhijing) > 17:
+            answer.append('R')
+        return answer
+    completion = sfclient.chat.completions.create(
+        #model="glm-4.5-flash",
+        model=simplemodel(),
+        messages=xuanxiang(json_string),
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": False},
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    answer=[]
+    if 'A' in json_string and len(zhijing) > 0:
+        answer.append('A')
+    if 'B' in json_string and len(zhijing) > 1:
+        answer.append('B')
+    if 'C' in json_string and len(zhijing) > 2:
+        answer.append('C')
+    if 'D' in json_string and len(zhijing) > 3:
+        answer.append('D')
+    if 'E' in json_string and len(zhijing) > 4:
+        answer.append('E')
+    if 'F' in json_string and len(zhijing) > 5:
+        answer.append('F')
+    if 'G' in json_string and len(zhijing) > 6:
+        answer.append('G')
+    if 'H' in json_string and len(zhijing) > 7:
+        answer.append('H')
+    if 'I' in json_string and len(zhijing) > 8:
+        answer.append('I')
+    if 'J' in json_string and len(zhijing) > 9:
+        answer.append('J')
+    if 'K' in json_string and len(zhijing) > 10:
+        answer.append('K')
+    if 'L' in json_string and len(zhijing) > 11:
+        answer.append('L')
+    if 'M' in json_string and len(zhijing) > 12:
+        answer.append('M')
+    if 'N' in json_string and len(zhijing) > 13:
+        answer.append('N')
+    if 'O' in json_string and len(zhijing) > 14:
+        answer.append('O')
+    if 'P' in json_string and len(zhijing) > 15:
+        answer.append('P')
+    if 'Q' in json_string and len(zhijing) > 16:
+        answer.append('Q')
+    if 'R' in json_string and len(zhijing) > 17:
+        answer.append('R')
+    
+    return answer
+def aifilter1(A, #options
+       B, #data
+       aiclient,
+             qwclient,
+              sfclient,
+             dw):
+    options=[]
+    letters = "ABCDEFGHIJKLMN"
+    for i in range(len(A)):
+        options.append("给定选项" + letters[i]+",内容为"+A[i] )
+
+    completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        #model="THUDM/GLM-Z1-9B-0414",
+        #model="ernie-speed-128k",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+            {"role": "user", "content": " 特殊处理要求一:如果工作内容描述没有提及管道冲洗,则去掉所有管道冲洗的选项"},
+            {"role": "user", "content": " 重要提示:选项指的是给定的A、B、C之类的选项,不是指的工作内容中的可能的1、2、3这样罗列的特征"},
+            {"role": "user", "content": " 重要提示:除特殊处理要求提及的内容外,不需考虑选项内容与工作内容是否符合,只需要根据特殊处理要求做出处理"},
+            {"role": "user", "content": "问题描述: 给定一段工作内容: " + B['label'] + " " +  B['mc'] + " " + B['tz'] +  ",".join(options) + "。请根据处理要求做出处理,并返回结果, 删除选项必须对应到明确的特殊处理要求,不要擅自删除选项。例如,如果处理完后剩余A,B,C三个选项,请返回[A,B,C]"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": True},
+        #stream=True
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    if len([x for x in json_string if x != ',' and x != '[' and x != ']' and x != ' ' and (x < 'A' or x > 'M')]) < 5:
+        answer=[]
+        if 'A' in json_string and len(A) > 0:
+            answer.append(A[0])
+        if 'B' in json_string and len(A) > 1:
+            answer.append(A[1])
+        if 'C' in json_string and len(A) > 2:
+            answer.append(A[2])
+        if 'D' in json_string and len(A) > 3:
+            answer.append(A[3])
+        if 'E' in json_string and len(A) > 4:
+            answer.append(A[4])
+        if 'F' in json_string and len(A) > 5:
+            answer.append(A[5])
+        if 'G' in json_string and len(A) > 6:
+            answer.append(A[6])
+        if 'H' in json_string and len(A) > 7:
+            answer.append(A[7])
+        if 'I' in json_string and len(A) > 8:
+            answer.append(A[8])
+        if 'J' in json_string and len(A) > 9:
+            answer.append(A[9])
+        return answer
+    completion = sfclient.chat.completions.create(
+        #model="glm-4.5-flash",
+        model=simplemodel(),
+        messages=xuanxiang(json_string),
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": False},
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    answer=[]
+    if 'A' in json_string and len(A) > 0:
+        answer.append(A[0])
+    if 'B' in json_string and len(A) > 1:
+        answer.append(A[1])
+    if 'C' in json_string and len(A) > 2:
+        answer.append(A[2])
+    if 'D' in json_string and len(A) > 3:
+        answer.append(A[3])
+    if 'E' in json_string and len(A) > 4:
+        answer.append(A[4])
+    if 'F' in json_string and len(A) > 5:
+        answer.append(A[5])
+    if 'G' in json_string and len(A) > 6:
+        answer.append(A[6])
+    if 'H' in json_string and len(A) > 7:
+        answer.append(A[7])
+    if 'I' in json_string and len(A) > 8:
+        answer.append(A[8])
+    if 'J' in json_string and len(A) > 9:
+        answer.append(A[9])
+    return answer
+
+def postprocess0308(selected, data, aiclient, qwclient, sfclient, label_name, name_dw, candidates):
+    prime = selected
+    if len([x for x in selected if ' 低压碳钢管(电弧焊)' in x]) > 0:
+        prime = [x for x in prime if ' 低压碳钢管(电弧焊)' not in x]
+        option = select_zhijing(data, aiclient, qwclient, sfclient, name_dw)
+        if 'A' in option:
+            prime.append('第八册 工业管道工程 第一章 管道安装 1.1 低压管道 1.1.5 碳钢管(电弧焊) 低压碳钢管(电弧焊) 公称直径(mm以内) 15')
+        elif 'B' in option:
+            prime.append('第八册 工业管道工程 第一章 管道安装 1.1 低压管道 1.1.5 碳钢管(电弧焊) 低压碳钢管(电弧焊) 公称直径(mm以内) 20')
+        elif 'C' in option:
+            prime.append('第八册 工业管道工程 第一章 管道安装 1.1 低压管道 1.1.5 碳钢管(电弧焊) 低压碳钢管(电弧焊) 公称直径(mm以内) 25')
+        elif 'D' in option:
+            prime.append('第八册 工业管道工程 第一章 管道安装 1.1 低压管道 1.1.5 碳钢管(电弧焊) 低压碳钢管(电弧焊) 公称直径(mm以内) 32')
+        elif 'E' in option:
+            prime.append('第八册 工业管道工程 第一章 管道安装 1.1 低压管道 1.1.5 碳钢管(电弧焊) 低压碳钢管(电弧焊) 公称直径(mm以内) 40')
+        elif 'F' in option:
+            prime.append('第八册 工业管道工程 第一章 管道安装 1.1 低压管道 1.1.5 碳钢管(电弧焊) 低压碳钢管(电弧焊) 公称直径(mm以内) 50')
+        elif 'G' in option:
+            prime.append('第八册 工业管道工程 第一章 管道安装 1.1 低压管道 1.1.5 碳钢管(电弧焊) 低压碳钢管(电弧焊) 公称直径(mm以内) 65')
+        elif 'H' in option:
+            prime.append('第八册 工业管道工程 第一章 管道安装 1.1 低压管道 1.1.5 碳钢管(电弧焊) 低压碳钢管(电弧焊) 公称直径(mm以内) 80')
+        elif 'I' in option:
+            prime.append('第八册 工业管道工程 第一章 管道安装 1.1 低压管道 1.1.5 碳钢管(电弧焊) 低压碳钢管(电弧焊) 公称直径(mm以内) 100')
+        elif 'J' in option:
+            prime.append('第八册 工业管道工程 第一章 管道安装 1.1 低压管道 1.1.5 碳钢管(电弧焊) 低压碳钢管(电弧焊) 公称直径(mm以内) 125')
+        elif 'K' in option:
+            prime.append('第八册 工业管道工程 第一章 管道安装 1.1 低压管道 1.1.5 碳钢管(电弧焊) 低压碳钢管(电弧焊) 公称直径(mm以内) 150')
+        elif 'L' in option:
+            prime.append('第八册 工业管道工程 第一章 管道安装 1.1 低压管道 1.1.5 碳钢管(电弧焊) 低压碳钢管(电弧焊) 公称直径(mm以内) 200')
+        elif 'M' in option:
+            prime.append('第八册 工业管道工程 第一章 管道安装 1.1 低压管道 1.1.5 碳钢管(电弧焊) 低压碳钢管(电弧焊) 公称直径(mm以内) 250')
+        elif 'N' in option:
+            prime.append('第八册 工业管道工程 第一章 管道安装 1.1 低压管道 1.1.5 碳钢管(电弧焊) 低压碳钢管(电弧焊) 公称直径(mm以内) 300')
+        elif 'O' in option:
+            prime.append('第八册 工业管道工程 第一章 管道安装 1.1 低压管道 1.1.5 碳钢管(电弧焊) 低压碳钢管(电弧焊) 公称直径(mm以内) 350')
+        elif 'P' in option:
+            prime.append('第八册 工业管道工程 第一章 管道安装 1.1 低压管道 1.1.5 碳钢管(电弧焊) 低压碳钢管(电弧焊) 公称直径(mm以内) 400')
+        elif 'Q' in option:
+            prime.append('第八册 工业管道工程 第一章 管道安装 1.1 低压管道 1.1.5 碳钢管(电弧焊) 低压碳钢管(电弧焊) 公称直径(mm以内) 450')
+        elif 'R' in option:
+            prime.append('第八册 工业管道工程 第一章 管道安装 1.1 低压管道 1.1.5 碳钢管(电弧焊) 低压碳钢管(电弧焊) 公称直径(mm以内) 500')
+
+    if data['bianma'].startswith('030801'):
+        prime = [x for x in prime if '管件' not in x]
+    if kongqichuisao(data, aiclient, qwclient, sfclient, name_dw):
+        prime = [x for x in prime if '空气吹扫' not in x]
+        t = select_chuisao(data, aiclient, qwclient, sfclient, name_dw)
+        if 'A' in t:
+            prime.append('第八册 工业管道工程 第六章 管道压力试验、吹扫与清洗 6.2 管道系统吹扫 6.2.2 空气吹扫 管道系统空气吹扫 公称直径(mm以内) 50')
+        elif 'B' in t:
+            prime.append('第八册 工业管道工程 第六章 管道压力试验、吹扫与清洗 6.2 管道系统吹扫 6.2.2 空气吹扫 管道系统空气吹扫 公称直径(mm以内) 100')
+        elif 'C' in t:
+            prime.append('第八册 工业管道工程 第六章 管道压力试验、吹扫与清洗 6.2 管道系统吹扫 6.2.2 空气吹扫 管道系统空气吹扫 公称直径(mm以内) 200')
+        elif 'D' in t:
+            prime.append('第八册 工业管道工程 第六章 管道压力试验、吹扫与清洗 6.2 管道系统吹扫 6.2.2 空气吹扫 管道系统空气吹扫 公称直径(mm以内) 300')
+        elif 'E' in t:
+            prime.append('第八册 工业管道工程 第六章 管道压力试验、吹扫与清洗 6.2 管道系统吹扫 6.2.2 空气吹扫 管道系统空气吹扫 公称直径(mm以内) 400')
+        elif 'F' in t:
+            prime.append('第八册 工业管道工程 第六章 管道压力试验、吹扫与清洗 6.2 管道系统吹扫 6.2.2 空气吹扫 管道系统空气吹扫 公称直径(mm以内) 500')
+        elif 'G' in t:
+            prime.append('第八册 工业管道工程 第六章 管道压力试验、吹扫与清洗 6.2 管道系统吹扫 6.2.2 空气吹扫 管道系统空气吹扫 公称直径(mm以内) 600')
+
+    
+    else:
+        prime = [x for x in prime if '空气吹扫' not in x]
+    if youqi(data, aiclient, qwclient, sfclient, name_dw):
+        prime = prime + ['第十一册 刷油、防腐蚀、绝热工程 第二章 刷油工程 2.1 管道刷油 管道刷油 防锈漆 第一遍', '第十一册 刷油、防腐蚀、绝热工程 第二章 刷油工程 2.1 管道刷油 管道刷油 防锈漆 第二遍', '第十一册 刷油、防腐蚀、绝热工程 第二章 刷油工程 2.1 管道刷油 管道刷油 调和漆 第一遍', '第十一册 刷油、防腐蚀、绝热工程 第二章 刷油工程 2.1 管道刷油 管道刷油 调和漆 第二遍']
+    return list(set(prime))

+ 160 - 0
postprocess0310.py

@@ -0,0 +1,160 @@
+import time
+from fallback import fallback
+from config import simplemodel
+from template import xuanxiang
+from fallback import fallback
+zhijing=['公称直径(mm以内)50', '公称直径(mm以内)80', '公称直径(mm以内)100', '公称直径(mm以内)150' , '公称直径(mm以内)200', '公称直径(mm以内)250', '公称直径(mm以内)300']
+def select_zhijing(
+       B, #data
+       aiclient,
+             qwclient,
+              sfclient,
+             dw):
+    options=[]
+    letters = "ABCDEFGHIJKLMN"
+    for i in range(len(zhijing)):
+        options.append("给定选项" + letters[i]+",内容为"+zhijing[i] )
+
+    completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        #model="THUDM/GLM-Z1-9B-0414",
+        #model="ernie-speed-128k",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+            {"role": "user", "content": "问题描述: 给定一段工作内容: " + B['label'] + " " +  B['mc'] + " " + B['tz'] +  ",".join(options) + "。请选择最合适的选项,并返回字母代号,例如,返回 A"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": True},
+        #stream=True
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    if len([x for x in json_string if x != ',' and x != '[' and x != ']' and x != ' ' and (x < 'A' or x > 'M')]) < 5:
+        answer=[]
+        if 'A' in json_string and len(zhijing) > 0:
+            answer.append('A')
+        if 'B' in json_string and len(zhijing) > 1:
+            answer.append('B')
+        if 'C' in json_string and len(zhijing) > 2:
+            answer.append('C')
+        if 'D' in json_string and len(zhijing) > 3:
+            answer.append('D')
+        if 'E' in json_string and len(zhijing) > 4:
+            answer.append('E')
+        if 'F' in json_string and len(zhijing) > 5:
+            answer.append('F')
+        if 'G' in json_string and len(zhijing) > 6:
+            answer.append('G')
+        return answer
+    completion = sfclient.chat.completions.create(
+        #model="glm-4.5-flash",
+        model=simplemodel(),
+        messages=xuanxiang(json_string),
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": False},
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    answer=[]
+    if 'A' in json_string and len(zhijing) > 0:
+        answer.append('A')
+    if 'B' in json_string and len(zhijing) > 1:
+        answer.append('B')
+    if 'C' in json_string and len(zhijing) > 2:
+        answer.append('C')
+    if 'D' in json_string and len(zhijing) > 3:
+        answer.append('D')
+    if 'E' in json_string and len(zhijing) > 4:
+        answer.append('E')
+    if 'F' in json_string and len(zhijing) > 5:
+        answer.append('F')
+    if 'G' in json_string and len(zhijing) > 6:
+        answer.append('G')
+    
+    return answer
+def aifilter1(A, #options
+       B, #data
+       aiclient,
+             qwclient,
+              sfclient,
+             dw):
+    options=[]
+    letters = "ABCDEFGHIJKLMN"
+    for i in range(len(A)):
+        options.append("给定选项" + letters[i]+",内容为"+A[i] )
+
+    completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        #model="THUDM/GLM-Z1-9B-0414",
+        #model="ernie-speed-128k",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+            {"role": "user", "content": " 特殊处理要求一:如果工作内容描述没有提及管道冲洗,则去掉所有管道冲洗的选项"},
+            {"role": "user", "content": " 重要提示:选项指的是给定的A、B、C之类的选项,不是指的工作内容中的可能的1、2、3这样罗列的特征"},
+            {"role": "user", "content": " 重要提示:除特殊处理要求提及的内容外,不需考虑选项内容与工作内容是否符合,只需要根据特殊处理要求做出处理"},
+            {"role": "user", "content": "问题描述: 给定一段工作内容: " + B['label'] + " " +  B['mc'] + " " + B['tz'] +  ",".join(options) + "。请根据处理要求做出处理,并返回结果, 删除选项必须对应到明确的特殊处理要求,不要擅自删除选项。例如,如果处理完后剩余A,B,C三个选项,请返回[A,B,C]"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": True},
+        #stream=True
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    if len([x for x in json_string if x != ',' and x != '[' and x != ']' and x != ' ' and (x < 'A' or x > 'M')]) < 5:
+        answer=[]
+        if 'A' in json_string and len(A) > 0:
+            answer.append(A[0])
+        if 'B' in json_string and len(A) > 1:
+            answer.append(A[1])
+        if 'C' in json_string and len(A) > 2:
+            answer.append(A[2])
+        if 'D' in json_string and len(A) > 3:
+            answer.append(A[3])
+        if 'E' in json_string and len(A) > 4:
+            answer.append(A[4])
+        if 'F' in json_string and len(A) > 5:
+            answer.append(A[5])
+        if 'G' in json_string and len(A) > 6:
+            answer.append(A[6])
+        if 'H' in json_string and len(A) > 7:
+            answer.append(A[7])
+        if 'I' in json_string and len(A) > 8:
+            answer.append(A[8])
+        if 'J' in json_string and len(A) > 9:
+            answer.append(A[9])
+        return answer
+    completion = sfclient.chat.completions.create(
+        #model="glm-4.5-flash",
+        model=simplemodel(),
+        messages=xuanxiang(json_string),
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": False},
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    answer=[]
+    if 'A' in json_string and len(A) > 0:
+        answer.append(A[0])
+    if 'B' in json_string and len(A) > 1:
+        answer.append(A[1])
+    if 'C' in json_string and len(A) > 2:
+        answer.append(A[2])
+    if 'D' in json_string and len(A) > 3:
+        answer.append(A[3])
+    if 'E' in json_string and len(A) > 4:
+        answer.append(A[4])
+    if 'F' in json_string and len(A) > 5:
+        answer.append(A[5])
+    if 'G' in json_string and len(A) > 6:
+        answer.append(A[6])
+    if 'H' in json_string and len(A) > 7:
+        answer.append(A[7])
+    if 'I' in json_string and len(A) > 8:
+        answer.append(A[8])
+    if 'J' in json_string and len(A) > 9:
+        answer.append(A[9])
+    return answer
+
+def postprocess0310(selected, data, aiclient, qwclient, sfclient, label_name, name_dw, candidates):
+    prime = aifilter1(selected, data, aiclient, qwclient, sfclient, name_dw)
+    return prime

+ 129 - 5
tasks.py

@@ -1,5 +1,7 @@
 import time
 from tihuan import tihuan
+from tihuan_az import tihuan_az
+from buchong import buchong
 from fuzhu_util import fuzhu_util
 from f_youqi import f_youqi
 import re
@@ -30,7 +32,7 @@ azmodel = FlagModel('/mnt/d/Develop/az/az_encoder_only_base_bge-large-zh-v1.5')
 model = None # FlagModel('/mnt/d/Develop/az/az_encoder_only_base_bge-large-zh-v1.5')
 cuoshi_model = None  #FlagModel('cuoshi_encoder_only_base_bge-large-zh-v1.5/cuoshi_encoder_only_base_bge-large-zh-v1.5')
 from sentence_transformers import CrossEncoder
-azce = CrossEncoder('/mnt/d/Develop/az/models/reranker-chinese-macbert-large-gooaq-bce-3/final')
+azce = CrossEncoder('/mnt/d/Develop/az/models/reranker-chinese-macbert-large-gooaq-bce-4/final')
 ce = None #CrossEncoder('/mnt/d/Develop/az/models/reranker-chinese-macbert-large-gooaq-bce/final')
 cuoshi_ce = None #CrossEncoder('cuoshi_reranker/final')
 with open("hunningtu_rule", "r") as f:
@@ -413,7 +415,7 @@ def zuhe(input, content, bianma):
 def huansuan_highlevel(bianma, label, input,dw, tz):
     time.sleep(1)
     t = huansuan(input, dw, label)
-    if t == 0:
+    if t == 0 or bianma.startswith('030901013'):## 灭火器
         dw1 = input
         dw1 = dw1.lower()
         dw1 = dw1.replace("水平投影面积", "")
@@ -492,6 +494,20 @@ def huansuan(input, dw, label):
         return 1
     if dw1 == '个' and dw2 == '10套':
         return 0.1
+    if dw1 == '个' and dw2 == '台':
+        return 1
+    if dw1 == '个' and dw2 == '10台':
+        return 0.1
+    if dw1 == '台' and dw2 == '个':
+        return 1
+    if dw1 == '台' and dw2 == '10个':
+        return 0.1
+    if dw1 == '台' and dw2 == '套':
+        return 1
+    if dw1 == '台' and dw2 == '10套':
+        return 0.1
+    if dw1 == '组' and dw2 == '10组':
+        return 0.1
     if dw1 == 'm' and dw2 == '100m单线':
         return 0.01
 
@@ -616,7 +632,9 @@ def clarify(data):
         data['mc']=data['mc'].replace('线条','檐沟')
         data['tz']=data['tz'].replace('线条','檐沟')
         return data, False
-
+    elif data['bianma'].startswith('0308'):
+        data['tz'] = data['tz'].replace('增强柔性石墨板', '增强柔性石墨板制作三通补强圈')
+        return data, False
     else:
         return data, False
 
@@ -636,6 +654,14 @@ def process_data(data:dict)-> dict:
         embeddings = model.encode(sentences)
     if data['bianma'].startswith("0117"):
         result = cuoshi_collection.query(query_embeddings=embeddings,n_results=25)      
+    elif data['bianma'].startswith('030810'):
+        result = azcollection.query(query_embeddings=embeddings, n_results=10, where_document={"$contains": "低压法兰"})      
+    elif data['bianma'].startswith('030412'):
+        result = azcollection.query(query_embeddings=embeddings, n_results=10, where_document={"$contains": "照明器具"})      
+    elif data['bianma'].startswith('030108'):
+        result = azcollection.query(query_embeddings=embeddings, n_results=10, where_document={"$contains": "第一册"})      
+    elif data['bianma'].startswith('030502007') or data['bianma'].startswith('030502008'):
+        result = azcollection.query(query_embeddings=embeddings, n_results=10, where_document={"$contains": "布放光缆"})      
     elif data['bianma'].startswith('03'):
         result = azcollection.query(query_embeddings=embeddings,n_results=25)      
     else:
@@ -791,6 +817,97 @@ def process_data(data:dict)-> dict:
             cutoff = score - 0.01
             if cutoff < 0.3:
                 cutoff = 0.3
+    #if data['bianma'].startswith('030408001'):##电力电缆
+    #    score = -1
+    #    for rank in ranks:
+    #        if '电缆' in d[rank['corpus_id']]:
+    #            score = rank['score']
+    #            break
+    #    if score > -1 and score < cutoff:
+    #        cutoff = score - 0.01
+    #        if cutoff < 0.3:
+    #            cutoff = 0.3
+    if data['bianma'].startswith('030408006'):##电力电缆头
+        score = -1
+        for rank in ranks:
+            if '电缆头' in d[rank['corpus_id']]:
+                score = rank['score']
+                break
+        if score > -1 and score < cutoff:
+            cutoff = score - 0.01
+            if cutoff < 0.3:
+                cutoff = 0.3
+            ranks = [x for x in ranks if '电缆头' in d[x['corpus_id']]]
+    #if data['bianma'].startswith('030108'):##风机安装
+    #    score = -1
+    #    for rank in ranks:
+    #        if '风机' in d[rank['corpus_id']]:
+    #            score = rank['score']
+    #            break
+    #    if score > -1 and score < cutoff:
+    #        cutoff = score - 0.01
+    #        if cutoff < 0.3:
+    #            cutoff = 0.3
+    #if data['bianma'].startswith('030411'):##配管
+    #    score = -1
+    #    for rank in ranks:
+    #        if '第四册' in d[rank['corpus_id']]:
+    #            score = rank['score']
+    #            break
+    #    if score > -1 and score < cutoff:
+    #        cutoff = score - 0.01
+    #        if cutoff < 0.3:
+    #            cutoff = 0.3
+    #if data['bianma'].startswith('031001006'):##水管
+    #    score = -1
+    #    for rank in ranks:
+    #        if '水管' in d[rank['corpus_id']]:
+    #            score = rank['score']
+    #            break
+    #    if score > -1 and score < cutoff:
+    #        cutoff = score - 0.01
+    #        if cutoff < 0.3:
+    #            cutoff = 0.3
+    #if data['bianma'].startswith('030502007') or data['bianma'].startswith('030502008'):##光缆
+    #    score = -1
+    #    for rank in ranks:
+    #        if '敷设光缆' in d[rank['corpus_id']]:
+    #            score = rank['score']
+    #            break
+    #    if score > -1 and score < cutoff:
+    #        cutoff = score - 0.01
+    #        if cutoff < 0.3:
+    #            cutoff = 0.3
+    #if data['bianma'].startswith('030801'):##低压管道
+    #    score = -1
+    #    for rank in ranks:
+    #        if '低压管道' in d[rank['corpus_id']]:
+    #            score = rank['score']
+    #            break
+    #    if score > -1 and score < cutoff:
+    #        cutoff = score - 0.01
+    #        if cutoff < 0.3:
+    #            cutoff = 0.3
+    #if data['bianma'].startswith('030804'):##低压管件 
+    #    score = -1
+    #    for rank in ranks:
+    #        if '低压管件' in d[rank['corpus_id']]:
+    #            score = rank['score']
+    #            break
+    #    if score > -1 and score < cutoff:
+    #        cutoff = score - 0.01
+    #        if cutoff < 0.3:
+    #            cutoff = 0.3
+    #if '三通补强圈' in data['tz']:##三通补强圈
+    #    score = -1
+    #    for rank in ranks:
+    #        if '三通补强圈' in d[rank['corpus_id']]:
+    #            score = rank['score']
+    #            break
+    #    if score > -1 and score < cutoff:
+    #        cutoff = score - 0.01
+    #        if cutoff < 0.3:
+    #            cutoff = 0.3
     print("cutoff=" + str(cutoff))
     for entry in incremental:
         notselected = notselected + incremental[entry]
@@ -841,8 +958,15 @@ def process_data(data:dict)-> dict:
         notselected = [x for x in notselected if x not in selected]
     selected = list(set(selected))
     candidates=[]
+    notselected=[]
     for rank in ranks:
+        if d[rank['corpus_id']] in notselected:
+            continue
         candidates.append(d[rank['corpus_id']])
+        for entry in basic:
+            if d[rank['corpus_id']] in basic[entry]:
+                notselected = notselected + basic[entry]
+        notselected = [x for x in notselected if x not in candidates]
     if len(selected) == 0 and not data['bianma'].startswith('0115'):
         selected = fallback(candidates, data, aiclient, qwclient, simpleclient, menchuang_collection, model)
     selected = postprocess(selected, data, aiclient, qwclient,simpleclient, label_name, name_dw, candidates,yqspecial)
@@ -858,8 +982,8 @@ def process_data(data:dict)-> dict:
         result = [(x[0], x[1], dedata.read_singledexilie2(10, x[0])) for x in result]
         result = [(x[0], x[1], x[2], tihuan(x[0], x[2], label, aiclient, qwclient, simpleclient, data)) for x in result]
     else:
-        result = [(x[0], x[1], dedata.read_singledexilie2(30, x[0])) for x in result]
-        result = [(x[0], x[1], x[2], []) for x in result]
+        result = [(x[0], x[1], buchong(aiclient, dedata.read_singledexilie2(30, x[0]), x[0], data['tz'])) for x in result]
+        result = [(x[0], x[1], x[2], tihuan_az(x[0], x[2], label, aiclient, qwclient, simpleclient, data)) for x in result]
     fuzhu = [analyze(x[2]) for x in result]
     fuzhu = zip(selected, fuzhu)
     fuzhu = [x for x in fuzhu]

+ 499 - 0
tihuan_az.py

@@ -0,0 +1,499 @@
+import json
+from config import simplemodel
+with open('az_name_label', 'r') as f:
+    content = f.read()
+name_label = json.loads(content)
+def tihuan_az(
+       name,
+       dercj,
+       label,
+       aiclient,
+       qwclient,
+       sfclient,
+       data
+       ):
+    result=[]
+    index = name.find('+')
+    if index > -1:
+        name = name[:index]
+    pos=[]
+    for i in range(len(name)):
+        if name[i] == '-':
+            pos.append(i)
+    if len(pos) > 1:
+        name = name[:pos[1]]
+    name_label_ = name_label[name] 
+    rcjobj = json.loads(dercj)
+    clde = rcjobj['clde']
+    for i in range(len(clde)):
+        bh = clde[i]['CLBH']
+        sl = clde[i]['SL']
+        if float(sl) < 1e-6:
+            continue
+        if bh.startswith("26012501"):
+            ##桥架
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出桥架的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、名称:电线电缆桥架(超高)
+                      2、型号:QJ
+                      3、规格:800*200
+                      4、材质:热镀锌
+                      你应该返回 “热镀锌桥架800*200”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("1401"):
+            ##钢管
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出钢管的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、名称:穿线管
+                      2、材质:镀锌钢管
+                      3、规格:SC150
+                      4、配置形式:明配/超高
+                      你应该返回 “镀锌钢管DN150”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("25430311") or bh.startswith('25430314'):
+            ##绝缘导线
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出绝缘导线的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、名称:配线
+                      2、配线形式:管内穿线
+                      3、规格:RS485
+                      4、材质:铜芯
+                      你应该返回 “绝缘导线RS485”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("22470111"):
+            ##灯
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出灯具的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、名称:LED深照型工厂灯
+                      2、型号:SL-T2608-300W
+                      3、规格: 220V 300W
+                      4、安装形式:超高
+                      你应该返回 “LED深照型工厂灯SL-T2608-300W”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("26110101"):
+            ##接线盒
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出接线盒的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、名称:接线盒
+                      2、材质:钢制
+                      3、规格:86型
+                      4、安装形式:明装,超高
+                      你应该返回 “钢制接线盒”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("23412504"):
+            ##插座
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出插座的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、名称:单相二三孔安全插座
+                      2、材质:塑料
+                      3、规格:86Z223-10A
+                      你应该返回 “单相二三孔安全插座86Z223-10A”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("23230131"):
+            ##开关
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出开关的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、名称:三联单控开关
+                      2、材质:塑料
+                      3、规格:86型
+                      你应该返回 “三联单控开关”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("260935"):
+            ##端子箱(板)
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出端子箱、板的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、名称:接地预埋端子板
+                      2、材质:镀锌钢板
+                      3、规格:100*100*10
+                      你应该返回 “接地预埋端子板100*100*10”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("145509"):
+            ##复合管
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出管道的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、安装部位:室内
+                      2、介质:给水
+                      3、材质、规格:涂塑钢管DN20
+                      4、连接形式:丝扣连接
+                      5、压力试验及吹、洗设计要求:吹洗
+                      你应该返回 “涂塑钢管DN20”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("143103"):
+            ##塑料管
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出管道的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、安装部位:室内
+                      2、介质:排水
+                      3、材质、规格:U-PVC110
+                      4、连接形式:粘接
+                      你应该返回 “U-PVC110”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("1631") and '排气阀' not in label:
+            ##阀门
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出阀门的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、类型:截止阀
+                      2、材质:不锈钢
+                      3、规格、压力等级:DN32
+                      4、连接形式:丝接
+                      你应该返回 “不锈钢截止阀DN32”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("1841"):
+            ##水龙头
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出水龙头的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、材质:带真空破坏器组合水龙头
+                      2、型号、规格:DN20
+                      你应该返回 “带真空破坏器组合水龙头DN20”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("1813"):
+            ##洗涤盆
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出洗涤盆(槽)的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、材质:不锈钢水槽
+                      2、规格、类型:1500*500*300
+                      你应该返回 “不锈钢水槽1500*500*300”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("2001"):
+            ##灭火器
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出灭火器的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、形式:手提式灭火器
+                      2、规格、型号:MF/ABC5
+                      3、每套含两具灭火器及配套灭火器箱
+                      你应该返回 “手提式灭火器MF/ABC5”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("261103"):
+            ##接线箱
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出接线箱的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、名称:可燃气体报警控制箱
+                      2、材质:钢制
+                      你应该返回 “可燃气体报警控制箱”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("34130226"):
+            ##机柜
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出机柜的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、名称:能耗计量通讯管理机
+                      2、安装方式:落地
+                      你应该返回 “能耗计量通讯管理机”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("34130264"):
+            ##光缆
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出光缆的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、名称:光纤
+                      2、安装方式:4芯光纤
+                      你应该返回 “4芯光纤”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("151309"):
+            ##管件
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出管件(连接件)的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、材质:室内压缩空气接头箱
+                      2、规格:12接头(配带DN50不锈钢阀门及法兰)
+                      你应该返回 “室内压缩空气接头箱12接头(配带DN50不锈钢阀门及法兰)”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("1625"):
+            ##法兰阀门(水表)
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出法兰阀门(水表)的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、名称:法兰不锈钢蝶阀
+                      2、型号、规格:D341F-16C型 DN250
+                      3、连接形式:法兰连接
+                      你应该返回 “法兰不锈钢蝶阀D341F-16C型 DN250”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("170101"):
+            ##法兰
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出法兰的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、材质:板式平焊钢制管法兰
+                      2、型号、规格:20#-PL250(B)-16
+                      3、连接形式:焊接
+                      你应该返回 “板式平焊钢制管法兰20#-PL250(B)-16”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if '三通补强圈' in name_label_:
+            if bh.startswith('01290'):#钢板
+
+                completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出板材的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、材质:增强柔性石墨板
+                      2、规格:RSB/304,RF200-16
+                      你应该返回 “增强柔性石墨板”
+                      如果没有提及具体板材,请直接回答“钢板”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+            )
+                json_string = completion.choices[0].message.content
+                print(json_string)
+            
+                result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+    return result

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff