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") or bh.startswith('1403')) and '卫生器具' not in name_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、规格: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') or bh.startswith('254305'): ##绝缘导线 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” 再例如,给定文字如下: 1、名称:六类非屏蔽网线 2、规格:CAT6.UTP 3、敷设方式:管内穿线/桥架配线 你应该返回 “六类非屏蔽网线CAT6.UTP” 现在给定文字如下: ''' + 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("5029"): ##通风机、通风器 completion = aiclient.chat.completions.create( model="glm-4.5-air", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出通风机、通风器的具体品种型号等信息。"+''' 例如,给定文字如下: 1、名称:壁式边墙排风机 2、 380V 0.55KW,50KG 3、规格:带防雨消声弯头10*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("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") or bh.startswith('143115'): ##塑料管 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("1639"): ##阀门 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("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") and '龙头' in name_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、型号、规格: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("2109030"): ##水表 completion = aiclient.chat.completions.create( model="glm-4.5-air", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出水表的具体品种型号等信息。"+''' 例如,给定文字如下: 1、安装部位(室内外):水表 2、型号、规格:DN65 3、连接形式:丝接 你应该返回 “水表DN65” 现在给定文字如下: ''' + 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