| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- from menchuangfallback import menchuangfallback
- from template import xuanxiang
- from config import simplemodel
- def fallback(A, B, aiclient, qwclient, sfclient, menchuang_collection, model):
- if B['bianma'].startswith("0109"):
- if B['bianma'].startswith("010902") and '非固化' in B['tz'] and '沥青防水涂料' in B['tz']:##屋面防水
- return ['第十章 屋面及防水工程 10.2 平面立面及其它防水 10.2.1 涂刷油类 水泥基渗透结晶 防水材料 二~三遍(厚2mm)'] ##需要换
- if B['bianma'].startswith("010902") and '高聚物' in B['tz'] and '改性沥青防水涂料' in B['tz']:##屋面防水
- return ['第十章 屋面及防水工程 10.2 平面立面及其它防水 10.2.1 涂刷油类 水泥基渗透结晶 防水材料 二~三遍(厚2mm)'] ##需要换
- if B['bianma'].startswith("010904") and '高聚物' in B['tz'] and '改性沥青防水涂料' in B['tz']:##屋面防水
- return ['第十章 屋面及防水工程 10.2 平面立面及其它防水 10.2.1 涂刷油类 水泥基渗透结晶 防水材料 二~三遍(厚2mm)'] ##需要换
- if B['bianma'].startswith("010904") and '非固化' in B['tz'] and '沥青防水涂料' in B['tz']:##屋面防水
- return ['第十章 屋面及防水工程 10.2 平面立面及其它防水 10.2.1 涂刷油类 水泥基渗透结晶 防水材料 二~三遍(厚2mm)'] ##需要换
- #menchuangfallback(A, B, aiclient, qwclient, menchuang_collection, model)
-
- if B['bianma'].startswith("0110"):
- result = []
- if '界面剂' in B['tz']:##屋面防水
- result.append('第十四章 墙柱面工程 14.1 一般抹灰 14.1.3 保温砂浆及抗裂基层 刷界面剂 混凝土面') ##需要换
- if '玻纤网' in B['tz']:##屋面防水
- result.append('第十四章 墙柱面工程 14.1 一般抹灰 14.1.3 保温砂浆及抗裂基层 墙面耐碱玻纤网格布 一层') ##需要换
- if '第十四章 墙柱面工程 14.1 一般抹灰 14.1.3 保温砂浆及抗裂基层 墙面耐碱玻纤网格布 一层' in result and '第十四章 墙柱面工程 14.1 一般抹灰 14.1.3 保温砂浆及抗裂基层 抗裂砂浆抹面4mm (网格布)' not in result:
- result.append('第十四章 墙柱面工程 14.1 一般抹灰 14.1.3 保温砂浆及抗裂基层 抗裂砂浆抹面4mm (网格布)')
- return result ##需要换
- options=[]
- letters = "ABCDEFGHIJKLMN"
- for i in range(len(A)):
- options.append("给定定额选项" + letters[i]+",内容为"+A[i])
- completion = qwclient.chat.completions.create(
- model="Qwen/Qwen3-32B",
- messages=[
- {"role": "system", "content": "You are a helpful assistant."},
- {"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": False},
- )
- json_string = completion.choices[0].message.content
- print(json_string)
-
- completion = sfclient.chat.completions.create(
- model=simplemodel(),
- messages=xuanxiang(json_string),
- extra_body={"thinking": {"type": "disabled"}},
- )
- json_string = completion.choices[0].message.content
- print(json_string)
- answer=[]
- if 'A' in json_string:
- answer.append(A[0])
- if 'B' in json_string:
- answer.append(A[1])
- if 'C' in json_string:
- answer.append(A[2])
- if 'D' in json_string:
- answer.append(A[3])
- if 'E' in json_string:
- answer.append(A[4])
- if 'F' in json_string:
- answer.append(A[5])
- if 'G' in json_string:
- answer.append(A[6])
- if 'H' in json_string:
- answer.append(A[7])
- if 'I' in json_string:
- answer.append(A[8])
- if 'J' in json_string:
- answer.append(A[9])
- return answer
|