update
This commit is contained in:
@@ -16,6 +16,7 @@ class Source(BaseModel):
|
||||
content: str = Field(min_length=1, max_length=5000)
|
||||
kind: str = Field(default='record', max_length=50)
|
||||
relation: str = Field(default='', max_length=50)
|
||||
entity: str = Field(default='', max_length=200)
|
||||
|
||||
|
||||
class PushPreviewRequest(BaseModel):
|
||||
@@ -26,6 +27,7 @@ class PushPreviewRequest(BaseModel):
|
||||
contents: list[str] = Field(min_length=1, max_length=4)
|
||||
evidence: list[Source] = Field(max_length=100)
|
||||
limits: list[str] = Field(max_length=100)
|
||||
presentation: Literal['standard', 'executive'] = 'standard'
|
||||
|
||||
|
||||
class Basis(BaseModel):
|
||||
@@ -109,12 +111,17 @@ def _grounding_issues(message: Message, excerpts: dict) -> list[str]:
|
||||
verification = r'(?:已完成|已经完成|完成了|完成)(?:[^。!?;,]{0,10})(?:验证|测试|验收)|(?:验证|测试|验收)(?:[^。!?;,]{0,6})(?:通过|完成)'
|
||||
def affirmative_verification(text):
|
||||
for found in re.finditer(verification, text):
|
||||
if re.search(r'(?:验证|测试|验收)任务[^。!?;,]{0,6}(?:登记|状态)[^。!?;,]{0,3}完成', found.group()):
|
||||
continue
|
||||
prefix = re.split(r'[。!?;,]', text[:found.start()])[-1]
|
||||
if not re.search(r'(?:未|尚未|待|需|要求|计划|建议|拟|应|无法确认|没有证据|未提供|不能确认)[^。!?;,]{0,20}$', prefix):
|
||||
return True
|
||||
return False
|
||||
factual = '。'.join((message.title, message.work, message.judgment))
|
||||
for claim in re.finditer(verification, factual):
|
||||
if re.search(r'(?:验证|测试|验收)任务[^。!?;,]{0,6}(?:登记|状态)[^。!?;,]{0,3}完成', claim.group()):
|
||||
# "验证任务登记完成" reports a registration, not successful validation.
|
||||
continue
|
||||
prefix = factual[:claim.start()].rsplit('。', 1)[-1]
|
||||
if not re.search(r'(?:未|尚未|待|需|无法确认|没有证据|未提供|不能确认)[^。!?;,]{0,14}$', prefix) and not affirmative_verification(source):
|
||||
issues.append('引用仅支持任务登记或流程接通,不能证明已完成测试、验证或验收;改为原文反馈,不把任务要求写成实际成果。')
|
||||
@@ -198,6 +205,9 @@ def _submission_record_preview(request: PushPreviewRequest) -> dict | None:
|
||||
|
||||
|
||||
def generate_preview(request: PushPreviewRequest, *, invoke=complete_json) -> dict:
|
||||
if request.presentation == 'executive':
|
||||
from .message_brief import generate_brief
|
||||
return generate_brief(request, invoke=invoke)
|
||||
deadline = time.monotonic() + 115
|
||||
def call(instruction, content, schema, seconds, tokens):
|
||||
remaining = deadline - time.monotonic()
|
||||
|
||||
Reference in New Issue
Block a user