docx-contracts
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesedocx-contracts
docx-contracts
Automated contract and form filling using docxtpl library.
使用docxtpl库自动填充合同和表单。
Workflow
工作流程
Be shure, that you recieve docx file. Don't try to read it.
- Extract schema: Run to get variables list and JSON schema. Don't read file. Just launch script.
scripts/extract_schema.py <template.docx> - Gather data: Extract values from user message context, matching schema fields. Use Claude completion for extraction if needed
- Handle missing data: If any required field is missing or uncertain, ask user directly. Do not guess
- Fill template: Create JSON file with data, then run
scripts/fill_template.py <template.docx> <data.json> <output.docx> - Deliver: Move result to and provide download link. Please don't read output file.
/mnt/user-data/outputs/
请确保你已接收到docx文件,不要尝试读取该文件。
- 提取schema:运行获取变量列表和JSON schema。不要读取文件,直接运行脚本即可。
scripts/extract_schema.py <template.docx> - 收集数据:从用户消息上下文中提取与schema字段匹配的值。必要时可使用Claude补全功能进行提取
- 处理缺失数据:如果存在任何必填字段缺失或不确定的情况,直接询问用户,不要进行猜测
- 填充模板:使用收集到的数据创建JSON文件,然后运行
scripts/fill_template.py <template.docx> <data.json> <output.docx> - 交付结果:将生成的结果移动到目录并提供下载链接,请不要读取输出文件。
/mnt/user-data/outputs/
Key Points
注意要点
- Template must use Jinja2 syntax:
{{VARIABLE_NAME}} - All required fields from schema must be filled
- Ask user for missing data - never invent values
- Install docxtpl if needed:
pip install docxtpl --break-system-packages
- 模板必须使用Jinja2语法:
{{VARIABLE_NAME}} - 必须填充schema中所有必填字段
- 缺失数据请询问用户,绝对不要编造值
- 必要时可安装docxtpl:
pip install docxtpl --break-system-packages