sycommon-python-lib 0.2.0b30__tar.gz → 0.2.1__tar.gz
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.
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/PKG-INFO +21 -17
- sycommon_python_lib-0.2.1/pyproject.toml +54 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/command/cli.py +138 -11
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/command/core/models.py +17 -1
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/command/core/project.py +83 -22
- sycommon_python_lib-0.2.1/src/command/templates/agent/README.md.tpl +88 -0
- sycommon_python_lib-0.2.1/src/command/templates/agent/agent/__init__.py.tpl +6 -0
- sycommon_python_lib-0.2.1/src/command/templates/agent/agent/main_agent.py.tpl +51 -0
- sycommon_python_lib-0.2.1/src/command/templates/agent/agent/nodes/__init__.py.tpl +6 -0
- sycommon_python_lib-0.2.1/src/command/templates/agent/agent/nodes/example_node.py.tpl +33 -0
- sycommon_python_lib-0.2.1/src/command/templates/agent/agent/states/__init__.py.tpl +6 -0
- sycommon_python_lib-0.2.1/src/command/templates/agent/agent/states/agent_state.py.tpl +30 -0
- sycommon_python_lib-0.2.1/src/command/templates/agent/api/__init__.py.tpl +3 -0
- sycommon_python_lib-0.2.1/src/command/templates/agent/api/query.py.tpl +30 -0
- sycommon_python_lib-0.2.1/src/command/templates/agent/api/sse/__init__.py.tpl +6 -0
- sycommon_python_lib-0.2.1/src/command/templates/agent/api/sse/agent.py.tpl +30 -0
- sycommon_python_lib-0.2.1/src/command/templates/agent/app.py.tpl +95 -0
- sycommon_python_lib-0.2.1/src/command/templates/agent/client/__init__.py.tpl +3 -0
- sycommon_python_lib-0.2.1/src/command/templates/agent/db/__init__.py.tpl +8 -0
- sycommon_python_lib-0.2.1/src/command/templates/agent/db/model/__init__.py.tpl +8 -0
- sycommon_python_lib-0.2.1/src/command/templates/agent/db/model/entity.py.tpl +24 -0
- sycommon_python_lib-0.2.1/src/command/templates/agent/db/service.py.tpl +37 -0
- sycommon_python_lib-0.2.1/src/command/templates/agent/model/__init__.py.tpl +3 -0
- sycommon_python_lib-0.2.1/src/command/templates/agent/model/parse.py.tpl +22 -0
- sycommon_python_lib-0.2.1/src/command/templates/agent/tools/__init__.py.tpl +3 -0
- sycommon_python_lib-0.2.1/src/command/templates/agent/tools/mq.py.tpl +66 -0
- sycommon_python_lib-0.2.1/src/command/templates/base/.env.tpl +10 -0
- sycommon_python_lib-0.2.1/src/command/templates/base/.gitignore.tpl +38 -0
- sycommon_python_lib-0.2.1/src/command/templates/base/Dockerfile.tpl +19 -0
- sycommon_python_lib-0.2.1/src/command/templates/base/README.md.tpl +62 -0
- sycommon_python_lib-0.2.1/src/command/templates/base/app.py.tpl +66 -0
- sycommon_python_lib-0.2.1/src/command/templates/base/app.yaml.tpl +30 -0
- sycommon_python_lib-0.2.1/src/command/templates/base/client/FileServiceClient.py.tpl +15 -0
- sycommon_python_lib-0.2.1/src/command/templates/base/model/file_info.py.tpl +14 -0
- sycommon_python_lib-0.2.1/src/command/templates/base/requirements.txt.tpl +32 -0
- sycommon_python_lib-0.2.1/src/command/templates/web/README.md.tpl +80 -0
- sycommon_python_lib-0.2.1/src/command/templates/web/api/__init__.py.tpl +6 -0
- sycommon_python_lib-0.2.1/src/command/templates/web/api/echo.py.tpl +28 -0
- sycommon_python_lib-0.2.1/src/command/templates/web/api/sse/__init__.py.tpl +8 -0
- sycommon_python_lib-0.2.1/src/command/templates/web/api/sse/echo.py.tpl +37 -0
- sycommon_python_lib-0.2.1/src/command/templates/web/app.py.tpl +99 -0
- sycommon_python_lib-0.2.1/src/command/templates/web/client/__init__.py.tpl +3 -0
- sycommon_python_lib-0.2.1/src/command/templates/web/model/__init__.py.tpl +3 -0
- sycommon_python_lib-0.2.1/src/command/templates/web/tools/__init__.py.tpl +3 -0
- sycommon_python_lib-0.2.1/src/command/templates/web/tools/mq.py.tpl +29 -0
- sycommon_python_lib-0.2.1/src/nexus/__init__.py +97 -0
- sycommon_python_lib-0.2.1/src/sycli/__init__.py +3 -0
- sycommon_python_lib-0.2.1/src/sycli/__main__.py +6 -0
- sycommon_python_lib-0.2.1/src/sycli/agents/__init__.py +1 -0
- sycommon_python_lib-0.2.1/src/sycli/agents/factory.py +245 -0
- sycommon_python_lib-0.2.1/src/sycli/agents/prompts.py +469 -0
- sycommon_python_lib-0.2.1/src/sycli/cdp/__init__.py +1 -0
- sycommon_python_lib-0.2.1/src/sycli/cdp/browser.py +214 -0
- sycommon_python_lib-0.2.1/src/sycli/cdp/capabilities/__init__.py +1 -0
- sycommon_python_lib-0.2.1/src/sycli/cdp/capabilities/console.py +85 -0
- sycommon_python_lib-0.2.1/src/sycli/cdp/capabilities/dom.py +53 -0
- sycommon_python_lib-0.2.1/src/sycli/cdp/capabilities/network.py +119 -0
- sycommon_python_lib-0.2.1/src/sycli/cdp/capabilities/page_errors.py +91 -0
- sycommon_python_lib-0.2.1/src/sycli/cdp/capabilities/performance.py +67 -0
- sycommon_python_lib-0.2.1/src/sycli/cdp/capabilities/screenshot.py +61 -0
- sycommon_python_lib-0.2.1/src/sycli/cdp/client.py +148 -0
- sycommon_python_lib-0.2.1/src/sycli/cdp/protocol.py +133 -0
- sycommon_python_lib-0.2.1/src/sycli/cdp/repl.py +267 -0
- sycommon_python_lib-0.2.1/src/sycli/cli.py +558 -0
- sycommon_python_lib-0.2.1/src/sycli/commands/__init__.py +1 -0
- sycommon_python_lib-0.2.1/src/sycli/commands/cdp_cmd.py +271 -0
- sycommon_python_lib-0.2.1/src/sycli/commands/chat_cmd.py +283 -0
- sycommon_python_lib-0.2.1/src/sycli/commands/create_cmd.py +122 -0
- sycommon_python_lib-0.2.1/src/sycli/commands/evaluate_cmd.py +180 -0
- sycommon_python_lib-0.2.1/src/sycli/commands/init_cmd.py +164 -0
- sycommon_python_lib-0.2.1/src/sycli/commands/memory_cmd.py +168 -0
- sycommon_python_lib-0.2.1/src/sycli/commands/resume_cmd.py +234 -0
- sycommon_python_lib-0.2.1/src/sycli/commands/rollback_cmd.py +52 -0
- sycommon_python_lib-0.2.1/src/sycli/commands/run_cmd.py +112 -0
- sycommon_python_lib-0.2.1/src/sycli/core/__init__.py +31 -0
- sycommon_python_lib-0.2.1/src/sycli/core/backend.py +36 -0
- sycommon_python_lib-0.2.1/src/sycli/core/config.py +4 -0
- sycommon_python_lib-0.2.1/src/sycli/core/display.py +96 -0
- sycommon_python_lib-0.2.1/src/sycli/core/git_integration.py +198 -0
- sycommon_python_lib-0.2.1/src/sycli/core/llm.py +63 -0
- sycommon_python_lib-0.2.1/src/sycli/core/state.py +40 -0
- sycommon_python_lib-0.2.1/src/sycli/evaluate/__init__.py +1 -0
- sycommon_python_lib-0.2.1/src/sycli/evaluate/api_evaluator.py +696 -0
- sycommon_python_lib-0.2.1/src/sycli/memory/__init__.py +1 -0
- sycommon_python_lib-0.2.1/src/sycli/memory/compressor.py +134 -0
- sycommon_python_lib-0.2.1/src/sycli/memory/full.py +74 -0
- sycommon_python_lib-0.2.1/src/sycli/memory/hot.py +92 -0
- sycommon_python_lib-0.2.1/src/sycli/memory/manager.py +253 -0
- sycommon_python_lib-0.2.1/src/sycli/memory/warm.py +85 -0
- sycommon_python_lib-0.2.1/src/sycli/mode/__init__.py +1 -0
- sycommon_python_lib-0.2.1/src/sycli/mode/create.py +501 -0
- sycommon_python_lib-0.2.1/src/sycli/mode/optimize.py +40 -0
- sycommon_python_lib-0.2.1/src/sycli/models/__init__.py +1 -0
- sycommon_python_lib-0.2.1/src/sycli/models/config_models.py +212 -0
- sycommon_python_lib-0.2.1/src/sycli/rl/__init__.py +1 -0
- sycommon_python_lib-0.2.1/src/sycli/rl/baseline_tests.py +245 -0
- sycommon_python_lib-0.2.1/src/sycli/rl/checkpoint.py +497 -0
- sycommon_python_lib-0.2.1/src/sycli/rl/convergence.py +226 -0
- sycommon_python_lib-0.2.1/src/sycli/rl/diagnosis.py +195 -0
- sycommon_python_lib-0.2.1/src/sycli/rl/engine.py +1792 -0
- sycommon_python_lib-0.2.1/src/sycli/rl/environment.py +489 -0
- sycommon_python_lib-0.2.1/src/sycli/rl/experience.py +230 -0
- sycommon_python_lib-0.2.1/src/sycli/rl/harness_prompts.py +93 -0
- sycommon_python_lib-0.2.1/src/sycli/rl/history.py +136 -0
- sycommon_python_lib-0.2.1/src/sycli/rl/optimization_logger.py +264 -0
- sycommon_python_lib-0.2.1/src/sycli/rl/pre_validation.py +106 -0
- sycommon_python_lib-0.2.1/src/sycli/rl/reward.py +132 -0
- sycommon_python_lib-0.2.1/src/sycli/rl/strategy_bandit.py +291 -0
- sycommon_python_lib-0.2.1/src/sycli/rl/strategy_generator.py +218 -0
- sycommon_python_lib-0.2.1/src/sycli/rl/strategy_prompts.py +97 -0
- sycommon_python_lib-0.2.1/src/sycli/skills/__init__.py +5 -0
- sycommon_python_lib-0.2.1/src/sycommon/agent/__init__.py +150 -0
- sycommon_python_lib-0.2.1/src/sycommon/agent/agent_manager.py +445 -0
- sycommon_python_lib-0.2.1/src/sycommon/agent/chat_events.py +447 -0
- sycommon_python_lib-0.2.1/src/sycommon/agent/deep_agent.py +688 -0
- sycommon_python_lib-0.2.1/src/sycommon/agent/multi_agent_team.py +712 -0
- sycommon_python_lib-0.2.1/src/sycommon/agent/sandbox/__init__.py +99 -0
- sycommon_python_lib-0.2.1/src/sycommon/agent/sandbox/file_ops.py +638 -0
- sycommon_python_lib-0.2.1/src/sycommon/agent/sandbox/http_sandbox_backend.py +1147 -0
- sycommon_python_lib-0.2.1/src/sycommon/agent/sandbox/sandbox_pool.py +267 -0
- sycommon_python_lib-0.2.1/src/sycommon/agent/sandbox/sandbox_recovery.py +200 -0
- sycommon_python_lib-0.2.1/src/sycommon/agent/sandbox/session.py +82 -0
- sycommon_python_lib-0.2.1/src/sycommon/auth/__init__.py +46 -0
- sycommon_python_lib-0.2.1/src/sycommon/auth/ldap_service.py +340 -0
- sycommon_python_lib-0.2.1/src/sycommon/auth/wecom_ldap_service.py +490 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/config/Config.py +42 -16
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/config/LLMConfig.py +1 -0
- sycommon_python_lib-0.2.1/src/sycommon/config/XxlJobConfig.py +17 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/database/database_service.py +12 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/database/token_usage_db_service.py +5 -5
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/llm/embedding.py +65 -68
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/llm/get_llm.py +15 -3
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/llm/llm_tokens.py +8 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/llm/llm_with_token_tracking.py +28 -3
- sycommon_python_lib-0.2.1/src/sycommon/llm/native_with_fallback_runnable.py +201 -0
- sycommon_python_lib-0.2.1/src/sycommon/llm/output_fixing_runnable.py +216 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/llm/token_usage_mysql_service.py +285 -349
- sycommon_python_lib-0.2.1/src/sycommon/llm/usage_token.py +186 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/logging/kafka_log.py +41 -13
- sycommon_python_lib-0.2.1/src/sycommon/middleware/background_execution.py +568 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/middleware/middleware.py +6 -2
- sycommon_python_lib-0.2.1/src/sycommon/middleware/mq.py +8 -0
- sycommon_python_lib-0.2.1/src/sycommon/middleware/sandbox.py +1238 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/middleware/timeout.py +1 -1
- sycommon_python_lib-0.2.1/src/sycommon/middleware/token_tracking.py +173 -0
- sycommon_python_lib-0.2.1/src/sycommon/models/sandbox.py +249 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/models/sso_user.py +7 -1
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/models/token_usage_mysql.py +2 -2
- sycommon_python_lib-0.2.1/src/sycommon/models/xxljob_handler_config.py +11 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/rabbitmq/rabbitmq_service_producer_manager.py +1 -1
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/services.py +153 -16
- sycommon_python_lib-0.2.1/src/sycommon/sse/__init__.py +4 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/sse/sse.py +33 -22
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/synacos/feign.py +49 -4
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/synacos/feign_client.py +41 -16
- sycommon_python_lib-0.2.1/src/sycommon/synacos/nacos_client_base.py +171 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/synacos/nacos_config_manager.py +12 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/synacos/nacos_heartbeat_manager.py +4 -5
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/synacos/nacos_service.py +29 -22
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/synacos/nacos_service_discovery.py +19 -1
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/synacos/nacos_service_registration.py +0 -7
- sycommon_python_lib-0.2.1/src/sycommon/tests/deep_agent_server.py +535 -0
- sycommon_python_lib-0.2.1/src/sycommon/tests/test_deep_agent.py +160 -0
- sycommon_python_lib-0.2.1/src/sycommon/tools/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/tools/env.py +2 -2
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/tools/merge_headers.py +21 -3
- sycommon_python_lib-0.2.1/src/sycommon/xxljob/__init__.py +3 -0
- sycommon_python_lib-0.2.1/src/sycommon/xxljob/xxljob_service.py +196 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon_python_lib.egg-info/PKG-INFO +21 -17
- sycommon_python_lib-0.2.1/src/sycommon_python_lib.egg-info/SOURCES.txt +257 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon_python_lib.egg-info/entry_points.txt +2 -0
- sycommon_python_lib-0.2.1/src/sycommon_python_lib.egg-info/requires.txt +33 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon_python_lib.egg-info/top_level.txt +2 -0
- sycommon_python_lib-0.2.1/tests/test_sycli.py +1873 -0
- sycommon_python_lib-0.2.0b30/pyproject.toml +0 -47
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/__init__.py +0 -38
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/01_basic_agent.py +0 -134
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/02_tool_agent.py +0 -306
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/03_structured_output.py +0 -326
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/04_memory_agent.py +0 -349
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/05_streaming.py +0 -332
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/06_multi_agent.py +0 -460
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/07_skills_agent.py +0 -436
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/08_middleware.py +0 -295
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/09_interrupt.py +0 -465
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/10_custom_llm.py +0 -377
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/11_complex_workflow.py +0 -502
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/12_batch_processing.py +0 -457
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/__init__.py +0 -44
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/middleware/01_basic_monitoring.py +0 -492
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/middleware/02_permission_control.py +0 -740
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/middleware/03_tool_skill_filter.py +0 -806
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/middleware/04_caching_retry.py +0 -728
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/middleware/05_sanitization.py +0 -721
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/middleware/06_tracking.py +0 -649
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/middleware/07_advanced.py +0 -814
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/middleware/08_progressive_skills.py +0 -930
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/middleware/__init__.py +0 -40
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/middleware/override_examples.py +0 -547
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/examples/virtual_employee_demo.py +0 -463
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/exports.py +0 -107
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/get_agent.py +0 -205
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/skills/__init__.py +0 -18
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/skills/examples/faq_handler/scripts/search.py +0 -68
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/skills/exports.py +0 -78
- sycommon_python_lib-0.2.0b30/src/sycommon/agent/virtual_employee.py +0 -774
- sycommon_python_lib-0.2.0b30/src/sycommon/llm/native_smart_retry_runnable.py +0 -176
- sycommon_python_lib-0.2.0b30/src/sycommon/llm/smart_retry_runnable.py +0 -159
- sycommon_python_lib-0.2.0b30/src/sycommon/llm/usage_token.py +0 -249
- sycommon_python_lib-0.2.0b30/src/sycommon/middleware/mq.py +0 -9
- sycommon_python_lib-0.2.0b30/src/sycommon/synacos/nacos_client_base.py +0 -121
- sycommon_python_lib-0.2.0b30/src/sycommon_python_lib.egg-info/SOURCES.txt +0 -155
- sycommon_python_lib-0.2.0b30/src/sycommon_python_lib.egg-info/requires.txt +0 -29
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/README.md +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/setup.cfg +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/command/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/command/core/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/command/core/console.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/command/core/utils.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/command/templates/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/command/templates/agent/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/command/templates/base/__init__.py +0 -0
- /sycommon_python_lib-0.2.0b30/src/sycommon/__init__.py → /sycommon_python_lib-0.2.1/src/command/templates/base/client/__init__.py.tpl +0 -0
- /sycommon_python_lib-0.2.0b30/src/sycommon/config/__init__.py → /sycommon_python_lib-0.2.1/src/command/templates/base/model/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/command/templates/web/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b30/src/sycommon/health → sycommon_python_lib-0.2.1/src/sycommon}/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/config/DatabaseConfig.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/config/ElasticsearchConfig.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/config/EmbeddingConfig.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/config/LangfuseConfig.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/config/MQConfig.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/config/RedisConfig.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/config/RerankerConfig.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/config/SentryConfig.py +0 -0
- {sycommon_python_lib-0.2.0b30/src/sycommon/llm → sycommon_python_lib-0.2.1/src/sycommon/config}/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/database/async_base_db_service.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/database/async_database_service.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/database/base_db_service.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/database/elasticsearch_service.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/database/redis_service.py +0 -0
- {sycommon_python_lib-0.2.0b30/src/sycommon/logging → sycommon_python_lib-0.2.1/src/sycommon/health}/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/health/health_check.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/health/metrics.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/health/ping.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/heartbeat_process/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/heartbeat_process/heartbeat_config.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/heartbeat_process/heartbeat_process_manager.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/heartbeat_process/heartbeat_process_worker.py +0 -0
- {sycommon_python_lib-0.2.0b30/src/sycommon/middleware → sycommon_python_lib-0.2.1/src/sycommon/llm}/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/llm/llm_logger.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/llm/struct_token.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/llm/sy_langfuse.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/llm/token_usage_es_service.py +0 -0
- {sycommon_python_lib-0.2.0b30/src/sycommon/models → sycommon_python_lib-0.2.1/src/sycommon/logging}/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/logging/async_sql_logger.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/logging/logger_levels.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/logging/logger_wrapper.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/logging/process_logger.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/logging/sql_logger.py +0 -0
- {sycommon_python_lib-0.2.0b30/src/sycommon/notice → sycommon_python_lib-0.2.1/src/sycommon/middleware}/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/middleware/context.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/middleware/cors.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/middleware/docs.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/middleware/exception.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/middleware/monitor_memory.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/middleware/traceid.py +0 -0
- {sycommon_python_lib-0.2.0b30/src/sycommon/sentry → sycommon_python_lib-0.2.1/src/sycommon/models}/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/models/base_http.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/models/log.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/models/mqlistener_config.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/models/mqmsg_model.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/models/mqsend_config.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/models/token_usage.py +0 -0
- {sycommon_python_lib-0.2.0b30/src/sycommon/sse → sycommon_python_lib-0.2.1/src/sycommon/notice}/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/notice/uvicorn_monitor.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/rabbitmq/process_pool_consumer.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/rabbitmq/rabbitmq_client.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/rabbitmq/rabbitmq_pool.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/rabbitmq/rabbitmq_service.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/rabbitmq/rabbitmq_service_client_manager.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/rabbitmq/rabbitmq_service_connection_monitor.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/rabbitmq/rabbitmq_service_consumer_manager.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/rabbitmq/rabbitmq_service_core.py +0 -0
- {sycommon_python_lib-0.2.0b30/src/sycommon/tools → sycommon_python_lib-0.2.1/src/sycommon/sentry}/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/sentry/sy_sentry.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/sse/event.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/synacos/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/synacos/example.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/synacos/example2.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/synacos/param.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/tests/test_email.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/tests/test_mq.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/tools/async_utils.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/tools/docs.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/tools/snowflake.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/tools/syemail.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon/tools/timing.py +0 -0
- {sycommon_python_lib-0.2.0b30 → sycommon_python_lib-0.2.1}/src/sycommon_python_lib.egg-info/dependency_links.txt +0 -0
|
@@ -1,38 +1,42 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sycommon-python-lib
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Add your description here
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
|
-
Requires-Dist: aio-pika>=9.6.
|
|
8
|
-
Requires-Dist: aiohttp>=3.13.
|
|
7
|
+
Requires-Dist: aio-pika>=9.6.2
|
|
8
|
+
Requires-Dist: aiohttp>=3.13.5
|
|
9
9
|
Requires-Dist: aiomysql>=0.3.2
|
|
10
10
|
Requires-Dist: anyio>=4.12.1
|
|
11
11
|
Requires-Dist: decorator>=5.2.1
|
|
12
|
-
Requires-Dist: deepagents>=0.
|
|
12
|
+
Requires-Dist: deepagents>=0.5.3
|
|
13
13
|
Requires-Dist: elasticsearch>=9.3.0
|
|
14
|
-
Requires-Dist: fastapi>=0.
|
|
14
|
+
Requires-Dist: fastapi>=0.136.0
|
|
15
15
|
Requires-Dist: jinja2>=3.1.6
|
|
16
|
-
Requires-Dist: kafka-python>=2.3.
|
|
17
|
-
Requires-Dist: langchain>=1.2.
|
|
18
|
-
Requires-Dist: langchain-core>=1.
|
|
19
|
-
Requires-Dist: langchain-openai>=1.
|
|
20
|
-
Requires-Dist: langfuse>=4.
|
|
21
|
-
Requires-Dist: langgraph>=1.1.
|
|
16
|
+
Requires-Dist: kafka-python>=2.3.1
|
|
17
|
+
Requires-Dist: langchain>=1.2.15
|
|
18
|
+
Requires-Dist: langchain-core>=1.3.0
|
|
19
|
+
Requires-Dist: langchain-openai>=1.2.0
|
|
20
|
+
Requires-Dist: langfuse>=4.5.0
|
|
21
|
+
Requires-Dist: langgraph>=1.1.9
|
|
22
|
+
Requires-Dist: langgraph-checkpoint-redis>=0.4.1
|
|
23
|
+
Requires-Dist: ldap3>=2.9.1
|
|
22
24
|
Requires-Dist: loguru>=0.7.3
|
|
23
25
|
Requires-Dist: mysql-connector-python>=9.6.0
|
|
24
|
-
Requires-Dist: nacos-sdk-python<3.0,>=2.0.
|
|
26
|
+
Requires-Dist: nacos-sdk-python<3.0,>=2.0.11
|
|
25
27
|
Requires-Dist: psutil>=7.2.2
|
|
26
|
-
Requires-Dist:
|
|
28
|
+
Requires-Dist: pyxxl>=0.4.6
|
|
29
|
+
Requires-Dist: pydantic>=2.13.3
|
|
27
30
|
Requires-Dist: python-dotenv>=1.2.2
|
|
28
|
-
Requires-Dist: python-multipart>=0.0.
|
|
31
|
+
Requires-Dist: python-multipart>=0.0.26
|
|
29
32
|
Requires-Dist: pyyaml>=6.0.3
|
|
30
33
|
Requires-Dist: redis>=7.3.0
|
|
31
|
-
Requires-Dist: sentry-sdk[fastapi]>=2.
|
|
34
|
+
Requires-Dist: sentry-sdk[fastapi]>=2.58.0
|
|
32
35
|
Requires-Dist: sqlalchemy[asyncio]>=2.0.48
|
|
33
|
-
Requires-Dist: starlette>=0.
|
|
36
|
+
Requires-Dist: starlette[full]>=1.0.0
|
|
34
37
|
Requires-Dist: tiktoken>=0.12.0
|
|
35
|
-
Requires-Dist: uvicorn>=0.
|
|
38
|
+
Requires-Dist: uvicorn>=0.45.0
|
|
39
|
+
Requires-Dist: wecom-aibot-python-sdk>=1.0.2
|
|
36
40
|
|
|
37
41
|
# sycommon-python-lib
|
|
38
42
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "sycommon-python-lib"
|
|
3
|
+
version = "0.2.1"
|
|
4
|
+
description = "Add your description here"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"aio-pika>=9.6.2",
|
|
9
|
+
"aiohttp>=3.13.5",
|
|
10
|
+
"aiomysql>=0.3.2",
|
|
11
|
+
"anyio>=4.12.1",
|
|
12
|
+
"decorator>=5.2.1",
|
|
13
|
+
"deepagents>=0.5.3",
|
|
14
|
+
"elasticsearch>=9.3.0",
|
|
15
|
+
"fastapi>=0.136.0",
|
|
16
|
+
"jinja2>=3.1.6",
|
|
17
|
+
"kafka-python>=2.3.1",
|
|
18
|
+
"langchain>=1.2.15",
|
|
19
|
+
"langchain-core>=1.3.0",
|
|
20
|
+
"langchain-openai>=1.2.0",
|
|
21
|
+
"langfuse>=4.5.0",
|
|
22
|
+
"langgraph>=1.1.9",
|
|
23
|
+
"langgraph-checkpoint-redis>=0.4.1",
|
|
24
|
+
"ldap3>=2.9.1",
|
|
25
|
+
"loguru>=0.7.3",
|
|
26
|
+
"mysql-connector-python>=9.6.0",
|
|
27
|
+
"nacos-sdk-python>=2.0.11,<3.0",
|
|
28
|
+
"psutil>=7.2.2",
|
|
29
|
+
"pyxxl>=0.4.6",
|
|
30
|
+
"pydantic>=2.13.3",
|
|
31
|
+
"python-dotenv>=1.2.2",
|
|
32
|
+
"python-multipart>=0.0.26",
|
|
33
|
+
"pyyaml>=6.0.3",
|
|
34
|
+
"redis>=7.3.0",
|
|
35
|
+
"sentry-sdk[fastapi]>=2.58.0",
|
|
36
|
+
"sqlalchemy[asyncio]>=2.0.48",
|
|
37
|
+
"starlette[full]>=1.0.0",
|
|
38
|
+
"tiktoken>=0.12.0",
|
|
39
|
+
"uvicorn>=0.45.0",
|
|
40
|
+
"wecom-aibot-python-sdk>=1.0.2",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[tool.setuptools]
|
|
44
|
+
packages = {find = {where = ["src"], exclude = ["*.__pycache__", "*.__pycache__.*"]}}
|
|
45
|
+
package-data = {command = ["templates/**/*", "templates/**/.*"]}
|
|
46
|
+
|
|
47
|
+
[build-system]
|
|
48
|
+
requires = ["setuptools"]
|
|
49
|
+
build-backend = "setuptools.build_meta"
|
|
50
|
+
|
|
51
|
+
[project.scripts]
|
|
52
|
+
sycommon = "command.cli:main"
|
|
53
|
+
sycli = "sycli.cli:main"
|
|
54
|
+
sypublish = "nexus:main"
|
|
@@ -5,12 +5,15 @@ Usage:
|
|
|
5
5
|
sycommon init web my_project # 交互式创建Web项目
|
|
6
6
|
sycommon init agent my_project # 交互式创建Agent项目
|
|
7
7
|
sycommon init web my_project --with-db # 命令行指定功能
|
|
8
|
-
sycommon
|
|
8
|
+
sycommon init agent my_project --port 9090
|
|
9
9
|
sycommon doctor # 项目健康检查
|
|
10
|
+
sycommon list # 查看可用模板
|
|
11
|
+
sycommon version # 显示版本
|
|
10
12
|
"""
|
|
11
13
|
import argparse
|
|
12
14
|
import sys
|
|
13
15
|
from importlib.metadata import version, PackageNotFoundError
|
|
16
|
+
from importlib.resources import files
|
|
14
17
|
|
|
15
18
|
from .core.models import FeatureOptions
|
|
16
19
|
from .core.project import init_project
|
|
@@ -39,6 +42,7 @@ def create_init_parser(subparsers) -> None:
|
|
|
39
42
|
sycommon init web my_project --dry-run # 预览将要创建的文件
|
|
40
43
|
sycommon init web my_project --force # 强制覆盖已存在的目录
|
|
41
44
|
sycommon init web my_project -q # 静默模式(使用默认配置)
|
|
45
|
+
sycommon init agent my_project --port 9090
|
|
42
46
|
sycommon init web my_project --with-db --with-mq --with-redis --with-es
|
|
43
47
|
|
|
44
48
|
项目类型说明:
|
|
@@ -48,9 +52,10 @@ def create_init_parser(subparsers) -> None:
|
|
|
48
52
|
Agent 项目结构:
|
|
49
53
|
agent/ - Agent 核心 (main_agent, nodes, states, enums)
|
|
50
54
|
api/sse/ - SSE 流式接口
|
|
55
|
+
api/query.py - 查询接口
|
|
51
56
|
tools/ - 工具函数 (含 MQ 处理)
|
|
52
57
|
db/ - 数据库服务
|
|
53
|
-
model/ - 数据模型
|
|
58
|
+
model/ - 数据模型 (含 parse.py 请求模型)
|
|
54
59
|
|
|
55
60
|
Web 项目结构:
|
|
56
61
|
api/ - API 接口 (含 SSE)
|
|
@@ -116,6 +121,8 @@ Web 项目结构:
|
|
|
116
121
|
"-q", "--quiet", action="store_true", help="静默模式")
|
|
117
122
|
behavior_group.add_argument(
|
|
118
123
|
"-v", "--verbose", action="store_true", help="详细输出")
|
|
124
|
+
behavior_group.add_argument(
|
|
125
|
+
"--port", type=int, default=8080, help="服务端口 (默认: 8080)")
|
|
119
126
|
|
|
120
127
|
|
|
121
128
|
def handle_init_command(args) -> bool:
|
|
@@ -126,7 +133,29 @@ def handle_init_command(args) -> bool:
|
|
|
126
133
|
args.no_nacos, args.no_kafka, args.no_llm, args.no_sentry
|
|
127
134
|
])
|
|
128
135
|
|
|
129
|
-
|
|
136
|
+
# 静默模式使用项目类型推荐默认值
|
|
137
|
+
if args.quiet:
|
|
138
|
+
features = FeatureOptions.defaults_for(args.project_type)
|
|
139
|
+
# 覆盖命令行明确指定的选项
|
|
140
|
+
if args.with_db:
|
|
141
|
+
features.database = True
|
|
142
|
+
if args.with_mq:
|
|
143
|
+
features.rabbitmq = True
|
|
144
|
+
if args.with_sse:
|
|
145
|
+
features.sse = True
|
|
146
|
+
if args.with_redis:
|
|
147
|
+
features.redis = True
|
|
148
|
+
if args.with_es:
|
|
149
|
+
features.elasticsearch = True
|
|
150
|
+
if args.no_nacos:
|
|
151
|
+
features.nacos = False
|
|
152
|
+
if args.no_kafka:
|
|
153
|
+
features.kafka_log = False
|
|
154
|
+
if args.no_llm:
|
|
155
|
+
features.llm = False
|
|
156
|
+
if args.no_sentry:
|
|
157
|
+
features.sentry = False
|
|
158
|
+
elif use_cli_mode:
|
|
130
159
|
features = FeatureOptions(
|
|
131
160
|
database=args.with_db,
|
|
132
161
|
rabbitmq=args.with_mq,
|
|
@@ -149,7 +178,8 @@ def handle_init_command(args) -> bool:
|
|
|
149
178
|
features=features,
|
|
150
179
|
dry_run=args.dry_run,
|
|
151
180
|
force=args.force,
|
|
152
|
-
verbose=verbose
|
|
181
|
+
verbose=verbose,
|
|
182
|
+
port=args.port,
|
|
153
183
|
)
|
|
154
184
|
|
|
155
185
|
|
|
@@ -164,11 +194,12 @@ def create_doctor_parser(subparsers) -> None:
|
|
|
164
194
|
sycommon doctor # 检查当前目录
|
|
165
195
|
sycommon doctor /path/to/project # 检查指定目录
|
|
166
196
|
|
|
167
|
-
|
|
197
|
+
检查项:
|
|
198
|
+
- 项目类型检测 (web / agent)
|
|
199
|
+
- 必要文件和目录完整性
|
|
168
200
|
- 依赖安装状态
|
|
169
201
|
- 配置文件完整性
|
|
170
|
-
-
|
|
171
|
-
- 代码规范检查
|
|
202
|
+
- Python 版本
|
|
172
203
|
"""
|
|
173
204
|
)
|
|
174
205
|
doctor_parser.add_argument(
|
|
@@ -184,6 +215,17 @@ def create_doctor_parser(subparsers) -> None:
|
|
|
184
215
|
)
|
|
185
216
|
|
|
186
217
|
|
|
218
|
+
def _detect_project_type(project_path) -> str | None:
|
|
219
|
+
"""检测项目类型"""
|
|
220
|
+
from pathlib import Path
|
|
221
|
+
if (project_path / "agent" / "main_agent.py").exists() or \
|
|
222
|
+
(project_path / "agent" / "enums").is_dir():
|
|
223
|
+
return "agent"
|
|
224
|
+
if (project_path / "api").is_dir():
|
|
225
|
+
return "web"
|
|
226
|
+
return None
|
|
227
|
+
|
|
228
|
+
|
|
187
229
|
def handle_doctor_command(args) -> bool:
|
|
188
230
|
"""处理 doctor 命令"""
|
|
189
231
|
from pathlib import Path
|
|
@@ -197,6 +239,13 @@ def handle_doctor_command(args) -> bool:
|
|
|
197
239
|
issues = []
|
|
198
240
|
warnings = []
|
|
199
241
|
|
|
242
|
+
# 0. 检测项目类型
|
|
243
|
+
project_type = _detect_project_type(project_path)
|
|
244
|
+
if project_type:
|
|
245
|
+
print_success(f"项目类型: {project_type}")
|
|
246
|
+
else:
|
|
247
|
+
warnings.append("无法识别项目类型 (非 web / agent 标准结构)")
|
|
248
|
+
|
|
200
249
|
# 1. 检查必要文件
|
|
201
250
|
required_files = ["app.py", "requirements.txt"]
|
|
202
251
|
for file in required_files:
|
|
@@ -209,10 +258,29 @@ def handle_doctor_command(args) -> bool:
|
|
|
209
258
|
if not (project_path / file).exists():
|
|
210
259
|
warnings.append(f"缺少配置文件: {file}")
|
|
211
260
|
|
|
212
|
-
# 3.
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
261
|
+
# 3. 根据项目类型检查目录结构
|
|
262
|
+
if project_type == "agent":
|
|
263
|
+
required_dirs = ["agent", "api", "model", "tools"]
|
|
264
|
+
agent_subdirs = ["agent/nodes", "agent/states", "agent/enums"]
|
|
265
|
+
for dir_name in agent_subdirs:
|
|
266
|
+
if not (project_path / dir_name).is_dir():
|
|
267
|
+
warnings.append(f"缺少 Agent 目录: {dir_name}/")
|
|
268
|
+
# 检查 agent 关键文件
|
|
269
|
+
agent_files = [
|
|
270
|
+
"agent/main_agent.py",
|
|
271
|
+
"agent/enums/node_type.py",
|
|
272
|
+
"agent/states/agent_state.py",
|
|
273
|
+
]
|
|
274
|
+
for file in agent_files:
|
|
275
|
+
if not (project_path / file).exists():
|
|
276
|
+
issues.append(f"缺少 Agent 核心文件: {file}")
|
|
277
|
+
elif project_type == "web":
|
|
278
|
+
required_dirs = ["api", "model", "tools", "client"]
|
|
279
|
+
else:
|
|
280
|
+
required_dirs = ["api", "model", "tools"]
|
|
281
|
+
|
|
282
|
+
for dir_name in required_dirs:
|
|
283
|
+
if not (project_path / dir_name).is_dir():
|
|
216
284
|
warnings.append(f"缺少推荐目录: {dir_name}/")
|
|
217
285
|
|
|
218
286
|
# 4. 检查 Python 版本
|
|
@@ -244,6 +312,8 @@ def handle_doctor_command(args) -> bool:
|
|
|
244
312
|
("uvicorn", "Uvicorn"),
|
|
245
313
|
("sycommon", "sycommon-python-lib"),
|
|
246
314
|
]
|
|
315
|
+
if project_type == "agent":
|
|
316
|
+
packages.append(("langgraph", "LangGraph"))
|
|
247
317
|
for module, name in packages:
|
|
248
318
|
spec = importlib.util.find_spec(module)
|
|
249
319
|
if spec:
|
|
@@ -262,6 +332,59 @@ def handle_doctor_command(args) -> bool:
|
|
|
262
332
|
return True
|
|
263
333
|
|
|
264
334
|
|
|
335
|
+
def handle_list_command(args) -> bool:
|
|
336
|
+
"""处理 list 命令 - 显示可用模板"""
|
|
337
|
+
template_root = files("command.templates")
|
|
338
|
+
|
|
339
|
+
print(f"\n{Colors.HEADER}📋 可用项目模板{Colors.ENDC}")
|
|
340
|
+
print("-" * 50)
|
|
341
|
+
|
|
342
|
+
templates = {
|
|
343
|
+
"web": {
|
|
344
|
+
"desc": "标准 FastAPI Web 服务",
|
|
345
|
+
"dirs": ["api/", "api/sse/", "tools/", "model/", "client/"],
|
|
346
|
+
"features": "nacos, kafka_log, llm, sentry (默认启用)",
|
|
347
|
+
},
|
|
348
|
+
"agent": {
|
|
349
|
+
"desc": "AI Agent 服务 (LangGraph 状态图)",
|
|
350
|
+
"dirs": ["agent/", "agent/nodes/", "agent/states/", "agent/enums/",
|
|
351
|
+
"api/sse/", "api/query.py", "tools/", "model/", "db/"],
|
|
352
|
+
"features": "nacos, kafka_log, llm, sentry (默认启用)",
|
|
353
|
+
},
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
for name, info in templates.items():
|
|
357
|
+
print(f"\n{Colors.OKGREEN}{name}{Colors.ENDC} - {info['desc']}")
|
|
358
|
+
print(f" 目录结构:")
|
|
359
|
+
for d in info["dirs"]:
|
|
360
|
+
exists = (template_root / name / d.replace("/", "")).exists() if d.endswith("/") else True
|
|
361
|
+
marker = "✓" if exists else "?"
|
|
362
|
+
print(f" {marker} {d}")
|
|
363
|
+
print(f" 默认功能: {info['features']}")
|
|
364
|
+
|
|
365
|
+
# 列出所有功能选项
|
|
366
|
+
print(f"\n{Colors.HEADER}功能模块{Colors.ENDC}")
|
|
367
|
+
print("-" * 50)
|
|
368
|
+
features = [
|
|
369
|
+
("database", "MySQL 数据库 (SQLAlchemy)", False),
|
|
370
|
+
("rabbitmq", "RabbitMQ 消息队列", False),
|
|
371
|
+
("nacos", "Nacos 服务注册与配置中心", True),
|
|
372
|
+
("kafka_log", "Kafka 日志收集", True),
|
|
373
|
+
("sse", "Server-Sent Events 流式响应", False),
|
|
374
|
+
("llm", "LLM 大模型 (LangChain/LangGraph)", True),
|
|
375
|
+
("redis", "Redis 缓存服务", False),
|
|
376
|
+
("elasticsearch", "Elasticsearch 搜索/日志", False),
|
|
377
|
+
("sentry", "Sentry 错误监控", True),
|
|
378
|
+
]
|
|
379
|
+
for name, desc, default in features:
|
|
380
|
+
status = "默认启用" if default else "默认禁用"
|
|
381
|
+
flag = f"--with-{name.replace('_', '-')}" if not default else f"--no-{name.replace('_', '-')}"
|
|
382
|
+
print(f" {name:20s} {desc:30s} [{status}] ({flag})")
|
|
383
|
+
|
|
384
|
+
print(f"\n{Colors.OKCYAN}使用 sycommon init <type> <name> 创建项目{Colors.ENDC}")
|
|
385
|
+
return True
|
|
386
|
+
|
|
387
|
+
|
|
265
388
|
def main() -> None:
|
|
266
389
|
"""CLI 主入口"""
|
|
267
390
|
parser = argparse.ArgumentParser(
|
|
@@ -276,6 +399,7 @@ def main() -> None:
|
|
|
276
399
|
create_init_parser(subparsers)
|
|
277
400
|
create_doctor_parser(subparsers)
|
|
278
401
|
subparsers.add_parser("version", help="显示版本信息")
|
|
402
|
+
subparsers.add_parser("list", help="显示可用模板和功能模块")
|
|
279
403
|
|
|
280
404
|
try:
|
|
281
405
|
args = parser.parse_args()
|
|
@@ -294,6 +418,9 @@ def main() -> None:
|
|
|
294
418
|
if not success:
|
|
295
419
|
sys.exit(1)
|
|
296
420
|
|
|
421
|
+
if args.command == "list":
|
|
422
|
+
handle_list_command(args)
|
|
423
|
+
|
|
297
424
|
except argparse.ArgumentError as e:
|
|
298
425
|
print_error(str(e))
|
|
299
426
|
cmd = args.command if 'args' in locals() and hasattr(args, 'command') else ''
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
"""
|
|
2
2
|
CLI 数据模型
|
|
3
3
|
"""
|
|
4
|
-
from dataclasses import dataclass
|
|
4
|
+
from dataclasses import dataclass
|
|
5
5
|
from typing import Dict
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
# Agent 项目默认启用的功能
|
|
9
|
+
AGENT_DEFAULTS = {
|
|
10
|
+
"database": True,
|
|
11
|
+
"rabbitmq": True,
|
|
12
|
+
"sse": True,
|
|
13
|
+
"llm": True,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
8
17
|
@dataclass
|
|
9
18
|
class FeatureOptions:
|
|
10
19
|
"""功能模块选项"""
|
|
@@ -18,6 +27,13 @@ class FeatureOptions:
|
|
|
18
27
|
elasticsearch: bool = False # Elasticsearch 日志/Token记录
|
|
19
28
|
sentry: bool = True # Sentry 错误监控,默认开启
|
|
20
29
|
|
|
30
|
+
@classmethod
|
|
31
|
+
def defaults_for(cls, project_type: str) -> "FeatureOptions":
|
|
32
|
+
"""根据项目类型返回推荐默认配置"""
|
|
33
|
+
if project_type == "agent":
|
|
34
|
+
return cls(**AGENT_DEFAULTS)
|
|
35
|
+
return cls()
|
|
36
|
+
|
|
21
37
|
def to_template_vars(self) -> dict:
|
|
22
38
|
"""转换为模板变量"""
|
|
23
39
|
return {
|
|
@@ -17,8 +17,25 @@ from .console import (
|
|
|
17
17
|
from .utils import get_all_files_in_directory
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
def
|
|
21
|
-
"""
|
|
20
|
+
def _get_current_user() -> str:
|
|
21
|
+
"""获取当前用户名,兼容容器/CI 等无 tty 环境。"""
|
|
22
|
+
try:
|
|
23
|
+
return os.getlogin()
|
|
24
|
+
except OSError:
|
|
25
|
+
# 容器、CI、非交互式 shell 等环境下 os.getlogin() 会失败
|
|
26
|
+
import getpass
|
|
27
|
+
return getpass.getuser() or "unknown"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def interactive_feature_selection(project_type: str = "web") -> FeatureOptions:
|
|
31
|
+
"""交互式功能选择
|
|
32
|
+
|
|
33
|
+
提示默认值从 FeatureOptions 数据类获取,保证 --quiet 模式和
|
|
34
|
+
交互模式使用完全一致的默认值。
|
|
35
|
+
"""
|
|
36
|
+
# 根据项目类型获取推荐默认值
|
|
37
|
+
defaults = FeatureOptions.defaults_for(project_type)
|
|
38
|
+
|
|
22
39
|
print(f"\n{Colors.HEADER}🔧 功能模块配置{Colors.ENDC}")
|
|
23
40
|
print("-" * 40)
|
|
24
41
|
|
|
@@ -35,15 +52,15 @@ def interactive_feature_selection() -> FeatureOptions:
|
|
|
35
52
|
print_warning("请输入 y/n")
|
|
36
53
|
|
|
37
54
|
return FeatureOptions(
|
|
38
|
-
database=ask_yes_no("启用数据库 (MySQL)?", default=
|
|
39
|
-
rabbitmq=ask_yes_no("启用 RabbitMQ 消息队列?", default=
|
|
40
|
-
nacos=ask_yes_no("启用 Nacos 服务注册?", default=
|
|
41
|
-
kafka_log=ask_yes_no("启用 Kafka 日志?", default=
|
|
42
|
-
sse=ask_yes_no("启用 SSE 流式响应?", default=
|
|
43
|
-
llm=ask_yes_no("启用 LLM 大模型支持?", default=
|
|
44
|
-
redis=ask_yes_no("启用 Redis 缓存?", default=
|
|
45
|
-
elasticsearch=ask_yes_no("启用 Elasticsearch?", default=
|
|
46
|
-
sentry=ask_yes_no("启用 Sentry 错误监控?", default=
|
|
55
|
+
database=ask_yes_no("启用数据库 (MySQL)?", default=defaults.database),
|
|
56
|
+
rabbitmq=ask_yes_no("启用 RabbitMQ 消息队列?", default=defaults.rabbitmq),
|
|
57
|
+
nacos=ask_yes_no("启用 Nacos 服务注册?", default=defaults.nacos),
|
|
58
|
+
kafka_log=ask_yes_no("启用 Kafka 日志?", default=defaults.kafka_log),
|
|
59
|
+
sse=ask_yes_no("启用 SSE 流式响应?", default=defaults.sse),
|
|
60
|
+
llm=ask_yes_no("启用 LLM 大模型支持?", default=defaults.llm),
|
|
61
|
+
redis=ask_yes_no("启用 Redis 缓存?", default=defaults.redis),
|
|
62
|
+
elasticsearch=ask_yes_no("启用 Elasticsearch?", default=defaults.elasticsearch),
|
|
63
|
+
sentry=ask_yes_no("启用 Sentry 错误监控?", default=defaults.sentry),
|
|
47
64
|
)
|
|
48
65
|
|
|
49
66
|
|
|
@@ -53,7 +70,8 @@ def init_project(
|
|
|
53
70
|
features: Optional[FeatureOptions] = None,
|
|
54
71
|
dry_run: bool = False,
|
|
55
72
|
force: bool = False,
|
|
56
|
-
verbose: bool = True
|
|
73
|
+
verbose: bool = True,
|
|
74
|
+
port: int = 8080
|
|
57
75
|
) -> bool:
|
|
58
76
|
"""
|
|
59
77
|
初始化项目,自动读取模板文件并替换占位符
|
|
@@ -65,6 +83,7 @@ def init_project(
|
|
|
65
83
|
dry_run: 仅预览,不实际创建文件
|
|
66
84
|
force: 强制覆盖已存在的目录
|
|
67
85
|
verbose: 显示详细输出
|
|
86
|
+
port: 服务端口
|
|
68
87
|
|
|
69
88
|
Returns:
|
|
70
89
|
是否成功
|
|
@@ -85,7 +104,7 @@ def init_project(
|
|
|
85
104
|
# 交互式功能选择
|
|
86
105
|
if features is None:
|
|
87
106
|
try:
|
|
88
|
-
features = interactive_feature_selection()
|
|
107
|
+
features = interactive_feature_selection(project_type)
|
|
89
108
|
except KeyboardInterrupt:
|
|
90
109
|
print("\n")
|
|
91
110
|
print_info("操作已取消")
|
|
@@ -100,26 +119,65 @@ def init_project(
|
|
|
100
119
|
# 处理项目名称
|
|
101
120
|
short_project_name = project_name.replace("shengye-platform-", "")
|
|
102
121
|
short_project_name_upper = short_project_name.upper()
|
|
122
|
+
# 生成合法的 Python 标识符(用于类名、变量名)
|
|
123
|
+
# "goodsprice-parse" -> "GoodspriceParse", "GOODSPRICE_PARSE"
|
|
124
|
+
safe_identifier = re.sub(r'[^a-zA-Z0-9]', '_', short_project_name)
|
|
125
|
+
safe_class_name = "".join(part.capitalize() for part in safe_identifier.split("_") if part)
|
|
126
|
+
safe_upper_name = safe_identifier.upper()
|
|
127
|
+
|
|
103
128
|
|
|
104
129
|
# 定义模板变量
|
|
105
130
|
context = {
|
|
106
131
|
"project_name": project_name,
|
|
107
132
|
"short_project_name": short_project_name,
|
|
108
133
|
"short_project_name_upper": short_project_name_upper,
|
|
134
|
+
"safe_class_name": safe_class_name,
|
|
135
|
+
"safe_upper_name": safe_upper_name,
|
|
136
|
+
"safe_identifier": safe_identifier,
|
|
109
137
|
"project_type": project_type,
|
|
110
138
|
"create_time": datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
|
111
|
-
"author":
|
|
112
|
-
"default_port":
|
|
139
|
+
"author": _get_current_user(),
|
|
140
|
+
"default_port": port,
|
|
113
141
|
}
|
|
114
142
|
context.update(features.to_template_vars())
|
|
115
143
|
|
|
144
|
+
# 文件过滤:跳过不需要的模块
|
|
145
|
+
feature_map = {
|
|
146
|
+
'feature_rabbitmq': [
|
|
147
|
+
'tools/mq.py', 'tools/mq.py.tpl',
|
|
148
|
+
],
|
|
149
|
+
'feature_sse': [
|
|
150
|
+
'api/sse/', 'sse/',
|
|
151
|
+
],
|
|
152
|
+
'feature_database': [
|
|
153
|
+
'db/', 'db/service.py', 'db/model/', 'db/model/entity.py',
|
|
154
|
+
],
|
|
155
|
+
}
|
|
156
|
+
disabled_features = {
|
|
157
|
+
key for key, flag_val in features.to_template_vars().items()
|
|
158
|
+
if flag_val == 'false' and key in feature_map
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
def _should_skip(rel_path: str) -> bool:
|
|
162
|
+
"""检查文件是否因功能关闭而应跳过"""
|
|
163
|
+
for feat_key in disabled_features:
|
|
164
|
+
for pattern in feature_map[feat_key]:
|
|
165
|
+
if pattern in rel_path:
|
|
166
|
+
return True
|
|
167
|
+
return False
|
|
168
|
+
|
|
116
169
|
# 获取模板文件
|
|
117
170
|
base_dir = template_root / "base"
|
|
118
171
|
type_dir = template_root / project_type
|
|
119
172
|
|
|
120
173
|
base_files = get_all_files_in_directory(base_dir)
|
|
121
174
|
type_specific_files = get_all_files_in_directory(type_dir)
|
|
122
|
-
|
|
175
|
+
|
|
176
|
+
# 过滤掉不需要的文件
|
|
177
|
+
file_mappings = []
|
|
178
|
+
for abs_path, rel_path in base_files + type_specific_files:
|
|
179
|
+
if not _should_skip(rel_path):
|
|
180
|
+
file_mappings.append((abs_path, rel_path))
|
|
123
181
|
|
|
124
182
|
# Dry run 模式
|
|
125
183
|
if dry_run:
|
|
@@ -197,12 +255,13 @@ def _render_files(
|
|
|
197
255
|
pattern = re.compile(rf'{{\s*{re.escape(key)}\s*}}')
|
|
198
256
|
rendered_content = pattern.sub(str(value), rendered_content)
|
|
199
257
|
|
|
200
|
-
#
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
258
|
+
# 清理引号(仅对 .py 文件,避免破坏 YAML/JSON/Dockerfile 等格式)
|
|
259
|
+
if target_rel_path.endswith('.py') or target_rel_path.endswith('.py.tpl'):
|
|
260
|
+
rendered_content = re.sub(
|
|
261
|
+
r'(\w+)\s*:\s*["\']([^"\']+)["\']',
|
|
262
|
+
r'\1: \2',
|
|
263
|
+
rendered_content
|
|
264
|
+
)
|
|
206
265
|
|
|
207
266
|
# 处理文件后缀
|
|
208
267
|
if target_rel_path.endswith('.tpl'):
|
|
@@ -234,5 +293,7 @@ def _print_success_message(
|
|
|
234
293
|
print()
|
|
235
294
|
print_info("下一步操作:")
|
|
236
295
|
print(f" cd {project_name}")
|
|
296
|
+
print(f" # 建议先创建虚拟环境")
|
|
297
|
+
print(f" python -m venv .venv && source .venv/bin/activate")
|
|
237
298
|
print(f" pip install -r requirements.txt")
|
|
238
299
|
print(f" python app.py")
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# {{ project_name }}
|
|
2
|
+
|
|
3
|
+
{{ project_name }} - AI Agent 服务
|
|
4
|
+
|
|
5
|
+
## 项目结构
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
{{ project_name }}/
|
|
9
|
+
├── agent/ # Agent 核心模块
|
|
10
|
+
│ ├── __init__.py
|
|
11
|
+
│ ├── main_agent.py # Agent 主入口
|
|
12
|
+
│ ├── enums/ # 枚举定义
|
|
13
|
+
│ │ └── node_type.py # 节点类型
|
|
14
|
+
│ ├── nodes/ # 处理节点
|
|
15
|
+
│ │ └── example_node.py
|
|
16
|
+
│ └── states/ # 状态定义
|
|
17
|
+
│ └── agent_state.py
|
|
18
|
+
├── api/ # API 路由
|
|
19
|
+
│ └── sse/
|
|
20
|
+
│ └── agent.py # SSE 流式接口
|
|
21
|
+
├── model/ # 数据模型
|
|
22
|
+
├── tools/ # 工具函数
|
|
23
|
+
│ └── mq.py # MQ 消息处理
|
|
24
|
+
├── client/ # 外部服务客户端
|
|
25
|
+
├── db/ # 数据库层
|
|
26
|
+
│ ├── service.py # 服务类
|
|
27
|
+
│ └── model/ # 数据库模型
|
|
28
|
+
├── app.py # 应用入口
|
|
29
|
+
├── app.yaml # 应用配置
|
|
30
|
+
└── README.md
|
|
31
|
+
|
|
32
|
+
## 快速开始
|
|
33
|
+
|
|
34
|
+
### 安装依赖
|
|
35
|
+
```bash
|
|
36
|
+
pip install -r requirements.txt
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 启动服务
|
|
40
|
+
```bash
|
|
41
|
+
python app.py
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 测试接口
|
|
45
|
+
|
|
46
|
+
#### SSE 流式接口
|
|
47
|
+
```bash
|
|
48
|
+
curl -X POST http://localhost:{{ default_port }}/v1/sse/parse \
|
|
49
|
+
-H "Content-Type: application/json" \
|
|
50
|
+
-d '{"bizCode": "test", "fileList": ["file-id-1"]}'
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
#### 查询接口
|
|
54
|
+
```bash
|
|
55
|
+
curl -X POST http://localhost:{{ default_port }}/v1/query \
|
|
56
|
+
-H "Content-Type: application/json" \
|
|
57
|
+
-d '{"bizCode": "test", "fileList": ["file-id-1"]}'
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## 部署说明
|
|
61
|
+
|
|
62
|
+
### Docker 构建
|
|
63
|
+
```bash
|
|
64
|
+
docker build -t {{ project_name }} .
|
|
65
|
+
docker run -p {{ default_port }}:{{ default_port }} {{ project_name }}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Nacos 配置
|
|
69
|
+
|
|
70
|
+
1. 同步 nacos 配置 {{ project_name }}
|
|
71
|
+
|
|
72
|
+
2. 配置网关
|
|
73
|
+
|
|
74
|
+
```yaml
|
|
75
|
+
- id: "{{ project_name }}"
|
|
76
|
+
uri: lb://{{ project_name }}
|
|
77
|
+
filters:
|
|
78
|
+
- AddRequestHeader=X-Request-Gateway,{{ short_project_name }}
|
|
79
|
+
- StripPrefix=1
|
|
80
|
+
predicates:
|
|
81
|
+
- Path=/{{ short_project_name }}/**
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## 核心依赖
|
|
85
|
+
|
|
86
|
+
- sycommon-python-lib: 公共基础库
|
|
87
|
+
- langgraph: Agent 状态图框架
|
|
88
|
+
- langchain: LLM 链式调用
|