import json from config import simplemodel from template import xuanxiang def aifilter(A, #options B, #data aiclient, sfclient): options=[] letters = "ABCDEFGHIJKLMN" for i in range(len(A)): options.append("给定选项" + letters[i]+",内容为"+A[i]) completion = aiclient.chat.completions.create( model="glm-4.5-flash", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"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"}}, ) 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]) return answer def postprocess0104(selected, data, aiclient, sfclient): return aifilter(selected, data, aiclient, sfclient)