import json from tihuan_hunningtu import tihuan_hunningtu from tihuan_gangjin import tihuan_gangjin from tihuan_gangcai import tihuan_gangcai from tihuan_shajiang import tihuan_shajiang from tihuan_zhuan import tihuan_zhuan from tihuan_shicai import tihuan_shicai from tihuan_gai import tihuan_gai from tihuan_fangshui import tihuan_fangshui from tihuan_wa import tihuan_wa from tihuan_dizhuan import tihuan_dizhuan from tihuan_juancai import tihuan_juancai from tihuan_bancai import tihuan_bancai from tihuan_mugongban import tihuan_mugongban from config import simplemodel with open("name_label", "r") as f: content = f.read() name_label = json.loads(content) def tihuan( name, dercj, label, aiclient, qwclient, sfclient, data ): result=[] xuanxiang=[] choice=[] letters='ABC' 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]] if name in ['13-26']: return [] description = name_label[name] rcjobj = json.loads(dercj) clde = rcjobj['clde'] hit_zhuan=False hit_kuai=False sj_max = 0 sj_min = 10000 for i in range(len(clde)): bh = clde[i]['CLBH'] sl = clde[i]['SL'] if float(sl) < 1e-6: continue if bh.startswith("0413"): hit_zhuan = True if bh.startswith("0415"): hit_kuai = True if bh.startswith("800") and not bh.startswith('8007'):##砂浆 if sl < 0.01: continue if sl > sj_max: sj_max = sl if sl < sj_min: sj_min = sl for i in range(len(clde)): bh = clde[i]['CLBH'] sl = clde[i]['SL'] if float(sl) < 1e-6: continue if bh in ['80010161']:##块料楼地面 干硬性水泥砂浆 continue if bh.startswith("8021"): ##混凝土 completion = aiclient.chat.completions.create( model="glm-4.5-air", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "以下是一段工作内容的描述: " + label + '\n其中包括了一道工序如下: ' +description + '\n工序使用了混凝土(砼)作为材料之一。请从工作内容中找到与该工序最匹配的描述(注意区分面层跟找平找坡层),并从描述中抽取出混凝土的具体品种型号等信息。例如,如果工作内容的描述中写的是“C40微膨胀混凝土”,那么你应该原封不动的返回“C40微膨胀混凝土”。再例如,如果工作内容中描述混凝土种类商品砼,混凝土强度等级C15,那么你应该返回“C15商品砼”。如果工作内容中没有具体描述混凝土的信息,则返回“通用混凝土”'}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) completion = sfclient.chat.completions.create( model=simplemodel(), messages=[ {"role": "system", "content": "You are a helpful assistant.请将最终答案以JSON格式输出"}, {"role": "user", "content": " 给你一段文字如下, " + json_string + ",其中给出了一种混凝土名称型号作为答案,请将该混凝土名称型号输出"}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) parts = json_string.split('\n') parts = [x for x in parts if ':' in x] if len(parts) == 0: continue parts = parts[0].split(':') part = parts[1] part = part.replace(',','') part = part.replace('\'','') part = part.replace('\"','') part = part.replace(' ','') result.append(tihuan_hunningtu(clde[i]['CLBH'], clde[i]['CLMC'], clde[i]['YSJG'], part)) if bh.startswith("01010100"): ##钢筋 completion = aiclient.chat.completions.create( model="glm-4.5-air", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "以下是一段工作内容的描述: " + label + '\n其中包括了一道工序如下: ' +description + '\n工序使用了钢筋作为材料之一。请从工作内容中找到与该工序最匹配的描述,并从描述中抽取出钢筋的具体品种型号等信息。例如,如果工作内容的描述中写的是“Φ25以内三级钢”,那么你应该原封不动的返回“Φ25以内三级钢”。如果工作内容中没有具体描述钢筋的信息,则返回“通用钢筋”'}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) completion = sfclient.chat.completions.create( model=simplemodel(), messages=[ {"role": "system", "content": "You are a helpful assistant.请将最终答案以JSON格式输出"}, {"role": "user", "content": " 给你一段文字如下, " + json_string + ",其中给出了一种钢筋名称作为答案,请将该钢筋名称输出"}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) parts = json_string.split('\n') parts = [x for x in parts if ':' in x] if len(parts) == 0: continue parts = parts[0].split(':') part = parts[1] part = part.replace(',','') part = part.replace('\'','') part = part.replace('\"','') part = part.replace(' ','') result.append(tihuan_gangjin(clde[i]['CLBH'], clde[i]['CLMC'], clde[i]['YSJG'], part)) if bh.startswith("800") and not bh.startswith('8007'): ##砂浆 if data['bianma'].startswith('0112'): if sl < 0.01: continue if sl >= sj_max:##打底 completion = aiclient.chat.completions.create( model="glm-4.5-air", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "以下是一段工作内容的描述: " + data['tz_bak'] + '\n其中包括了一道工序如下: ' +description + '\n工序使用了砂浆打底(**不**是罩面)。请从工作内容中找到与砂浆打底(**不**是罩面)最匹配的描述,并从抽取的描述中再抽取出砂浆的具体品种型号等信息。例如,如果工作内容的描述中写的是“Mb10水泥砂浆”,那么你应该原封不动的返回“Mb10水泥砂浆”。如果工作内容中没有具体描述砂浆的信息,则返回“通用砂浆”'}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) elif sl <= sj_min:##罩面 completion = aiclient.chat.completions.create( model="glm-4.5-air", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "以下是一段工作内容的描述: " + data['tz_bak'] + '\n其中包括了一道工序如下: ' +description + '\n工序使用了砂浆罩面(**不**是打底)。请从工作内容中找到与砂浆罩面(**不**是打底)最匹配的描述,并从抽取的描述中再抽取出砂浆的具体品种型号等信息。例如,如果工作内容的描述中写的是“Mb10水泥砂浆”,那么你应该原封不动的返回“Mb10水泥砂浆”。如果工作内容中没有具体描述砂浆的信息,则返回“通用砂浆”'}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) else: continue else: completion = aiclient.chat.completions.create( model="glm-4.5-air", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "以下是一段工作内容的描述: " + label + '\n其中包括了一道工序如下: ' +description + '\n工序使用了砂浆作为材料之一。请从工作内容中找到与该工序最匹配的描述(不要从工序文字中抽取描述)(注意区分找平找坡层跟面层保护层),并从抽取的描述中再抽取出砂浆的具体品种型号等信息。例如,如果工作内容的描述中写的是“Mb10水泥砂浆”,那么你应该原封不动的返回“Mb10水泥砂浆”。如果工作内容中没有具体描述砂浆的信息,则返回“通用砂浆”'}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) completion = sfclient.chat.completions.create( model=simplemodel(), messages=[ {"role": "system", "content": "You are a helpful assistant.请将最终答案以JSON格式输出"}, {"role": "user", "content": " 给你一段文字如下, " + json_string + ",其中给出了一种砂浆名称作为答案,请将该砂浆名称输出.必须以json格式输出.请直接输出结果"}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) parts = json_string.split('\n') parts = [x for x in parts if ':' in x] if len(parts) == 0: continue parts = parts[0].split(':') parts = parts[1:] part = ':'.join(parts) part = part.replace(',','') part = part.replace('\'','') part = part.replace('\"','') part = part.replace(' ','') result.append(tihuan_shajiang(clde[i]['CLBH'], clde[i]['CLMC'], clde[i]['YSJG'], part)) if bh.startswith("0413") and not hit_kuai: ##砖 completion = aiclient.chat.completions.create( model="glm-4.5-air", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "以下是一段工作内容的描述: " + label + '\n其中包括了一道工序如下: ' +description + '\n工序使用了砖(砌块)作为材料之一。请从工作内容中找到与该工序最匹配的描述,并从描述中抽取出砖(砌块)的具体品种型号等信息。例如,如果工作内容的描述中写的是“MU20蒸压灰砂砖”,那么你应该原封不动的返回“MU20蒸压灰砂砖”。如果工作内容中没有具体描述砖(砌块)的信息,则返回“通用砖”'}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) completion = sfclient.chat.completions.create( model=simplemodel(), messages=[ {"role": "system", "content": "You are a helpful assistant.请将最终答案以JSON格式输出"}, {"role": "user", "content": " 给你一段文字如下, " + json_string + ",其中给出了一种砖(砌块)名称作为答案,请将该砖(砌块)名称输出"}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) parts = json_string.split('\n') parts = [x for x in parts if ':' in x] if len(parts) == 0: continue parts = parts[0].split(':') part = parts[1] part = part.replace(',','') part = part.replace('\'','') part = part.replace('\"','') part = part.replace(' ','') result.append(tihuan_zhuan(clde[i]['CLBH'], clde[i]['CLMC'], clde[i]['YSJG'], part)) if bh.startswith("0415"): ##砌块 completion = aiclient.chat.completions.create( model="glm-4.5-air", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "以下是一段工作内容的描述: " + label + '\n其中包括了一道工序如下: ' +description + '\n工序使用了砖(砌块)作为材料之一。请从工作内容中找到与该工序最匹配的描述,并从描述中抽取出砖(砌块)的具体品种型号等信息。例如,如果工作内容的描述中写的是“MU20蒸压灰砂砖”,那么你应该原封不动的返回“MU20蒸压灰砂砖”。如果工作内容中没有具体描述砖(砌块)的信息,则返回“通用砖”'}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) completion = sfclient.chat.completions.create( model=simplemodel(), messages=[ {"role": "system", "content": "You are a helpful assistant.请将最终答案以JSON格式输出"}, {"role": "user", "content": " 给你一段文字如下, " + json_string + ",其中给出了一种砖(砌块)名称作为答案,请将该砖(砌块)名称输出"}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) parts = json_string.split('\n') parts = [x for x in parts if ':' in x] if len(parts) == 0: continue parts = parts[0].split(':') part = parts[1] part = part.replace(',','') part = part.replace('\'','') part = part.replace('\"','') part = part.replace(' ','') result.append(tihuan_zhuan(clde[i]['CLBH'], clde[i]['CLMC'], clde[i]['YSJG'], part)) if bh.startswith("0711213"): ##石材块料 completion = aiclient.chat.completions.create( model="glm-4.5-air", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "以下是一段工作内容的描述: " + label + '\n其中包括了一道工序如下: ' +description + '\n工序使用了石材块料、砖作为材料之一。请从工作内容中找到与该工序最匹配的描述,并从描述中抽取出石材块料、砖的具体品种型号等信息。例如,如果工作内容的描述中写的是“30厚600X600芝麻黑火烧面花岗岩”,那么你应该原封不动的返回“30厚600X600芝麻黑火烧面花岗岩”。如果工作内容中没有具体描述石材块料、砖的信息,则返回“通用石材块料”'}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) completion = sfclient.chat.completions.create( model=simplemodel(), messages=[ {"role": "system", "content": "You are a helpful assistant.请将最终答案以JSON格式输出"}, {"role": "user", "content": " 给你一段文字如下, " + json_string + ",其中给出了一种石材块料、砖名称作为答案,请将该石材块料、砖名称输出"}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) parts = json_string.split('\n') parts = [x for x in parts if ':' in x] if len(parts) == 0: continue parts = parts[0].split(':') part = parts[1] part = part.replace(',','') part = part.replace('\'','') part = part.replace('\"','') part = part.replace(' ','') result.append(tihuan_shicai(clde[i]['CLBH'], clde[i]['CLMC'], clde[i]['YSJG'], part)) if bh.startswith("3301"): ##盖板 completion = aiclient.chat.completions.create( model="glm-4.5-air", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "以下是一段工作内容的描述: " + label + '\n其中包括了一道工序如下: ' +description + '\n工序使用了盖板(篦子)作为材料之一。请从工作内容中找到与该工序最匹配的描述,并从描述中抽取出盖板(篦子)的具体品种型号等信息。例如,如果工作内容的描述中写的是“Φ1000带锁圆形钢盖板”,那么你应该原封不动的返回“Φ1000带锁圆形钢盖板”。如果工作内容中没有具体描述盖板(篦子)的信息,则返回“通用盖板”'}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) completion = sfclient.chat.completions.create( model=simplemodel(), messages=[ {"role": "system", "content": "You are a helpful assistant.请将最终答案以JSON格式输出"}, {"role": "user", "content": " 给你一段文字如下, " + json_string + ",其中给出了一种盖板(篦子)名称作为答案,请将该盖板(篦子)名称输出"}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) parts = json_string.split('\n') parts = [x for x in parts if ':' in x] if len(parts) == 0: continue parts = parts[0].split(':') part = parts[1] part = part.replace(',','') part = part.replace('\'','') part = part.replace('\"','') part = part.replace(' ','') result.append(tihuan_gai(clde[i]['CLBH'], clde[i]['CLMC'], clde[i]['YSJG'], part)) if bh.startswith("012701") or bh.startswith('012703'): ##钢材 completion = aiclient.chat.completions.create( model="glm-4.5-air", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "以下是一段工作内容的描述: " + label + '\n其中包括了一道工序如下: ' +description + '\n工序使用了钢材作为材料之一。请从工作内容中找到与该工序最匹配的描述,并从描述中抽取出钢材的具体品种型号等信息。例如,如果工作内容的描述中写的是“Q235B”,那么你应该原封不动的返回“Q235B”。如果工作内容提及镀锌钢管,则你应该返回“镀锌钢管”。如果工作内容中没有具体描述钢材的信息,则返回“通用钢”'}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) completion = sfclient.chat.completions.create( model=simplemodel(), messages=[ {"role": "system", "content": "You are a helpful assistant.请将最终答案以JSON格式输出"}, {"role": "user", "content": " 给你一段文字如下, " + json_string + ",其中给出了一种钢材名称型号作为答案,请将该钢材名称型号输出"}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) parts = json_string.split('\n') parts = [x for x in parts if ':' in x] if len(parts) == 0: continue parts = parts[0].split(':') part = parts[1] part = part.replace(',','') part = part.replace('\'','') part = part.replace('\"','') part = part.replace(' ','') result.append(tihuan_gangcai(clde[i]['CLBH'], clde[i]['CLMC'], clde[i]['YSJG'], part)) if bh.startswith("11030746"): ##防水涂料 completion = aiclient.chat.completions.create( model="glm-4.5-air", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "以下是一段工作内容的描述: " + label + '\n其中包括了一道工序如下: ' +description + '\n工序使用了防水涂料作为材料之一。请从工作内容中找到与该工序最匹配的描述,并从描述中抽取出防水涂料的具体品种型号等信息。例如,如果工作内容的描述中写的是“2.0厚非固化沥青防水涂料”,那么你应该原封不动的返回“2.0厚非固化沥青防水涂料”。如果工作内容中没有具体描述防水涂料的信息,则返回“通用防水涂料”'}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) completion = sfclient.chat.completions.create( model=simplemodel(), messages=[ {"role": "system", "content": "You are a helpful assistant.请将最终答案以JSON格式输出"}, {"role": "user", "content": " 给你一段文字如下, " + json_string + ",其中给出了一种防水涂料名称作为答案,请将该防水涂料名称输出"}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) parts = json_string.split('\n') parts = [x for x in parts if ':' in x] if len(parts) == 0: continue parts = parts[0].split(':') part = parts[1] part = part.replace(',','') part = part.replace('\'','') part = part.replace('\"','') part = part.replace(' ','') result.append(tihuan_fangshui(clde[i]['CLBH'], clde[i]['CLMC'], clde[i]['YSJG'], part)) if bh.startswith("041703"): ##水泥彩瓦 completion = aiclient.chat.completions.create( model="glm-4.5-air", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "以下是一段工作内容的描述: " + label + '\n其中包括了一道工序如下: ' +description + '\n工序使用了瓦作为材料之一。请从工作内容中找到与该工序最匹配的描述,并从描述中抽取出瓦的具体品种型号等信息。例如,如果工作内容的描述中写的是“0.9mm铝镁锰合金仿古金属瓦”,那么你应该原封不动的返回“0.9mm铝镁锰合金仿古金属瓦”。如果工作内容中没有具体描述瓦的信息,则返回“通用瓦”'}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) completion = sfclient.chat.completions.create( model=simplemodel(), messages=[ {"role": "system", "content": "You are a helpful assistant.请将最终答案以JSON格式输出"}, {"role": "user", "content": " 给你一段文字如下, " + json_string + ",其中给出了一种瓦名称型号作为答案,请将该瓦名称型号输出"}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) parts = json_string.split('\n') parts = [x for x in parts if ':' in x] if len(parts) == 0: continue parts = parts[0].split(':') part = parts[1] part = part.replace(',','') part = part.replace('\'','') part = part.replace('\"','') part = part.replace(' ','') result.append(tihuan_wa(clde[i]['CLBH'], clde[i]['CLMC'], clde[i]['YSJG'], part)) if bh.startswith("066501") or bh.startswith('066121'): ##地砖、面砖 completion = aiclient.chat.completions.create( model="glm-4.5-air", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "以下是一段工作内容的描述: " + label + '\n其中包括了一道工序如下: ' +description + '\n工序使用了地砖、面砖作为材料之一。请从工作内容中找到与该工序最匹配的描述,并从描述中抽取出地砖、面砖的具体品种型号等信息。例如,如果工作内容的描述中写的是“10厚800X800防滑地砖”,那么你应该原封不动的返回“10厚800X800防滑地砖”。如果工作内容中没有具体描述地砖、面砖的信息,则返回“通用砖”'}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) completion = sfclient.chat.completions.create( model=simplemodel(), messages=[ {"role": "system", "content": "You are a helpful assistant.请将最终答案以JSON格式输出"}, {"role": "user", "content": " 给你一段文字如下, " + json_string + ",其中给出了一种砖名称型号作为答案,请将该砖名称型号输出"}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) parts = json_string.split('\n') parts = [x for x in parts if ':' in x] if len(parts) == 0: continue parts = parts[0].split(':') part = parts[1] part = part.replace(',','') part = part.replace('\'','') part = part.replace('\"','') part = part.replace(' ','') result.append(tihuan_dizhuan(clde[i]['CLBH'], clde[i]['CLMC'], clde[i]['YSJG'], part)) if bh.startswith("11570") or bh.startswith('115721'): ##卷材 completion = aiclient.chat.completions.create( model="glm-4.5-air", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "以下是一段工作内容的描述: " + label + '\n其中包括了一道工序如下: ' +description + '\n工序使用了卷材作为材料之一。请从工作内容中找到与该工序最匹配的描述,并从描述中抽取出卷材的具体品种型号等信息。例如,如果工作内容的描述中写的是“3.0厚SBS聚合物改性沥青防水卷材(PY)Ⅱ型聚酯胎”,那么你应该原封不动的返回“3.0厚SBS聚合物改性沥青防水卷材(PY)Ⅱ型聚酯胎”。如果工作内容中没有具体描述卷材的信息,则返回“通用卷材”'}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) completion = sfclient.chat.completions.create( model=simplemodel(), messages=[ {"role": "system", "content": "You are a helpful assistant.请将最终答案以JSON格式输出"}, {"role": "user", "content": " 给你一段文字如下, " + json_string + ",其中给出了一种卷材名称型号作为答案,请将该卷材名称型号输出"}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) parts = json_string.split('\n') parts = [x for x in parts if ':' in x] if len(parts) == 0: continue parts = parts[0].split(':') part = parts[1] part = part.replace(',','') part = part.replace('\'','') part = part.replace('\"','') part = part.replace(' ','') result.append(tihuan_juancai(clde[i]['CLBH'], clde[i]['CLMC'], clde[i]['YSJG'], part)) if bh.startswith("021103"): ##挤塑板 completion = aiclient.chat.completions.create( model="glm-4.5-air", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "以下是一段工作内容的描述: " + label + '\n其中包括了一道工序如下: ' +description + '\n工序使用了板材作为材料之一。请从工作内容中找到与该工序最匹配的描述,并从描述中抽取出板材的具体品种型号等信息。例如,如果工作内容的描述中写的是“20厚Ⅰ型石墨聚苯板”,那么你应该原封不动的返回“20厚Ⅰ型石墨聚苯板”。如果工作内容中没有具体描述板材的信息,则返回“通用板材”'}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) completion = sfclient.chat.completions.create( model=simplemodel(), messages=[ {"role": "system", "content": "You are a helpful assistant.请将最终答案以JSON格式输出"}, {"role": "user", "content": " 给你一段文字如下, " + json_string + ",其中给出了一种板材名称型号作为答案,请将该板材名称型号输出"}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) parts = json_string.split('\n') parts = [x for x in parts if ':' in x] if len(parts) == 0: continue parts = parts[0].split(':') part = parts[1] part = part.replace(',','') part = part.replace('\'','') part = part.replace('\"','') part = part.replace(' ','') result.append(tihuan_bancai(clde[i]['CLBH'], clde[i]['CLMC'], clde[i]['YSJG'], part)) if bh.startswith("0509"): ##细木工板 completion = aiclient.chat.completions.create( model="glm-4.5-air", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "以下是一段工作内容的描述: " + data['tz_bak'] + '\n其中包括了一道工序如下: ' +description + '\n工序使用了板材作为材料之一,用于阻燃吸音。请从工作内容中找到与该工序最匹配的描述,并从描述中抽取出板材的具体品种型号等信息。例如,如果工作内容的描述中写的是“18mm厚阻燃板”,那么你应该原封不动的返回“18mm厚阻燃板”。如果工作内容中没有具体描述板材的信息,则返回“通用板材”'}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) completion = sfclient.chat.completions.create( model=simplemodel(), messages=[ {"role": "system", "content": "You are a helpful assistant.请将最终答案以JSON格式输出"}, {"role": "user", "content": " 给你一段文字如下, " + json_string + ",其中给出了一种板材名称型号作为答案,请将该板材名称型号输出"}, ], extra_body={"thinking": {"type": "disabled"}}, ) json_string = completion.choices[0].message.content print(json_string) parts = json_string.split('\n') parts = [x for x in parts if ':' in x] if len(parts) == 0: continue parts = parts[0].split(':') part = parts[1] part = part.replace(',','') part = part.replace('\'','') part = part.replace('\"','') part = part.replace(' ','') result.append(tihuan_mugongban(clde[i]['CLBH'], clde[i]['CLMC'], clde[i]['YSJG'], part)) return result