Bidding Tool - 投标技术方案自动编写
Overview
This skill generates professional construction/engineering bidding technical proposals (施工技术方案) in .docx format. The pipeline is:
Tender docs (PDF/DOCX) + BOQ (XLSX/CSV) → AI Analysis → Per-chapter AI Generation → Word Document Assembly
Project Location
The bidding tool code lives at C:\Users\lenovo\bidding-tool\. All commands assume this working directory.
Prerequisites (one-time setup)
cd C:\Users\lenovo\bidding-tool
# 1. Install dependencies (run once)
"C:/Users/lenovo/AppData/Local/Programs/Python/Python312/python.exe" -m pip install -e "."
# 2. Initialize config files
"C:/Users/lenovo/AppData/Local/Programs/Python/Python312/python.exe" -m bidding_tool.main init
# 3. Edit .env to add ANTHROPIC_API_KEY
# 4. Edit config/company.yaml with real company info
# 5. Edit config/projects.yaml with real past project cases
Workflow
Step 1: Parse input files (dry-run to verify extraction)
python -m bidding_tool.main parse --tender <招标文件.pdf> --boq <工程量清单.xlsx> --verbose
Parse handles:
- PDF files (via PyMuPDF): text + tables + images
- DOCX files (via python-docx): paragraphs + headings + tables
- Excel BOQ (via openpyxl): auto-detect column mapping by header keywords (序号/名称/工程量/单价...)
- CSV BOQ (via pandas): same column detection
Step 2: Analyze tender with AI
python -m bidding_tool.main analyze \
--tender <招标文件.pdf> \
--boq <工程量清单.xlsx> \
--output analysis.json
This extracts structured data from tender documents:
- Project name, location, scale, structure type
- Scope of work, technical requirements, quality/safety/environmental requirements
- Schedule requirements, key milestones
- Applicable standards, owner priorities
- Identifies key risks and special conditions
- Auto-detects project type (highway / municipal_construction / building_maintenance / landscaping / property_service / general)
Step 3: Full generation (one command)
python -m bidding_tool.main generate \
--tender <招标文件.pdf> \
--boq <工程量清单.xlsx> \
--output-dir ./output \
--model <claude-model-name>
Optional flags:
--sections ch4_methods,ch5_quality- Generate only specific chapters--no-cache- Skip AI response cache--max-tokens 8192- Increase output length for complex sections
Step 4: Regenerate a single section
python -m bidding_tool.main section \
--section-id ch10_key_points \
--analysis-file analysis.json \
--format docx \
--output ./output/revised_chapter10.docx
Generated Document Structure (13 Chapters)
| Chapter | Title | Key Content | |---|---|---| | 1 | 工程概况 | Project overview, scope, site conditions, standards | | 2 | 施工总体部署 | Deployment principles, construction zones, sequence | | 3 | 施工进度计划及保障措施 | Schedule plan, milestones, guarantee measures | | 4 | 主要施工方案与技术措施 | Earthwork, foundation, concrete, steel, MEP, decoration | | 5 | 质量管理体系与保证措施 | Quality objectives, system, process control, inspection | | 6 | 安全管理体系与保证措施 | Safety objectives, hazard control, emergency plan | | 7 | 文明施工与环境保护措施 | Site management, noise/dust, waste, water/soil | | 8 | 劳动力/材料/设备投入计划 | Labor, material supply, equipment plan | | 9 | 施工总平面布置 | Overall layout, traffic, utilities, staging | | 10 | 重点难点分析及对策 | Key risks identification, countermeasures (★ critical for evaluation) | | 11 | 项目管理机构配置 | Organization structure, key personnel, responsibilities | | 12 | 新工艺/新技术应用 | New technology adoption, expected benefits | | 13 | 售后服务及保修承诺 | Warranty period, service commitment, emergency response |
AI Quality Features
- Project type classification: Auto-detects 6 industry types, injects domain-specific glossary into generation prompts
- Anti-hollow writing: Detects 62 generic/empty phrases, enforces specific-data-density requirements (concrete dimensions, quantities, dates, standards)
- Quality auto-retry: Scores each chapter (0-100), auto-regenerates up to 3 times with targeted fix instructions if score < threshold
- Domain terminology injection: Highway/municipal/building glossaries loaded per project type, injected into AI prompts
- Content quality checks: Sub-section completeness, table presence, keyword coverage, data point density
Document Output Features
- Cover page: Project name, company name, date
- Table of Contents: Auto-generated TOC field (press F9 in Word to update)
- Preface: Documented methodology statement
- Headers/Footers: Company name in header, page numbers in footer
- Professional formatting: SimHei headings, SimSun body, 1.5 line spacing, first-line indent
- Tables: Properly formatted with alternating row shading
Cache Management
# View cache stats
python -m bidding_tool.main cache-stats
# Clear all cached AI responses
python -m bidding_tool.main cache-clear
# Clear cache for a specific section
python -m bidding_tool.main cache-clear --section ch4_methods
Config Management
# View current config
python -m bidding_tool.main config-show
# Validate config files
python -m bidding_tool.main config-validate
Key Files
config/company.yaml- Company profile, qualifications, personnel, standard phrasesconfig/projects.yaml- Historical project case libraryconfig/reference/project_types.yaml- 6 industry type definitions with detection keywordsconfig/reference/glossaries.yaml- Domain terminology databases (highway, municipal, building, etc.)config/reference/anti_hollow_rules.yaml- 14 hollow-writing categories + 62 generic phrases + 7 self-test questionssrc/bidding_tool/ai/prompts/analyzer.py- AI analysis prompt templatesrc/bidding_tool/ai/prompts/generator.py- Per-chapter generation prompt templates + SECTION_INSTRUCTIONSsrc/bidding_tool/ai/prompts/enhancer.py- Prompt enhancement with glossary + anti-hollow rulessrc/bidding_tool/ai/quality.py- Content quality scoring and fix suggestion generationsrc/bidding_tool/ai/classifier.py- Project type classifier (keyword scoring + AI confirmation)src/bidding_tool/references/- Domain knowledge modules (glossary, anti_hollow, project_types)src/bidding_tool/models/proposal.py- PROPOSAL_OUTLINE (13 chapters definition)src/bidding_tool/generator/assembler.py- DOCX assembly orchestratorsrc/bidding_tool/generator/styles.py- Word document style definitionssrc/bidding_tool/generator/sections.py- Markdown-to-DOCX renderersrc/bidding_tool/generator/toc.py- TOC field injection + headers/footers
Common Troubleshooting
Python not found: Use the full Python path:
"C:/Users/lenovo/AppData/Local/Programs/Python/Python312/python.exe"
Encoding issues: The tool auto-detects UTF-8 and reconfigures stdout. If you see garbled characters, run:
set PYTHONIOENCODING=utf-8
API errors: Check .env has valid ANTHROPIC_API_KEY. Verify model name matches available models.
Config validation: Run python -m bidding_tool.main config-validate to check company.yaml and projects.yaml syntax.
微信扫一扫