| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579 |
- 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
|