chore: save local changes

This commit is contained in:
2026-01-05 22:32:08 +08:00
parent bc281b8e0a
commit ec48709755
42 changed files with 5576 additions and 254 deletions

View File

@@ -1,22 +1,43 @@
"""Transformation Agent 提示詞模組"""
"""Transformation Agent prompts module - Bilingual support"""
from typing import List
from .language_config import LanguageType
def get_keyword_generation_prompt(
category: str,
attributes: List[str],
keyword_count: int = 3
keyword_count: int = 3,
lang: LanguageType = "zh"
) -> str:
"""
Step 1: 生成新關鍵字
Step 1: Generate new keywords
給定類別和現有屬性,生成全新的、有創意的關鍵字。
不考慮原始查詢,只專注於類別本身可能的延伸。
Given a category and existing attributes, generate new, creative keywords.
Don't consider the original query, focus only on possible extensions of the category itself.
"""
attrs_text = "".join(attributes)
attrs_text = ", ".join(attributes) if lang == "en" else "".join(attributes)
return f"""/no_think
if lang == "en":
return f"""/no_think
You are a creative brainstorming expert. Given a category and its existing attributes, please generate new, creative keywords or descriptive phrases.
[Category] {category}
[Existing Attributes] {attrs_text}
[Important Rules]
1. Generate {keyword_count} completely new keywords
2. Keywords must fit within the scope of "{category}" category
3. Keywords should be creative and not duplicate or be too similar to existing attributes
4. Don't consider any specific object, focus only on possible extensions of this category
5. Each keyword should be 2-6 words
Return JSON only:
{{
"keywords": ["keyword1", "keyword2", "keyword3"]
}}"""
else:
return f"""/no_think
你是一個創意發想專家。給定一個類別和該類別下的現有屬性,請生成全新的、有創意的關鍵字或描述片段。
【類別】{category}
@@ -38,14 +59,36 @@ def get_keyword_generation_prompt(
def get_description_generation_prompt(
query: str,
category: str,
keyword: str
keyword: str,
lang: LanguageType = "zh"
) -> str:
"""
Step 2: 結合原始查詢生成描述
Step 2: Combine with original query to generate description
用新關鍵字創造一個與原始查詢相關的創新應用描述。
Use new keyword to create an innovative application description related to the original query.
"""
return f"""/no_think
if lang == "en":
return f"""/no_think
You are an innovation application expert. Please apply a new keyword concept to a specific object to create an innovative application description.
[Object] {query}
[Category] {category}
[New Keyword] {keyword}
[Task]
Using the concept of "{keyword}", create an innovative application description for "{query}".
The description should be a complete sentence or phrase explaining how to apply this new concept to the object.
[Example Format]
- If the object is "bicycle" and keyword is "monitor", you could generate "bicycle monitors the rider's health status"
- If the object is "umbrella" and keyword is "generate power", you could generate "umbrella generates electricity using raindrop impacts"
Return JSON only:
{{
"description": "innovative application description"
}}"""
else:
return f"""/no_think
你是一個創新應用專家。請將一個新的關鍵字概念應用到特定物件上,創造出創新的應用描述。
【物件】{query}
@@ -69,15 +112,35 @@ def get_description_generation_prompt(
def get_batch_description_prompt(
query: str,
category: str,
keywords: List[str]
keywords: List[str],
lang: LanguageType = "zh"
) -> str:
"""
批次生成描述(可選的優化版本,一次處理多個關鍵字)
Batch description generation (optional optimized version, process multiple keywords at once)
"""
keywords_text = "".join(keywords)
keywords_json = ", ".join([f'"{k}"' for k in keywords])
keywords_text = ", ".join(keywords) if lang == "en" else "".join(keywords)
return f"""/no_think
if lang == "en":
return f"""/no_think
You are an innovation application expert. Please apply multiple new keyword concepts to a specific object, creating an innovative application description for each keyword.
[Object] {query}
[Category] {category}
[New Keywords] {keywords_text}
[Task]
Create an innovative application description related to "{query}" for each keyword.
Each description should be a complete sentence or phrase.
Return JSON only:
{{
"descriptions": [
{{"keyword": "keyword1", "description": "description1"}},
{{"keyword": "keyword2", "description": "description2"}}
]
}}"""
else:
return f"""/no_think
你是一個創新應用專家。請將多個新的關鍵字概念應用到特定物件上,為每個關鍵字創造創新的應用描述。
【物件】{query}