| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594 |
- import time
- from config import simplemodel
- from template import xuanxiang
- import json
- with open('zhaoping_rule', 'r') as f:
- content = f.read()
- import json
- obj=json.loads(content)
- with open('name_label', 'r') as f:
- content = f.read()
- import json
- name_label=json.loads(content)
- tijiaoxian = ['13-95', '13-27', '13-127', '13-128', '13-129', '13-130', '13-131', '13-34', '13-72', '13-76', '13-100']
- example1='''
- 1、用于地下楼梯间、走道地面 做法详见图纸设计及相关图集规范
- 2、100厚C25细石混凝土随打随抹,内配Φ4@200钢筋网片,抹平压光
- '''
- example2='''
- 1、用于消防泵房地面 做法详见图纸设计及相关图集规范
- 2、50厚C25细石混凝土随打随抹,内配Φ4@200钢筋网片,抹平压光
- 3、最薄处30厚C20细石混凝土向排水沟、集水坑找1%坡,随打随抹平,立管根部用DS M15砂浆(1:3水泥砂浆)抹小八字角
- '''
- from fallback import fallback
- def aifilter5(A, #options
- B, #data
- aiclient,
- qwclient,
- sfclient,
- dw):
- options=[]
- letters = "ABCDEFGHIJKLMN"
- for i in range(len(tijiaoxian)):
- options.append("给定选项" + letters[i]+",内容为"+name_label[tijiaoxian[i]] )
- completion = aiclient.chat.completions.create(
- #model="THUDM/GLM-4-9B-0414",
- model="glm-4.5-air",
- #model="Qwen/Qwen3-8B",
- #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最匹配,则你应该返回A'},
- ],
- extra_body={"thinking": {"type": "disabled"}},
- #extra_body={"enable_thinking": True},
- #stream=True
- )
- json_string = completion.choices[0].message.content
- print(json_string)
- answer=[]
- if len(json_string) < 4:
- if 'A' in json_string:
- answer.append(name_label[tijiaoxian[0]])
- if 'B' in json_string:
- answer.append(name_label[tijiaoxian[1]])
- if 'C' in json_string:
- answer.append(name_label[tijiaoxian[2]])
- if 'D' in json_string:
- answer.append(name_label[tijiaoxian[3]])
- if 'E' in json_string:
- answer.append(name_label[tijiaoxian[4]])
- if 'F' in json_string:
- answer.append(name_label[tijiaoxian[5]])
- if 'G' in json_string:
- answer.append(name_label[tijiaoxian[6]])
- if 'H' in json_string:
- answer.append(name_label[tijiaoxian[7]])
- if 'I' in json_string:
- answer.append(name_label[tijiaoxian[8]])
- if 'J' in json_string:
- answer.append(name_label[tijiaoxian[9]])
- if 'K' in json_string:
- answer.append(name_label[tijiaoxian[10]])
- return answer
- completion = sfclient.chat.completions.create(
- model=simplemodel(),
- messages=[
- {"role": "system", "content": "You are a helpful assistant.请将最终答案以JSON格式输出"},
- {"role": "user", "content": " 给你一段文字如下, " + json_string + ",其中给出了一个类似于A或者B的英文字母作为答案,请将该字母答案输出"},
- ],
- extra_body={"thinking": {"type": "disabled"}},
- #extra_body={"enable_thinking": False},
- )
- json_string = completion.choices[0].message.content
- print(json_string)
- if 'A' in json_string:
- answer.append(name_label[tijiaoxian[0]])
- if 'B' in json_string:
- answer.append(name_label[tijiaoxian[1]])
- if 'C' in json_string:
- answer.append(name_label[tijiaoxian[2]])
- if 'D' in json_string:
- answer.append(name_label[tijiaoxian[3]])
- if 'E' in json_string:
- answer.append(name_label[tijiaoxian[4]])
- if 'F' in json_string:
- answer.append(name_label[tijiaoxian[5]])
- if 'G' in json_string:
- answer.append(name_label[tijiaoxian[6]])
- if 'H' in json_string:
- answer.append(name_label[tijiaoxian[7]])
- if 'I' in json_string:
- answer.append(name_label[tijiaoxian[8]])
- if 'J' in json_string:
- answer.append(name_label[tijiaoxian[9]])
- if 'K' in json_string:
- answer.append(name_label[tijiaoxian[10]])
- return answer
- def aifilter3(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="THUDM/GLM-4-9B-0414",
- model="glm-4.5-air",
- #model="Qwen/Qwen3-8B",
- #model="ernie-speed-128k",
- messages=[
- {"role": "system", "content": "You are a helpful assistant."},
- {"role": "user", "content": "问题描述: 细石混凝土内配钢筋网片是一种常见的施工工艺。给定一段工作内容: " + B['label'] + " " + B['mc'] + " " + B['tz'] + "。请问该工作内容的描述中有同时包含混凝土以及钢筋网片吗?请回答有或者没有"},
- ],
- extra_body={"thinking": {"type": "disabled"}},
- #extra_body={"enable_thinking": True},
- #stream=True
- )
- json_string = completion.choices[0].message.content
- print(json_string)
- if len(json_string) < 4:
- if '没有' in json_string:
- return False
- return True
- 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"}},
- #extra_body={"enable_thinking": False},
- )
- json_string = completion.choices[0].message.content
- print(json_string)
- if '没有' in json_string:
- return False
- return True
- def aifilter4(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": " 背景知识:细石混凝土楼地面不是块料面层,而是混凝土整体面层"},
- {"role": "user", "content": " 背景知识:混凝土(砼)整体面层跟混凝土垫层是不同的施工步骤,不得混淆"},
- {"role": "user", "content": " 背景知识:混凝土(砼)找平层跟混凝土垫层是不同的施工步骤,不得混淆"},
- {"role": "user", "content": " 背景知识:水泥砂浆找平层跟水泥砂浆面层是不同的施工步骤,不得混淆"},
- {"role": "user", "content": " 背景知识:水泥砂浆找平层跟水泥砂浆保护层是不同的施工步骤,不得混淆"},
- {"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
- )
- ##done_thinking = False
- ##json_string=""
- ##thinking_json_string=""
- ##for chunk in completion:
- ## thinking_chunk = chunk.choices[0].delta.reasoning_content
- ## answer_chunk = chunk.choices[0].delta.content
- ## if thinking_chunk != '':
- ## thinking_json_string = thinking_json_string + thinking_chunk
- ## elif answer_chunk != '':
- ## if not done_thinking:
- ## done_thinking = True
- ## json_string = json_string + answer_chunk
- json_string = completion.choices[0].message.content
- #print(completion.choices[0].message.reasoning_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=simplemodel(),
- #model="glm-4.5-flash",
- 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 aifilter1_2(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": " 背景知识:混凝土(砼)整体面层跟混凝土找平层是不同的施工步骤,不得混淆"},
- {"role": "user", "content": " 背景知识:混凝土(砼)整体面层跟混凝土垫层是不同的施工步骤,不得混淆"},
- {"role": "user", "content": " 背景知识:混凝土(砼)找平层跟混凝土垫层是不同的施工步骤,不得混淆"},
- {"role": "user", "content": " 背景知识:水泥砂浆找平层跟水泥砂浆面层是不同的施工步骤,不得混淆"},
- {"role": "user", "content": " 背景知识:水泥砂浆找平层跟水泥砂浆保护层是不同的施工步骤,不得混淆"},
- {"role": "user", "content": " 特殊处理要求一:如果工作内容描述中**没有**明确提到素水泥浆,则**去掉**所有含有“素水泥浆”字样的选项"},
- {"role": "user", "content": " 特殊处理要求二:如果工作内容描述中**没有**明确提到“加浆抹光”,则**去掉**所有含有“加浆抹光”字样的选项"},
- {"role": "user", "content": " 特殊处理要求三:如果工作内容描述中**没有**明确提到混凝土垫层,则**去掉**所有混凝土垫层的选项"},
- {"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
- )
- #done_thinking = False
- #json_string=""
- #thinking_json_string=""
- #for chunk in completion:
- # thinking_chunk = chunk.choices[0].delta.reasoning_content
- # answer_chunk = chunk.choices[0].delta.content
- # if thinking_chunk != '':
- # thinking_json_string = thinking_json_string + thinking_chunk
- # elif answer_chunk != '':
- # if not done_thinking:
- # done_thinking = True
- # json_string = json_string + answer_chunk
- json_string = completion.choices[0].message.content
- #print(completion.choices[0].message.reasoning_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=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 aifilter1_3(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": " 背景知识:混凝土(砼)整体面层跟混凝土找平层是不同的施工步骤,不得混淆"},
- {"role": "user", "content": " 背景知识:混凝土(砼)整体面层跟混凝土垫层是不同的施工步骤,不得混淆"},
- {"role": "user", "content": " 背景知识:混凝土(砼)找平层跟混凝土垫层是不同的施工步骤,不得混淆"},
- {"role": "user", "content": " 背景知识:水泥砂浆找平层跟水泥砂浆面层是不同的施工步骤,不得混淆"},
- {"role": "user", "content": " 背景知识:水泥砂浆找平层跟水泥砂浆保护层是不同的施工步骤,不得混淆"},
- {"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
- )
- #done_thinking = False
- #json_string=""
- #thinking_json_string=""
- #for chunk in completion:
- # thinking_chunk = chunk.choices[0].delta.reasoning_content
- # answer_chunk = chunk.choices[0].delta.content
- # if thinking_chunk != '':
- # thinking_json_string = thinking_json_string + thinking_chunk
- # elif answer_chunk != '':
- # if not done_thinking:
- # done_thinking = True
- # json_string = json_string + answer_chunk
- json_string = completion.choices[0].message.content
- #print(completion.choices[0].message.reasoning_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=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 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": " 背景知识:混凝土(砼)整体面层跟混凝土找平层是不同的施工步骤,不得混淆"},
- {"role": "user", "content": " 背景知识:混凝土(砼)整体面层跟混凝土垫层是不同的施工步骤,不得混淆"},
- {"role": "user", "content": " 背景知识:混凝土(砼)找平层跟混凝土垫层是不同的施工步骤,不得混淆"},
- {"role": "user", "content": " 背景知识:水泥砂浆找平层跟水泥砂浆面层是不同的施工步骤,不得混淆"},
- {"role": "user", "content": " 背景知识:水泥砂浆找平层跟水泥砂浆保护层是不同的施工步骤,不得混淆"},
- {"role": "user", "content": " 特殊处理要求:去掉所有模板工程的选项"},
- {"role": "user", "content": " 特殊处理要求:如果工作内容描述中没有明确涉及水泥砂浆面层,且没有提及水泥砂浆保护层,则去掉所有20mm水泥砂浆楼地面面层的选项.注意,是去除面层,不包括找平层"},
- {"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
- )
- #done_thinking = False
- #json_string=""
- #thinking_json_string=""
- #for chunk in completion:
- # thinking_chunk = chunk.choices[0].delta.reasoning_content
- # answer_chunk = chunk.choices[0].delta.content
- # if thinking_chunk != '':
- # thinking_json_string = thinking_json_string + thinking_chunk
- # elif answer_chunk != '':
- # if not done_thinking:
- # done_thinking = True
- # json_string = json_string + answer_chunk
- json_string = completion.choices[0].message.content
- #print(completion.choices[0].message.reasoning_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 aifilter2(A, #options
- B, #data
- aiclient,
- qwclient,
- dw):
- hit_wumian = False
- for entry in A:
- if entry in obj['wumian']:
- hit_wumian=True
- hit_loumian = False
- loumian_entry = ''
- for entry in A:
- if entry in obj['loumian']:
- hit_loumian=True
- loumian_entry = entry
- if hit_wumian and hit_loumian:
- return [x for x in A if x != loumian_entry]
- return A
- def postprocess011105(selected, data, aiclient, qwclient, sfclient, label_name, name_dw):
- prime = aifilter1(selected, data, aiclient, qwclient, sfclient, name_dw)
- time.sleep(1)
- prime = aifilter1_2(prime, data, aiclient, qwclient, sfclient, name_dw)
- time.sleep(1)
- prime = aifilter1_3(prime, data, aiclient, qwclient, sfclient, name_dw)
- time.sleep(1)
- prime = [x for x in prime if not '踢脚线' in x]
- xian = aifilter5(selected, data, aiclient, qwclient, sfclient, name_dw)
- prime = prime + xian
- if '界面剂' in data['tz']:##保温
- if len([ x for x in prime if '第十四章 墙柱面工程 14.1 一般抹灰 14.1.3 保温砂浆及抗裂基层 刷界面剂' in x]) == 0:
- prime.append('第十四章 墙柱面工程 14.1 一般抹灰 14.1.3 保温砂浆及抗裂基层 刷界面剂 混凝土面') ##需要换
- return prime
|