### Install PyYAML Source: https://github.com/huangserva/skill-prompt-generator/blob/main/README_v2.0.md Install the PyYAML library using pip if it is not already installed. ```bash pip install pyyaml ``` -------------------------------- ### Backward Compatibility Example Source: https://github.com/huangserva/skill-prompt-generator/blob/main/README_v2.0.md Demonstrates how to use the IntelligentGenerator for backward compatibility with v1.0 of the system. This method is still valid for older projects. ```python # v1.0 method (still valid) from intelligent_generator import IntelligentGenerator gen = IntelligentGenerator() elements = gen.select_elements_by_intent(intent) prompt = gen.compose_prompt(elements) ``` -------------------------------- ### Check PyYAML Installation Source: https://github.com/huangserva/skill-prompt-generator/blob/main/README_v2.0.md Verify if the PyYAML library is installed. If not, it provides instructions to install it using pip. ```python python3 -c "import yaml; print('✅ PyYAML installed')" ``` -------------------------------- ### Modern Minimalist Border Shadow Example Source: https://github.com/huangserva/skill-prompt-generator/blob/main/design-logic/modern-minimal/principles.md Example CSS properties for creating a subtle border radius and box shadow typical in modern minimalist designs. ```css border-radius: 8px box-shadow: 0 2px 8px rgba(0,0,0,0.06) ``` -------------------------------- ### Example: Backward Compatible Portrait Generation Source: https://github.com/huangserva/skill-prompt-generator/blob/main/UPGRADE_GUIDE_v2.0.md Demonstrates generating a pure portrait using the CrossDomainGenerator, which is backward compatible with v1.0 functionality. The output includes the generated prompt, its type, and metadata. ```python generator = CrossDomainGenerator() result = generator.generate("生成一个年轻女性肖像") # Output: # { # 'prompt': 'female, young adult, East Asian, almond brown eyes, ...', # 'type': 'portrait', # 'metadata': {'element_count': 14, 'issues_fixed': 0} # } ``` -------------------------------- ### Example: Design Poster Generation Source: https://github.com/huangserva/skill-prompt-generator/blob/main/UPGRADE_GUIDE_v2.0.md Shows how to generate a design-oriented output, such as a poster. The CrossDomainGenerator automatically detects the 'design' type and utilizes both SQLite elements and YAML variables (like color schemes and decorations) to produce the prompt. ```python result = generator.generate("温馨可爱风格的儿童教育海报") # Auto-detected: design type # Output: # { ``` -------------------------------- ### Modern Minimalist Color Palette Example Source: https://github.com/huangserva/skill-prompt-generator/blob/main/design-logic/modern-minimal/principles.md Example of a typical color combination for a modern minimalist style, including primary, secondary, background, text, and decorative colors. ```text 主色:#6366F1(靛蓝) 辅色:#8B5CF6(紫色) 背景:#FFFFFF(纯白) 文字:#1F2937(深灰) 装饰:几何线条 opacity:0.08 ``` -------------------------------- ### Schema Migration for Database Source: https://github.com/huangserva/skill-prompt-generator/blob/main/README_v2.0.md This bash command extends the database by adding variable tables. It requires SQLite to be installed. ```bash # Extend database, add variable tables sqlite3 extracted_results/elements.db < core/schema_migration_v1.sql ``` -------------------------------- ### Example: Cross-Domain Complex Scene Generation Source: https://github.com/huangserva/skill-prompt-generator/blob/main/UPGRADE_GUIDE_v2.0.md Illustrates generating a complex scene requiring multiple domains. The CrossDomainGenerator automatically identifies and combines elements from 'portrait', 'video', 'art', and 'common' domains to create a detailed prompt. ```python result = generator.generate("龙珠动漫的蜡像3D感悟空打出龟派气功") # Auto-detected: requires portrait + video + art + common # Output: # { # 'prompt': '...(complete prompt text including character, action, effects, lighting)...', # 'type': 'cross_domain', # 'metadata': { # 'domains_used': ['portrait', 'video', 'art', 'common'], # 'element_count': 12 # } # } ``` -------------------------------- ### Portrait Generation Mode Source: https://github.com/huangserva/skill-prompt-generator/blob/main/README_v2.0.md Use this mode for generating portrait images. The example shows a prompt for a young female portrait. ```python result = generator.generate("Generate a portrait of a young female") # Type: portrait # Usage: portrait domain (502 elements) ``` -------------------------------- ### Cross-Domain Generation Mode Source: https://github.com/huangserva/skill-prompt-generator/blob/main/README_v2.0.md This mode is for generating prompts that span multiple domains, such as combining character actions with artistic styles. The example uses a Dragon Ball character. ```python result = generator.generate("Dragon Ball Goku using Kamehameha wave,蜡像3D effect") # Type: cross_domain # Usage: portrait + video + art + common (4 domains) ``` -------------------------------- ### Using IntelligentGenerator (v1.0) and CrossDomainGenerator (v2.0) Source: https://github.com/huangserva/skill-prompt-generator/blob/main/UPGRADE_GUIDE_v2.0.md Demonstrates how to use both the v1.0 IntelligentGenerator and the recommended v2.0 CrossDomainGenerator. Old code using IntelligentGenerator remains valid. ```python # v1.0 方式(仍然有效) from intelligent_generator import IntelligentGenerator gen = IntelligentGenerator() elements = gen.select_elements_by_intent(intent) prompt = gen.compose_prompt(elements) # v2.0 方式(推荐,但可选) from core.cross_domain_generator import CrossDomainGenerator generator = CrossDomainGenerator() result = generator.generate(user_input) ``` -------------------------------- ### Run All Tests Source: https://github.com/huangserva/skill-prompt-generator/blob/main/README_v2.0.md Execute tests for various components of the system, including variable samplers, cross-domain query, and the unified interface. ```bash # Test variable sampler python3 core/variable_sampler.py # Test cross-domain query python3 core/cross_domain_query.py # Test YAML sampler python3 core/yaml_sampler.py # Test design bridge python3 core/design_bridge.py # Test unified interface python3 core/cross_domain_generator.py ``` -------------------------------- ### Use Unified Interface for Generation Source: https://github.com/huangserva/skill-prompt-generator/blob/main/UPGRADE_GUIDE_v2.0.md Recommended method for generating prompts. Automatically identifies the required generation type (portrait, design, or cross-domain) and routes to the appropriate generator. Ensure to close the generator instance after use. ```python from core.cross_domain_generator import CrossDomainGenerator generator = CrossDomainGenerator() # Auto-detect type and generate result = generator.generate("龙珠悟空打出龟派气功的蜡像3D感") print(result['prompt']) # Complete prompt text print(result['type']) # Generation type: portrait/design/cross_domain print(result['metadata']) # Metadata generator.close() ``` -------------------------------- ### Basic Usage of CrossDomainGenerator Source: https://github.com/huangserva/skill-prompt-generator/blob/main/README_v2.0.md Instantiate the generator and use it to generate prompts. The system automatically identifies the prompt type. Remember to close the generator when done. ```python from core.cross_domain_generator import CrossDomainGenerator # Create generator generator = CrossDomainGenerator() # Generate prompt (auto-detect type) result = generator.generate("Dragon Ball Goku using Kamehameha wave,蜡像3D effect") print(result['prompt']) # Full prompt print(result['type']) # Type: portrait/cross_domain/design generator.close() ``` -------------------------------- ### Directly Use Sub-Generators Source: https://github.com/huangserva/skill-prompt-generator/blob/main/UPGRADE_GUIDE_v2.0.md For advanced use cases, you can directly instantiate and use the specific sub-generators: CrossDomainQueryEngine for cross-domain queries, DesignVariableBridge for design prompts, and IntelligentGenerator for backward-compatible portrait generation. ```python # Cross-domain query from core.cross_domain_query import CrossDomainQueryEngine engine = CrossDomainQueryEngine() elements = engine.query_by_intent(intent) # Design generation from core.design_bridge import DesignVariableBridge bridge = DesignVariableBridge() result = bridge.generate_design_prompt(intent) # Pure portrait (original method, backward compatible) from intelligent_generator import IntelligentGenerator gen = IntelligentGenerator() elements = gen.select_elements_by_intent(intent) prompt = gen.compose_prompt(elements) ``` -------------------------------- ### Design Generation Mode Source: https://github.com/huangserva/skill-prompt-generator/blob/main/README_v2.0.md Utilize this mode for creating design-related prompts, like posters or cards. It integrates with SQLite elements and YAML variables for color schemes and decorations. ```python result = generator.generate("Warm and cute style children's educational poster") # Type: design # Usage: SQLite elements + YAML variables (color scheme, borders, decorations) ``` -------------------------------- ### Specify Generation Type with Unified Interface Source: https://github.com/huangserva/skill-prompt-generator/blob/main/UPGRADE_GUIDE_v2.0.md When using the unified interface, you can explicitly specify the desired generation type if needed, overriding automatic detection. Supported types include 'portrait', 'design', and 'cross_domain'. ```python # Force a specific generation type result = generator.generate( "年轻女性肖像", generation_type='portrait' # or 'design' or 'cross_domain' ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.