dknowc-dsh 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -50
- package/package.json +2 -2
- package/skills/dk-trace-report/SKILL.md +288 -0
- package/skills/dk-trace-report/config/examples/doc.json +56 -0
- package/skills/dk-trace-report/config/examples/legal.json +51 -0
- package/skills/dk-trace-report/config/examples/ppt.json +47 -0
- package/skills/dk-trace-report/config/examples/tax.json +46 -0
- package/skills/dk-trace-report/config/examples/trusted.json +122 -0
- package/skills/dk-trace-report/reference/sample_input.json +60 -0
- package/skills/dk-trace-report/resources/ECHARTS-NOTICE.txt +10 -0
- package/skills/dk-trace-report/resources/echarts.custom.min.js +48 -0
- package/skills/dk-trace-report/scripts/build_report_input.py +333 -0
- package/skills/{dknowc-trusted-search → dk-trace-report}/scripts/chart_embed.py +4 -1
- package/skills/{dknowc-trusted-search → dk-trace-report}/scripts/render_trace_html.py +1072 -537
- package/skills/dk-trace-report/scripts/run_paths.py +95 -0
- package/skills/dk-trace-report/scripts/trust_digest.py +77 -0
- package/skills/dknowc-legal-assistant/README.md +95 -0
- package/skills/dknowc-legal-assistant/SKILL.md +122 -0
- package/skills/dknowc-legal-assistant/attribution.json +5 -0
- package/skills/dknowc-legal-assistant/reference/answer-and-report.md +221 -0
- package/skills/dknowc-legal-assistant/reference/capability-layer.md +143 -0
- package/skills/dknowc-legal-assistant/reference/legal_claims.example.json +96 -0
- package/skills/dknowc-legal-assistant/reference/onboarding_scripts.md +198 -0
- package/skills/dknowc-legal-assistant/reference/policy_tags.json +2002 -0
- package/skills/dknowc-legal-assistant/reference/retrieval-statute.md +81 -0
- package/skills/dknowc-legal-assistant/reference/retrieval-v2.md +133 -0
- package/skills/dknowc-legal-assistant/reference/sample_search_result.md +33 -0
- package/skills/dknowc-legal-assistant/reference/sample_trace_report.html +940 -0
- package/skills/dknowc-legal-assistant/reference/tags.md +53 -0
- package/skills/dknowc-legal-assistant/reference/troubleshooting.md +50 -0
- package/skills/dknowc-legal-assistant/reference/verification-pass.md +59 -0
- package/skills/dknowc-legal-assistant/resources/echarts.custom.min.js +48 -0
- package/skills/dknowc-legal-assistant/scripts/api_key.py +68 -0
- package/skills/dknowc-legal-assistant/scripts/attribution.py +61 -0
- package/skills/dknowc-legal-assistant/scripts/calc_legal.py +375 -0
- package/skills/dknowc-legal-assistant/scripts/calc_period.py +155 -0
- package/skills/dknowc-legal-assistant/scripts/check_answer.py +664 -0
- package/skills/dknowc-legal-assistant/scripts/initialize.py +188 -0
- package/skills/dknowc-legal-assistant/scripts/legal_client.py +208 -0
- package/skills/dknowc-legal-assistant/scripts/legal_search.py +1059 -0
- package/skills/dknowc-legal-assistant/scripts/merge_search_results.py +630 -0
- package/skills/dknowc-legal-assistant/scripts/path_guard.py +92 -0
- package/skills/dknowc-legal-assistant/scripts/question_profile.py +215 -0
- package/skills/dknowc-legal-assistant/scripts/register_key.mjs +1152 -0
- package/skills/dknowc-legal-assistant/scripts/run_eval.py +109 -0
- package/skills/dknowc-legal-assistant/scripts/source_cards.py +321 -0
- package/skills/dknowc-legal-assistant/scripts/tag_catalog.py +162 -0
- package/skills/dknowc-legal-assistant/scripts/trace_report.config.json +66 -0
- package/skills/dknowc-legal-assistant/scripts/verify_claims.py +448 -0
- package/skills/dknowc-legal-assistant/scripts/websearch_convert.py +396 -0
- package/skills/dknowc-official-doc-writer/README.md +45 -25
- package/skills/dknowc-official-doc-writer/SKILL.md +28 -14
- package/skills/dknowc-official-doc-writer/config/trace_report.config.json +56 -0
- package/skills/dknowc-official-doc-writer/official-docs/input//345/274/225/347/224/250/345/257/271/347/205/247_/351/252/214/346/224/266_materials.json +628 -0
- package/skills/dknowc-official-doc-writer/official-docs/search-results/baseline_1555.json +345 -0
- package/skills/dknowc-official-doc-writer/official-docs/search-results/baseline_my.json +728 -0
- package/skills/dknowc-official-doc-writer/official-docs/search-results/baseline_wp.json +159 -0
- package/skills/dknowc-official-doc-writer/official-docs/search-results/baseline_wp2.json +1006 -0
- package/skills/dknowc-official-doc-writer/official-docs/search-results/test_tz.json +28 -0
- package/skills/dknowc-official-doc-writer/official-docs/search-results/tmp_q.json +1419 -0
- package/skills/dknowc-official-doc-writer/reference/anti_ai_patterns.md +13 -1
- package/skills/dknowc-official-doc-writer/reference/fact_discipline.md +4 -0
- package/skills/dknowc-official-doc-writer/reference/genre_writing_notes.md +4 -0
- package/skills/dknowc-official-doc-writer/reference/initialization.md +28 -20
- package/skills/dknowc-official-doc-writer/reference/material_usage_guidance.md +21 -0
- package/skills/dknowc-official-doc-writer/reference/materials_pipeline.md +64 -7
- package/skills/dknowc-official-doc-writer/reference/onboarding_scripts.md +43 -32
- package/skills/dknowc-official-doc-writer/reference/outline_rules.md +1 -1
- package/skills/dknowc-official-doc-writer/reference/output_guide.md +19 -20
- package/skills/dknowc-official-doc-writer/reference/research_notes.md +5 -3
- package/skills/dknowc-official-doc-writer/reference/review_checklist.md +6 -2
- package/skills/dknowc-official-doc-writer/reference/revision_workflow.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/search_guide.md +45 -33
- package/skills/dknowc-official-doc-writer/reference/search_intro.md +4 -4
- package/skills/dknowc-official-doc-writer/reference/search_policy.md +63 -36
- package/skills/dknowc-official-doc-writer/reference/standards/00_index.md +63 -77
- package/skills/dknowc-official-doc-writer/reference/standards/01_report.md +3 -3
- package/skills/dknowc-official-doc-writer/reference/standards/02_qingshi.md +6 -3
- package/skills/dknowc-official-doc-writer/reference/standards/03_pifu.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/04_tongzhi.md +12 -3
- package/skills/dknowc-official-doc-writer/reference/standards/05_yijian.md +8 -2
- package/skills/dknowc-official-doc-writer/reference/standards/06_han.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/08_tongbao.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/09_tonggao.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/10_gonggao.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/11_fuhan_approve.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/12_fuhan_objection.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/13_reminder.md +3 -3
- package/skills/dknowc-official-doc-writer/reference/standards/14_generic.md +1 -1
- package/skills/dknowc-official-doc-writer/reference/standards/16_decision.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/18_order.md +1 -1
- package/skills/dknowc-official-doc-writer/reference/standards/19_gazette.md +1 -1
- package/skills/dknowc-official-doc-writer/reference/standards/20_motion.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/22_application.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/23_publicity.md +1 -1
- package/skills/dknowc-official-doc-writer/reference/standards/25_plan.md +2 -1
- package/skills/dknowc-official-doc-writer/reference/standards/26_summary.md +7 -1
- package/skills/dknowc-official-doc-writer/reference/standards/27_speech.md +4 -1
- package/skills/dknowc-official-doc-writer/reference/standards/99_expressions.md +1 -2
- package/skills/dknowc-official-doc-writer/reference/task_router.md +5 -5
- package/skills/dknowc-official-doc-writer/reference/working_principles.md +4 -4
- package/skills/dknowc-official-doc-writer/reference/writing_method.md +166 -0
- package/skills/dknowc-official-doc-writer/reference/writing_rules.md +11 -5
- package/skills/dknowc-official-doc-writer/scripts/api_key.py +30 -3
- package/skills/dknowc-official-doc-writer/scripts/attribution.py +1 -1
- package/skills/dknowc-official-doc-writer/scripts/build_trace_json.py +216 -22
- package/skills/dknowc-official-doc-writer/scripts/check_materials.py +375 -27
- package/skills/dknowc-official-doc-writer/scripts/deep_convert.py +9 -4
- package/skills/dknowc-official-doc-writer/scripts/deep_query.py +3 -2
- package/skills/dknowc-official-doc-writer/scripts/dkag_search.py +23 -9
- package/skills/dknowc-official-doc-writer/scripts/extract_reference.py +2 -1
- package/skills/dknowc-official-doc-writer/scripts/format_document.py +116 -41
- package/skills/dknowc-official-doc-writer/scripts/initialize.py +246 -12
- package/skills/dknowc-official-doc-writer/scripts/local_memory.py +2 -6
- package/skills/dknowc-official-doc-writer/scripts/mcp_direct.py +2 -3
- package/skills/dknowc-official-doc-writer/scripts/merge_search_results.py +113 -13
- package/skills/dknowc-official-doc-writer/scripts/outline_reference.py +3 -2
- package/skills/dknowc-official-doc-writer/scripts/prose_lint.py +7 -2
- package/skills/dknowc-official-doc-writer/scripts/register.mjs +782 -216
- package/skills/dknowc-official-doc-writer/scripts/review_document.py +2 -1
- package/skills/dknowc-official-doc-writer/scripts/source_note_html.py +120 -13
- package/skills/dknowc-official-doc-writer/scripts/template_generator.py +2 -1
- package/skills/dknowc-official-doc-writer/scripts/update_skill.py +339 -0
- package/skills/dknowc-official-doc-writer/scripts/websearch_convert.py +326 -0
- package/skills/dknowc-ppt-assistant/README.md +21 -9
- package/skills/dknowc-ppt-assistant/SKILL.md +29 -20
- package/skills/dknowc-ppt-assistant/THIRD_PARTY_NOTICES.md +3 -2
- package/skills/dknowc-ppt-assistant/config/trace_report.config.json +65 -0
- package/skills/dknowc-ppt-assistant/references/initialization.md +58 -7
- package/skills/dknowc-ppt-assistant/references/material_usage.md +51 -14
- package/skills/dknowc-ppt-assistant/references/onboarding_scripts.md +51 -18
- package/skills/dknowc-ppt-assistant/references/sample_trace_report.html +372 -920
- package/skills/dknowc-ppt-assistant/references/search_intro.md +2 -2
- package/skills/dknowc-ppt-assistant/references/svg-authoring.md +3 -3
- package/skills/dknowc-ppt-assistant/references/upstream-example/README.md +2 -0
- package/skills/dknowc-ppt-assistant/scripts/api_key.py +11 -27
- package/skills/dknowc-ppt-assistant/scripts/attribution.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/build_trace_input.py +188 -0
- package/skills/dknowc-ppt-assistant/scripts/compact_svg_coordinates.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/config.py +9 -9
- package/skills/dknowc-ppt-assistant/scripts/console_encoding.py +1 -2
- package/skills/dknowc-ppt-assistant/scripts/error_helper.py +3 -3
- package/skills/dknowc-ppt-assistant/scripts/hyperlink_contract.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/initialize.py +248 -15
- package/skills/dknowc-ppt-assistant/scripts/language_tags.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/mcp_convert.py +7 -14
- package/skills/dknowc-ppt-assistant/scripts/mcp_direct.py +3 -2
- package/skills/dknowc-ppt-assistant/scripts/merge_search_results.py +604 -0
- package/skills/dknowc-ppt-assistant/scripts/native_payloads.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_animations.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/__init__.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/errors.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/formula.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/loader.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/models.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/registry.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/semantic_hash.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/semantics.py +3 -3
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/animation_import.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/formula_import.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/hyperlinks.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/preset_authoring.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/preset_registry_to_svg.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/preset_svg_markup.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/slide_to_svg.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/transition_import.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_transitions.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/preset_shape_svg.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/preview_slide_html.py +4 -11
- package/skills/dknowc-ppt-assistant/scripts/project_utils.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/register_key.mjs +890 -341
- package/skills/dknowc-ppt-assistant/scripts/resource_paths.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/shape_boolean_svg.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/slide_roster.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/__init__.py +2 -9
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/align_embed_images.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/crop_images.py +3 -3
- package/skills/dknowc-ppt-assistant/scripts/svg_quality/__init__.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/svg_quality/checker.py +9 -10
- package/skills/dknowc-ppt-assistant/scripts/svg_quality/cli.py +4 -4
- package/skills/dknowc-ppt-assistant/scripts/svg_quality/svg_contracts.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/svg_quality/xml_support.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_quality_checker.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/hyperlinks.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/theme_colors.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/theme_fonts.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/geometry_properties.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_ast.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_compiler.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_omml.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_parser.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_profile.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_run_properties.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/inline_formula.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/builder.py +9 -11
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/cli.py +7 -5
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/template_structure.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/template_validation.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/semantic_markers.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/shape_boolean.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/text_outline.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/trusted_search.py +51 -17
- package/skills/dknowc-ppt-assistant/scripts/update_skill.py +314 -0
- package/skills/dknowc-ppt-assistant/scripts/update_spec.py +25 -1
- package/skills/dknowc-ppt-assistant/scripts/websearch_convert.py +326 -0
- package/skills/dknowc-ppt-assistant/workflows/generate-pptx.md +99 -34
- package/skills/dknowc-tax-assistant/README.md +54 -0
- package/skills/dknowc-tax-assistant/SKILL.md +99 -0
- package/skills/dknowc-tax-assistant/attribution.json +5 -0
- package/skills/dknowc-tax-assistant/reference/answer-and-report.md +100 -0
- package/skills/dknowc-tax-assistant/reference/capability-layer.md +205 -0
- package/skills/dknowc-tax-assistant/reference/onboarding_scripts.md +68 -0
- package/skills/dknowc-tax-assistant/reference/policy_tags.json +2002 -0
- package/skills/dknowc-tax-assistant/reference/retrieval-policy.md +43 -0
- package/skills/dknowc-tax-assistant/reference/retrieval-v2.md +58 -0
- package/skills/dknowc-tax-assistant/reference/tags.md +53 -0
- package/skills/dknowc-tax-assistant/reference/tax_claims.example.json +76 -0
- package/skills/dknowc-tax-assistant/reference/trace_report.config.json +46 -0
- package/skills/dknowc-tax-assistant/reference/troubleshooting.md +70 -0
- package/skills/dknowc-tax-assistant/reference/websearch-fallback.md +59 -0
- package/skills/dknowc-tax-assistant/resources/THIRD_PARTY_NOTICES.md +9 -0
- package/skills/dknowc-tax-assistant/resources/echarts.custom.min.js +48 -0
- package/skills/dknowc-tax-assistant/scripts/api_key.py +60 -0
- package/skills/dknowc-tax-assistant/scripts/attribution.py +61 -0
- package/skills/dknowc-tax-assistant/scripts/calc_period.py +156 -0
- package/skills/dknowc-tax-assistant/scripts/calc_tax.py +179 -0
- package/skills/dknowc-tax-assistant/scripts/check_answer.py +210 -0
- package/skills/dknowc-tax-assistant/scripts/initialize.py +208 -0
- package/skills/dknowc-tax-assistant/scripts/merge_search_results.py +631 -0
- package/skills/dknowc-tax-assistant/scripts/path_guard.py +23 -0
- package/skills/dknowc-tax-assistant/scripts/question_profile.py +444 -0
- package/skills/dknowc-tax-assistant/scripts/register_key.mjs +1173 -0
- package/skills/dknowc-tax-assistant/scripts/run_dir.py +149 -0
- package/skills/dknowc-tax-assistant/scripts/source_cards.py +372 -0
- package/skills/dknowc-tax-assistant/scripts/tag_catalog.py +164 -0
- package/skills/dknowc-tax-assistant/scripts/tax_client.py +218 -0
- package/skills/dknowc-tax-assistant/scripts/tax_search.py +403 -0
- package/skills/dknowc-tax-assistant/scripts/verify_claims.py +587 -0
- package/skills/dknowc-tax-assistant/scripts/websearch_convert.py +352 -0
- package/skills/dknowc-trusted-search/README.md +29 -23
- package/skills/dknowc-trusted-search/SKILL.md +257 -107
- package/skills/dknowc-trusted-search/config/trace_report.config.json +119 -0
- package/skills/dknowc-trusted-search/reference/onboarding_scripts.md +40 -15
- package/skills/dknowc-trusted-search/reference/sample_trace_report.html +286 -191
- package/skills/dknowc-trusted-search/resources/ECHARTS-NOTICE.txt +10 -0
- package/skills/dknowc-trusted-search/scripts/api_key.py +10 -26
- package/skills/dknowc-trusted-search/scripts/attribution.py +1 -1
- package/skills/dknowc-trusted-search/scripts/build_trace_input.py +173 -0
- package/skills/dknowc-trusted-search/scripts/deep_convert.py +79 -30
- package/skills/dknowc-trusted-search/scripts/deep_query.py +23 -34
- package/skills/dknowc-trusted-search/scripts/initialize.py +353 -12
- package/skills/dknowc-trusted-search/scripts/mcp_direct.py +3 -2
- package/skills/dknowc-trusted-search/scripts/merge_search_results.py +222 -35
- package/skills/dknowc-trusted-search/scripts/register_key.mjs +845 -291
- package/skills/dknowc-trusted-search/scripts/source_display.py +59 -0
- package/skills/dknowc-trusted-search/scripts/trusted_search.py +69 -36
- package/skills/dknowc-trusted-search/scripts/update_skill.py +300 -0
- package/skills/dknowc-trusted-search/scripts/websearch_convert.py +328 -0
- package/src/index.js +15 -0
- package/skills/dknowc-official-doc-writer/scripts/mcp_convert.py +0 -287
- package/skills/dknowc-official-doc-writer/scripts/render_trace_html.py +0 -2574
- package/skills/dknowc-ppt-assistant/references/upstream-docs/svg-pipeline.md +0 -842
- package/skills/dknowc-ppt-assistant/scripts/finalize_svg.py +0 -507
- package/skills/dknowc-ppt-assistant/scripts/render_trace_html.py +0 -2642
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/svg_rect_to_path.py +0 -346
- package/skills/dknowc-trusted-search/official-docs/output/.gitkeep +0 -0
- package/skills/dknowc-trusted-search/official-docs/search-results/.gitkeep +0 -0
- package/skills/dknowc-trusted-search/scripts/mcp_convert.py +0 -198
|
@@ -4,7 +4,7 @@ DKAG 素材召回接口脚本
|
|
|
4
4
|
用于根据查询关键词召回相关公文素材
|
|
5
5
|
|
|
6
6
|
使用深知可信搜索 V2 接口:/open-api/maas/dependable/v2/search
|
|
7
|
-
(
|
|
7
|
+
(V2 接口;不保留 V1 代码路径)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
import argparse
|
|
@@ -32,9 +32,7 @@ QUERY_TOO_SHORT_ERROR = f"错误:查询关键词过短,最少需要 {MIN_QUE
|
|
|
32
32
|
|
|
33
33
|
# API Key 与搜索结果路径
|
|
34
34
|
SKILL_ROOT = Path(__file__).resolve().parent.parent
|
|
35
|
-
|
|
36
|
-
DEFAULT_BASE_URL = "https://open.dknowc.cn/open-api/maas/dependable/v2/search"
|
|
37
|
-
# 工作区根:dsh 场景通过环境变量 DKNWOC_WS_ROOT 指向会话工作区,未设置时回退到 cwd(SkillHub 兼容)
|
|
35
|
+
# 工作区根:dsh 场景通过环境变量 DKNWOC_WS_ROOT 指向会话工作区,未设置时回退到 cwd
|
|
38
36
|
import os as _os
|
|
39
37
|
_ws = _os.environ.get("DKNWOC_WS_ROOT")
|
|
40
38
|
if not _ws:
|
|
@@ -43,6 +41,9 @@ if not _ws:
|
|
|
43
41
|
_sid = _os.environ.get("DSH_SESSION_ID", "")
|
|
44
42
|
_ws = str(Path(_os.getcwd()) / "dknowc-output" / (_sid[:8] if _sid else "_default"))
|
|
45
43
|
WS_ROOT = Path(_ws).resolve()
|
|
44
|
+
|
|
45
|
+
API_KEY_ENV = "DKNOWC_API_KEY"
|
|
46
|
+
DEFAULT_BASE_URL = "https://open.dknowc.cn/open-api/maas/dependable/v2/search"
|
|
46
47
|
SEARCH_RESULTS_DIR = WS_ROOT / "official-docs" / "search-results"
|
|
47
48
|
CONFIG_HELP_URL = "https://platform.dknowc.cn/"
|
|
48
49
|
DEFAULT_SEGMENT_COUNT = 4 # 默认段数 4(经 2/4/8 参数对比,4/18000 质量最优)
|
|
@@ -201,7 +202,7 @@ def detect_quota_exhausted(status_code=None, errmsg=None, biz_status=None):
|
|
|
201
202
|
|
|
202
203
|
|
|
203
204
|
def user_message_for_error(status_code=None, quota_exhausted=False):
|
|
204
|
-
"""
|
|
205
|
+
"""按错误类型返回给用户的固定话术(本地模板,Agent 按原文告知用户,不要改写)。"""
|
|
205
206
|
if quota_exhausted:
|
|
206
207
|
return (f"检索调不动,很可能是积分用完了:到 {MAAS_PLATFORM_URL} 看一下积分,"
|
|
207
208
|
"完成实名认证可以再领 10 万积分。")
|
|
@@ -238,7 +239,7 @@ def load_config(config_path: Optional[Path] = None) -> dict:
|
|
|
238
239
|
}
|
|
239
240
|
|
|
240
241
|
|
|
241
|
-
def clean_dkag_response(api_response: dict) -> dict:
|
|
242
|
+
def clean_dkag_response(api_response: dict, search_channels: Optional[list[str]] = None) -> dict:
|
|
242
243
|
"""
|
|
243
244
|
清洗 DKAG API 返回的数据
|
|
244
245
|
|
|
@@ -283,15 +284,23 @@ def clean_dkag_response(api_response: dict) -> dict:
|
|
|
283
284
|
global_id_counter = 1
|
|
284
285
|
|
|
285
286
|
for art in articles:
|
|
287
|
+
# 联网检索模式(--search-channel webSearch)召回的是互联网网页材料:
|
|
288
|
+
# 通道标"深知可信搜索·联网"区分于库内路,并统一打 非官方来源 标记
|
|
289
|
+
# (接口 dataAuthority 未返回数据权威性时兜底)——溯源报告据此打徽标。
|
|
290
|
+
_is_web_channel = bool(search_channels) and "webSearch" in search_channels
|
|
286
291
|
cleaned_art = {
|
|
287
292
|
"文章标题": art.get("文章标题", "无标题"),
|
|
288
293
|
"发布日期": art.get("发布日期", ""),
|
|
289
294
|
"数据源": art.get("数据源", "未知来源"),
|
|
290
295
|
"段落": [],
|
|
291
296
|
# 检索通道标记:本产物来自深知可信搜索(V2 生产入口)。
|
|
292
|
-
# 溯源报告据此区分"深度搜索 / 可信搜索"
|
|
293
|
-
"检索通道": "深知可信搜索",
|
|
297
|
+
# 溯源报告据此区分"深度搜索 / 可信搜索 / 可信搜索·联网"来源与各自路数。
|
|
298
|
+
"检索通道": "深知可信搜索·联网" if _is_web_channel else "深知可信搜索",
|
|
294
299
|
}
|
|
300
|
+
if _is_web_channel:
|
|
301
|
+
cleaned_art["非官方来源"] = True
|
|
302
|
+
if art.get("数据权威性"):
|
|
303
|
+
cleaned_art["数据权威性"] = str(art["数据权威性"]).strip()
|
|
295
304
|
for key in ("源网址", "sourceUrl", "source_url", "原文链接", "原文地址", "文章链接", "url", "URL"):
|
|
296
305
|
if art.get(key):
|
|
297
306
|
cleaned_art["源网址"] = str(art[key]).strip()
|
|
@@ -511,6 +520,10 @@ def dkag_search(
|
|
|
511
520
|
|
|
512
521
|
if normalized_search_channels:
|
|
513
522
|
payload["searchChannel"] = normalized_search_channels
|
|
523
|
+
# 联网检索模式自动请求文章级 数据权威性 标注(联网结果为"非权威"),
|
|
524
|
+
# 供溯源报告打「非官方来源」徽标;库内检索不受影响。
|
|
525
|
+
if "webSearch" in normalized_search_channels:
|
|
526
|
+
payload["dataAuthority"] = True
|
|
514
527
|
|
|
515
528
|
# 构建请求头
|
|
516
529
|
headers = {
|
|
@@ -549,6 +562,7 @@ def dkag_search(
|
|
|
549
562
|
|
|
550
563
|
# 发送请求(429/402 全部按额度用尽处理,不重试——见 detect_quota_exhausted 注释)
|
|
551
564
|
try:
|
|
565
|
+
# 可信搜索为轻量补搜,默认 30 秒;深度搜索(deep_query.py)单次召回量大,默认 600 秒,两者按调用类型分别设定
|
|
552
566
|
response = requests.post(DEFAULT_BASE_URL, data=json.dumps(payload), headers=headers, timeout=30)
|
|
553
567
|
response.raise_for_status()
|
|
554
568
|
result = response.json()
|
|
@@ -608,7 +622,7 @@ def dkag_search(
|
|
|
608
622
|
|
|
609
623
|
# 如果需要清洗数据
|
|
610
624
|
if clean:
|
|
611
|
-
cleaned_result = clean_dkag_response(result)
|
|
625
|
+
cleaned_result = clean_dkag_response(result, search_channels=search_channels)
|
|
612
626
|
cleaned_result["search_meta"] = search_meta
|
|
613
627
|
cleaned_result["tid"] = search_meta.get("tid")
|
|
614
628
|
attach_knowledge_base_aliases(cleaned_result, knowledge_base_url or cleaned_result.get("knowledgeBase", ""))
|
|
@@ -31,7 +31,7 @@ import sys
|
|
|
31
31
|
from pathlib import Path
|
|
32
32
|
|
|
33
33
|
SKILL_ROOT = Path(__file__).resolve().parent.parent
|
|
34
|
-
# 工作区根:dsh 场景通过环境变量 DKNWOC_WS_ROOT 指向会话工作区,未设置时回退到 cwd
|
|
34
|
+
# 工作区根:dsh 场景通过环境变量 DKNWOC_WS_ROOT 指向会话工作区,未设置时回退到 cwd
|
|
35
35
|
import os as _os
|
|
36
36
|
_ws = _os.environ.get("DKNWOC_WS_ROOT")
|
|
37
37
|
if not _ws:
|
|
@@ -40,6 +40,7 @@ if not _ws:
|
|
|
40
40
|
_sid = _os.environ.get("DSH_SESSION_ID", "")
|
|
41
41
|
_ws = str(Path(_os.getcwd()) / "dknowc-output" / (_sid[:8] if _sid else "_default"))
|
|
42
42
|
WS_ROOT = Path(_ws).resolve()
|
|
43
|
+
|
|
43
44
|
INPUT_DIR = WS_ROOT / "official-docs" / "input"
|
|
44
45
|
|
|
45
46
|
# 文章列表可能出现的路径(不加 --clean 的原始结构 / 兼容其他同构结构)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
3
|
公文排版脚本 v2.0.0
|
|
4
|
-
|
|
4
|
+
严格按照 config/format.json 与 reference/standards/*.md 的格式规范进行自动排版
|
|
5
5
|
|
|
6
6
|
【v2.0.0 更新说明】
|
|
7
7
|
- 删除所有红头文件相关代码(红头+尾表由 template_generator.py 处理)
|
|
@@ -17,7 +17,10 @@ import sys
|
|
|
17
17
|
from datetime import datetime
|
|
18
18
|
from pathlib import Path
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
try:
|
|
21
|
+
import docx
|
|
22
|
+
except ImportError: # 顶层导入失败时给出可执行的安装提示,而不是堆栈
|
|
23
|
+
raise SystemExit("缺少依赖 python-docx,请先执行:python3 -m pip install python-docx")
|
|
21
24
|
import docx.opc.constants
|
|
22
25
|
from docx.enum.section import WD_ORIENT, WD_SECTION
|
|
23
26
|
from docx.enum.table import WD_CELL_VERTICAL_ALIGNMENT, WD_TABLE_ALIGNMENT
|
|
@@ -189,13 +192,29 @@ def get_configured_output_dir():
|
|
|
189
192
|
|
|
190
193
|
|
|
191
194
|
def is_path_within(path, parent):
|
|
192
|
-
"""判断 path 是否位于 parent
|
|
195
|
+
"""判断 path 是否位于 parent 目录内(按真实路径比较,解析符号链接)。"""
|
|
193
196
|
try:
|
|
194
197
|
return os.path.commonpath([os.path.realpath(path), os.path.realpath(parent)]) == os.path.realpath(parent)
|
|
195
198
|
except ValueError:
|
|
196
199
|
return False
|
|
197
200
|
|
|
198
201
|
|
|
202
|
+
def read_text_auto(path):
|
|
203
|
+
"""按 utf-8-sig → utf-8 → gb18030 依次尝试读取正文,全部失败时给出明确提示。
|
|
204
|
+
|
|
205
|
+
中文材料常由 Word/WPS 另存为 GBK,硬用 utf-8 会直接抛 UnicodeDecodeError;
|
|
206
|
+
这里统一回退,并提示用户另存为 UTF-8 以便排查。
|
|
207
|
+
"""
|
|
208
|
+
raw = open(path, "rb").read()
|
|
209
|
+
for enc in ("utf-8-sig", "utf-8", "gb18030"):
|
|
210
|
+
try:
|
|
211
|
+
return raw.decode(enc)
|
|
212
|
+
except UnicodeDecodeError:
|
|
213
|
+
continue
|
|
214
|
+
raise SystemExit(
|
|
215
|
+
f"错误:无法识别正文文件编码({path})。请用文本编辑器另存为 UTF-8 后重试。")
|
|
216
|
+
|
|
217
|
+
|
|
199
218
|
def resolve_input_text_path(input_path):
|
|
200
219
|
"""只允许读取 skill 工作目录内的正文文本文件(符号链接解析后校验)。"""
|
|
201
220
|
raw_path = os.path.expanduser(str(input_path).strip())
|
|
@@ -223,7 +242,7 @@ def _looks_like_path(text):
|
|
|
223
242
|
|
|
224
243
|
用于路径解析失败时的兜底判定:含路径分隔符,或以常见正文扩展名结尾时
|
|
225
244
|
视为路径——此时若文件读不到,宁可报错也不要把路径字符串当成正文写进 Word
|
|
226
|
-
|
|
245
|
+
(否则会静默生成一份正文只有一行路径的"正式公文")。
|
|
227
246
|
"""
|
|
228
247
|
value = (text or "").strip()
|
|
229
248
|
if not value or "\n" in value:
|
|
@@ -589,6 +608,41 @@ def strip_markdown_heading(line):
|
|
|
589
608
|
return stripped
|
|
590
609
|
|
|
591
610
|
|
|
611
|
+
SUBTITLE_FONT = '楷体_GB2312'
|
|
612
|
+
SUBTITLE_SIZE = 16 # 三号
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
def split_document_title(title):
|
|
616
|
+
"""长标题自动分行(机关通行排版)。
|
|
617
|
+
|
|
618
|
+
- 含破折号副标题(「主标题——副标题」):副标题另起一行,楷体三号;
|
|
619
|
+
- 主标题超过约 20 字且含「关于」:发文机关名单独一行,其余一行
|
|
620
|
+
(「中共四川省委 四川省人民政府关于……的实施意见」两行制);
|
|
621
|
+
- 其余情况保持单行。
|
|
622
|
+
"""
|
|
623
|
+
title = str(title or "").strip()
|
|
624
|
+
if not title:
|
|
625
|
+
return []
|
|
626
|
+
main, subtitle = title, ""
|
|
627
|
+
if "——" in title:
|
|
628
|
+
idx = title.find("——")
|
|
629
|
+
main = title[:idx].strip()
|
|
630
|
+
subtitle = title[idx + 2:].strip()
|
|
631
|
+
rows = []
|
|
632
|
+
if len(main) > 20 and "关于" in main:
|
|
633
|
+
idx = main.find("关于")
|
|
634
|
+
if 0 < idx <= 30:
|
|
635
|
+
rows.append({"text": main[:idx].strip(), "subtitle": False})
|
|
636
|
+
rows.append({"text": main[idx:].strip(), "subtitle": False})
|
|
637
|
+
else:
|
|
638
|
+
rows.append({"text": main, "subtitle": False})
|
|
639
|
+
else:
|
|
640
|
+
rows.append({"text": main, "subtitle": False})
|
|
641
|
+
if subtitle:
|
|
642
|
+
rows.append({"text": subtitle, "subtitle": True})
|
|
643
|
+
return [r for r in rows if r["text"]]
|
|
644
|
+
|
|
645
|
+
|
|
592
646
|
def has_markdown_title(lines):
|
|
593
647
|
"""判断正文是否已经包含 Markdown 公文标题。"""
|
|
594
648
|
return any(get_line_type(line.strip()) == 'title' for line in lines)
|
|
@@ -740,7 +794,13 @@ def _only_signature_tail(lines, index):
|
|
|
740
794
|
s = line.strip()
|
|
741
795
|
if not s or s == '[分页符]' or s.startswith('<!--'):
|
|
742
796
|
continue
|
|
743
|
-
|
|
797
|
+
# 单独一行"附件"表示附件正文页开始,其后内容属附件,不再参与落款判定
|
|
798
|
+
# (否则"附件"页的标题、表格题等正文行会让文末署名被误判为非落款,
|
|
799
|
+
# 连带成文日期也不右对齐)
|
|
800
|
+
if s == '附件':
|
|
801
|
+
break
|
|
802
|
+
# 成文日期后的「(联系人:…)」附注行属文末落款区,不影响署名判定
|
|
803
|
+
if is_date_line(s) or is_contact_info(s) or s.startswith(tail_prefixes):
|
|
744
804
|
continue
|
|
745
805
|
return False
|
|
746
806
|
return True
|
|
@@ -989,8 +1049,8 @@ def strip_citation_markers(content_text: str) -> str:
|
|
|
989
1049
|
|
|
990
1050
|
背景:素材清单先行要求写作时边写边标 [n] 角标——但角标只服务于
|
|
991
1051
|
build_trace_json 装配溯源 JSON、在溯源核验报告 HTML 中变成可点击跳转;
|
|
992
|
-
**正式 Word
|
|
993
|
-
|
|
1052
|
+
**正式 Word 交付的正文不应内嵌来源角标**(见 reference/output_guide.md 交付规则)。
|
|
1053
|
+
模型常把同一份带角标正文直接交给本脚本,导致 Word 交付物残留
|
|
994
1054
|
[1]…[23] 角标(带角标正文两用时,交付物曾残留 86~141 个角标)。
|
|
995
1055
|
本函数作为兜底,在排版前统一剥离半角 [n] 与全角 【n】 形式。
|
|
996
1056
|
"""
|
|
@@ -1203,15 +1263,35 @@ def text_width_score(text):
|
|
|
1203
1263
|
def compute_column_widths(table_rows, usable_width_dxa):
|
|
1204
1264
|
num_cols = max(len(row) for row in table_rows)
|
|
1205
1265
|
scores = []
|
|
1266
|
+
max_scores = []
|
|
1206
1267
|
for col_idx in range(num_cols):
|
|
1207
1268
|
values = [row[col_idx] if col_idx < len(row) else '' for row in table_rows]
|
|
1208
1269
|
max_score = max(text_width_score(value) for value in values) if values else 4
|
|
1209
1270
|
avg_score = sum(text_width_score(value) for value in values) / max(len(values), 1)
|
|
1271
|
+
max_scores.append(max_score)
|
|
1210
1272
|
scores.append(max(6, min(28, max_score * 0.65 + avg_score * 0.35)))
|
|
1211
1273
|
|
|
1212
1274
|
total_score = sum(scores) or num_cols
|
|
1213
|
-
|
|
1275
|
+
# 最小列宽按中文字宽设定:三号字单字约 320 twips,1300 约合 4 字,
|
|
1276
|
+
# 避免"金额""序号"这类短列表头被挤成两行
|
|
1277
|
+
min_width = 1300 if num_cols <= 6 else 1000
|
|
1214
1278
|
widths = [max(min_width, int(usable_width_dxa * score / total_score)) for score in scores]
|
|
1279
|
+
|
|
1280
|
+
# 短列按内容定型:最宽单元格(含单元格左右内边距 240twips)不超过版心 30% 的列,
|
|
1281
|
+
# 直接按其内容需求给宽,省出的宽度让给"测算说明""备注"这类长文本列,
|
|
1282
|
+
# 否则短列被挤成多行、长文本列反而留白。
|
|
1283
|
+
cell_margin = 240
|
|
1284
|
+
required = [score * 160 + cell_margin for score in max_scores]
|
|
1285
|
+
narrow = [i for i in range(num_cols) if required[i] <= usable_width_dxa * 0.30]
|
|
1286
|
+
if narrow and len(narrow) < num_cols:
|
|
1287
|
+
for i in narrow:
|
|
1288
|
+
widths[i] = max(min_width, required[i])
|
|
1289
|
+
rest = usable_width_dxa - sum(widths[i] for i in narrow)
|
|
1290
|
+
rest_score = sum(scores[i] for i in range(num_cols) if i not in narrow) or 1
|
|
1291
|
+
for i in range(num_cols):
|
|
1292
|
+
if i not in narrow:
|
|
1293
|
+
widths[i] = max(min_width, int(rest * scores[i] / rest_score))
|
|
1294
|
+
|
|
1215
1295
|
total_width = sum(widths)
|
|
1216
1296
|
if total_width != usable_width_dxa and total_width > 0:
|
|
1217
1297
|
widths[-1] += usable_width_dxa - total_width
|
|
@@ -1636,11 +1716,13 @@ def create_document(content_text, output_path=None):
|
|
|
1636
1716
|
# 公文标题(# 标题)
|
|
1637
1717
|
if line_type == 'title':
|
|
1638
1718
|
content = strip_markdown_heading(stripped)
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1719
|
+
for row in split_document_title(content):
|
|
1720
|
+
para = doc.add_paragraph()
|
|
1721
|
+
para.alignment = WD_ALIGN_PARAGRAPH.CENTER
|
|
1722
|
+
row_font, row_size = (SUBTITLE_FONT, SUBTITLE_SIZE) if row["subtitle"] else (title_font, title_size)
|
|
1723
|
+
add_formatted_text(para, row["text"], row_font, row_size)
|
|
1724
|
+
set_paragraph_format(para, first_line_indent=False, alignment=WD_ALIGN_PARAGRAPH.CENTER, line_spacing=title_line_spacing)
|
|
1725
|
+
set_outline_level(para, 0) # 文档标题设为1级
|
|
1644
1726
|
add_blank_paragraphs(doc, 1, body_line_spacing, body_font, body_size)
|
|
1645
1727
|
i += 1
|
|
1646
1728
|
continue
|
|
@@ -1711,35 +1793,30 @@ def create_document(content_text, output_path=None):
|
|
|
1711
1793
|
i += 1
|
|
1712
1794
|
continue
|
|
1713
1795
|
|
|
1714
|
-
#
|
|
1715
|
-
#
|
|
1796
|
+
# 联系行(成文日期之后的「(联系人:…,联系电话:…)」):机关通行附注排法——
|
|
1797
|
+
# 前空一行、左对齐、左空二字、保持圆括号。正文中间出现的独立联系段
|
|
1798
|
+
# 仍按普通正文渲染并提示(规范联系人电话写入正文事项段或置于文末)。
|
|
1716
1799
|
if is_contact_info(stripped):
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1800
|
+
if last_sign_date:
|
|
1801
|
+
add_blank_paragraphs(doc, 1, body_line_spacing, body_font, body_size)
|
|
1802
|
+
para = doc.add_paragraph()
|
|
1803
|
+
add_formatted_text(para, stripped, body_font, body_size)
|
|
1804
|
+
set_paragraph_format(para, indent_chars=2, line_spacing=body_line_spacing)
|
|
1805
|
+
i += 1
|
|
1806
|
+
continue
|
|
1807
|
+
print(f"格式提示:检测到正文中间的独立联系人段({stripped[:24]}…)——联系人电话应写入正文相关事项段,"
|
|
1808
|
+
f"或置于成文日期之后(空一行、圆括号);已按正文段落渲染。", file=sys.stderr)
|
|
1809
|
+
|
|
1810
|
+
# 落款日期:右对齐并右空二字,与署名右端对齐(署名末字同样右空二字)。
|
|
1811
|
+
# 不按署名长度动态缩进——按署名字数推"首字对齐"会把短署名(如五字机关名)
|
|
1812
|
+
# 推到行中,版式上显得"落款太靠中间"。
|
|
1726
1813
|
if should_right_align_date(lines, i):
|
|
1727
1814
|
last_sign_date = stripped
|
|
1728
|
-
date_text = re.sub(r'\s+', '', stripped)
|
|
1729
|
-
unit_len = len(re.sub(r'\s+', '', last_signing_entity))
|
|
1730
|
-
if len(date_text) > unit_len:
|
|
1731
|
-
date_indent = 2
|
|
1732
|
-
unit_indent = len(date_text) - unit_len + 4
|
|
1733
|
-
else:
|
|
1734
|
-
unit_indent = 2
|
|
1735
|
-
date_indent = max(2, unit_len - len(date_text))
|
|
1736
|
-
if last_signing_para is not None and last_signing_para._p.getparent() is not None:
|
|
1737
|
-
last_signing_para.paragraph_format.right_indent = Pt(body_size * unit_indent)
|
|
1738
1815
|
para = doc.add_paragraph()
|
|
1739
1816
|
para.alignment = WD_ALIGN_PARAGRAPH.RIGHT
|
|
1740
1817
|
add_formatted_text(para, stripped, body_font, body_size)
|
|
1741
1818
|
set_paragraph_format(para, first_line_indent=False, alignment=WD_ALIGN_PARAGRAPH.RIGHT, line_spacing=body_line_spacing)
|
|
1742
|
-
para.paragraph_format.right_indent = Pt(body_size *
|
|
1819
|
+
para.paragraph_format.right_indent = Pt(body_size * 2)
|
|
1743
1820
|
para.paragraph_format.keep_with_next = True
|
|
1744
1821
|
i += 1
|
|
1745
1822
|
continue
|
|
@@ -1810,10 +1887,9 @@ def main():
|
|
|
1810
1887
|
text_path = None
|
|
1811
1888
|
if text_path and os.path.exists(text_path) and os.path.isfile(text_path):
|
|
1812
1889
|
print(f'⚠ 检测到 --text 参数是文件路径,自动读取文件内容: {text_path}')
|
|
1813
|
-
|
|
1814
|
-
content = f.read()
|
|
1890
|
+
content = read_text_auto(text_path)
|
|
1815
1891
|
elif _looks_like_path(args.text):
|
|
1816
|
-
#
|
|
1892
|
+
# 路径解析失败时不得把路径字符串当正文——旧实现会生成一份
|
|
1817
1893
|
# 正文只有一行路径的"正式公文",且打印成功、退出码 0,用户与模型都无从察觉
|
|
1818
1894
|
raise SystemExit(
|
|
1819
1895
|
f'错误:--text 收到的是文件路径而非正文({args.text}),且该文件无法读取。\n'
|
|
@@ -1829,8 +1905,7 @@ def main():
|
|
|
1829
1905
|
elif args.input:
|
|
1830
1906
|
input_path = resolve_input_text_path(args.input)
|
|
1831
1907
|
if os.path.exists(input_path):
|
|
1832
|
-
|
|
1833
|
-
content = f.read()
|
|
1908
|
+
content = read_text_auto(input_path)
|
|
1834
1909
|
else:
|
|
1835
1910
|
raise FileNotFoundError(f"输入文件不存在: {input_path}")
|
|
1836
1911
|
else:
|
|
@@ -1848,7 +1923,7 @@ def main():
|
|
|
1848
1923
|
print(f'✗ 生成失败: {e}')
|
|
1849
1924
|
import traceback
|
|
1850
1925
|
traceback.print_exc()
|
|
1851
|
-
#
|
|
1926
|
+
# 旧实现失败分支不设退出码,宿主按退出码判断成败时会把
|
|
1852
1927
|
# 失败当成功继续走交付话术,用户收到不存在的路径
|
|
1853
1928
|
sys.exit(1)
|
|
1854
1929
|
|