update
This commit is contained in:
@@ -43,6 +43,52 @@ class SourceGroups(Strict):
|
||||
issues: list[str] = Field(max_length=12)
|
||||
|
||||
|
||||
class ScoringItem(Strict):
|
||||
title: str = Field(min_length=1, max_length=100)
|
||||
part: Part
|
||||
usage: Literal['response', 'form', 'attachment']
|
||||
evidence_ids: list[str] = Field(min_length=1, max_length=5)
|
||||
|
||||
|
||||
class ScoringItems(Strict):
|
||||
items: list[ScoringItem] = Field(max_length=60)
|
||||
|
||||
|
||||
def scoring_rows(request, invoke, deadline):
|
||||
evidence = _evidence(request.blocks)
|
||||
schema = ScoringItems.model_json_schema()
|
||||
schema['$defs']['ScoringItem']['properties']['evidence_ids']['items']['enum'] = list(evidence)
|
||||
raw, commit = _review_response(
|
||||
'workbench_scoring_rows', invoke,
|
||||
COMMON + '\n这是招标文件的详细评标表原文。只识别真正单列计分的响应事项,为每个评分项提供可用于正文目录的独立标题与原文编号。'
|
||||
'一个表格单元如果列了多个分别计分的方案,应逐项识别。不要把技术方案、人员、资质和报价合并到同一条,不能把父项总分另列一次。'
|
||||
'证据选具体考察的工作内容、对象及条件。不要只选得分区间,不复述计算分数的流程,不将评分索引当成响应项。'
|
||||
'同一评分项跨行或页时选择完整条件对应的多个原文编号。对一个评分项内的并列对象(如软件、设备和网络)不要拆成几个计分项。'
|
||||
'方案应标technical/response,真实人员证书、合同业绩等标attachment,报价响应标price/form。'
|
||||
'标题写交付内容或方案名称,不包含分值、供应商称谓、评审标准字样。不得推断原文未出现的评分项。',
|
||||
{'project': request.project, 'evidence': [{'id': k, **v} for k, v in evidence.items()]},
|
||||
schema, deadline, max_tokens=3600)
|
||||
result = []
|
||||
seen = set()
|
||||
order = {key: n for n, key in enumerate(evidence)}
|
||||
for item in ScoringItems.model_validate(raw).items:
|
||||
keys = list(dict.fromkeys(item.evidence_ids))
|
||||
if any(key not in evidence for key in keys):
|
||||
raise ValueError('评分项引用不在评标原文中')
|
||||
identity = (item.title, tuple(sorted(keys, key=order.get)))
|
||||
if identity in seen:
|
||||
continue
|
||||
seen.add(identity)
|
||||
basis = [evidence[key] for key in identity[1]]
|
||||
text = '\n'.join(ref['quote'] for ref in basis)
|
||||
if len(text) > 1500:
|
||||
raise ValueError('评分项原文过长,请选择直接相关的条件')
|
||||
result.append(dict(part=item.part, title=item.title, topic=item.title, usage=item.usage,
|
||||
uncertain=False, text=text, basis=basis, scoring_point=True))
|
||||
commit()
|
||||
return dict(rule_version=RULE_VERSION, requirements=result, issues=[], extraction_complete=True)
|
||||
|
||||
|
||||
def source_rows(raw, evidence):
|
||||
"""Verbatim requirements: the model groups spans, it never rewrites them."""
|
||||
parsed = SourceGroups.model_validate(raw)
|
||||
@@ -214,11 +260,15 @@ def _complete_outline(request, parsed, invoke, deadline, *, checkpoint=True):
|
||||
def validate_context(request):
|
||||
wb = request.workbench
|
||||
allowed = {'version', 'title', 'path', 'target_words', 'segment', 'segments',
|
||||
'catalog', 'source_outline', 'guidance', 'previous', 'shared_context', 'writing_mode'}
|
||||
'catalog', 'source_outline', 'guidance', 'previous', 'shared_context', 'writing_mode', 'scoring_only', 'user_template'}
|
||||
if set(wb) - allowed or wb.get('version') != 1:
|
||||
raise ValueError('编写工作台参数版本无效')
|
||||
if len(json.dumps(wb, ensure_ascii=False)) > 22000:
|
||||
raise ValueError('目录或章节上下文超过范围,请分批处理')
|
||||
if 'user_template' in wb and (request.action != 'outline' or not isinstance(wb['user_template'], str) or len(wb['user_template']) > 8000):
|
||||
raise ValueError('目录模板格式或长度无效')
|
||||
if 'scoring_only' in wb and (request.action != 'analyze' or wb['scoring_only'] is not True):
|
||||
raise ValueError('评分项提取参数无效')
|
||||
if 'writing_mode' in wb and wb['writing_mode'] not in {'plan', 'response'}:
|
||||
raise ValueError('章节编写类型无效')
|
||||
if 'shared_context' in wb:
|
||||
@@ -266,6 +316,10 @@ def workbench_instruction(request):
|
||||
'方案类章节充分写到目标篇幅;声明、证照、索引和固定表式按原文填写,不能为凑字添加无关内容或虚构事实。'
|
||||
'segment/segments表示同一章节的分批续写,previous为本章已完成内容,'
|
||||
'承接其术语与逻辑,不再重复开场、已写内容或另起全篇结论。'
|
||||
'逐项写清本次requirements的新增做法。上一段已完成的内容即使能凑篇幅也不要重写。'
|
||||
'方案可写拟采用的操作方法,但签字主体、审批权限、验收门槛、固定时限和需提交材料等硬条件必须有当前招标原文依据。'
|
||||
'只因不同条款都涉及签字、变更或验收,不能互相套用;不得把设计建议写成采购人必须履行的要求。'
|
||||
'审核技术措施时以设计或合同约定的现有范围为准。可以检查漏洞、访问控制、备份恢复等对象,不得无依据承诺零漏洞、通过等级保护,或默认新增软硬件和安全设施。'
|
||||
'guidance是人工确认的写作范围与待确认条件;未确认的选项保持条件性表述,'
|
||||
'不得写成确定承诺。目录中的其他章节不属于本次编写范围。'
|
||||
'shared_context是带版本与来源的跨章原文约束,用于核对项目名称、期限、范围与排除项,'
|
||||
@@ -445,6 +499,8 @@ def workbench_step(request, *, invoke):
|
||||
progress = current_progress.get()
|
||||
if progress is not None:
|
||||
progress.deadline = deadline
|
||||
if request.workbench.get('scoring_only'):
|
||||
return scoring_rows(request, invoke, deadline)
|
||||
if request.action == 'outline':
|
||||
schema = Outline.model_json_schema()
|
||||
keys = [item['key'] for item in request.workbench['catalog']]
|
||||
@@ -458,13 +514,15 @@ def workbench_step(request, *, invoke):
|
||||
raw, save = _review_response('workbench_outline', invoke,
|
||||
COMMON + '\n规划投标文件多级目录,暂不写正文。catalog是需要编写的主题。'
|
||||
'按guidance指定的目录依据组织正文,scored=true表示来自评分项的真实响应主题。'
|
||||
'保留source_outline中明确的投标文件组成和规定格式。按评分组织时,优先依评分项命名可写小节,'
|
||||
'保留source_outline中明确的投标文件组成和规定格式。scored=true分配到撰写对应方案、响应表或证明材料的章节,'
|
||||
'评分索引只保留索引页字段。尽量给评分事项明确的小节,'
|
||||
'无需单列的服务要求并入对应小节,仍需给出准确的主题映射。'
|
||||
'不要把招标文件自身的采购流程目录直接复制为投标目录。'
|
||||
'每个主题编号恰好分配一次,不漏项;可合并相关主题到同一节。'
|
||||
'每个可编写小节最多8个相关主题,不能把几十个主题合成一个技术或商务大章。'
|
||||
'容器章节topics可为空,叶子节topics非空。首项level=1,层级不能跳级,'
|
||||
'最多三级。objective说明该节具体写什么,标题精炼且有层次。'
|
||||
'user_template为用户提供的目录结构参考,须映射本次catalog,招标规定格式优先。模板中的项目事实或示例不能作为本项目依据。'
|
||||
'只输出本次catalog对应目录,不编造无依据的资质或分册。',
|
||||
{'project': request.project, 'instructions': request.instructions, **request.workbench},
|
||||
schema, deadline, max_tokens=5000)
|
||||
|
||||
Reference in New Issue
Block a user