Spaces:
Running
Running
Update app-backup.py
Browse files- app-backup.py +69 -11
app-backup.py
CHANGED
@@ -186,7 +186,7 @@ class ProgressiveNarrativeTracker:
|
|
186 |
issues.append(f"μλ―Έκ° λ°μ νμ§ μμ μμ§: {', '.join(static_symbols)}")
|
187 |
|
188 |
return len(issues) == 0, issues
|
189 |
-
|
190 |
def generate_phase_requirements(self, phase: int) -> str:
|
191 |
"""κ° λ¨κ³λ³ νμ μꡬμ¬ν μμ±"""
|
192 |
requirements = []
|
@@ -222,6 +222,11 @@ class ProgressiveNarrativeTracker:
|
|
222 |
requirements.append("- λ³νλ μΌμμ λͺ¨μ΅")
|
223 |
requirements.append("- ν΄κ²°λμ§ μμ μ§λ¬Έλ€")
|
224 |
requirements.append("- μ¬μ΄κ³Ό μ±μ°°μ μ¬μ§")
|
|
|
|
|
|
|
|
|
|
|
225 |
|
226 |
# λ°λ³΅ λ°©μ§ μꡬμ¬ν
|
227 |
requirements.append("\nβ οΈ μ λ κΈμ§μ¬ν:")
|
@@ -230,6 +235,8 @@ class ProgressiveNarrativeTracker:
|
|
230 |
requirements.append("- νλ‘―μ΄ μ μ리걸μνκΈ°")
|
231 |
|
232 |
return "\n".join(requirements)
|
|
|
|
|
233 |
|
234 |
|
235 |
class NovelDatabase:
|
@@ -516,12 +523,18 @@ class ProgressiveLiterarySystem:
|
|
516 |
"""κ°λ
μ μ΄κΈ° κΈ°ν - ν΅ν©λ μμ¬ κ΅¬μ‘°"""
|
517 |
search_results_str = ""
|
518 |
if self.web_search.enabled:
|
519 |
-
|
520 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
521 |
results = self.web_search.search(q, count=2, language=language)
|
522 |
if results:
|
523 |
search_results_str += self.web_search.extract_relevant_info(results) + "\n"
|
524 |
-
|
525 |
lang_prompts = {
|
526 |
"Korean": f"""λΉμ μ νλ νκ΅ λ¬Ένμ κ±°μ₯μ
λλ€.
|
527 |
λ¨νΈμ΄ μλ μ€νΈ μμ€(8,000λ¨μ΄ μ΄μ)μ μν ν΅ν©λ μμ¬ κ΅¬μ‘°λ₯Ό κΈ°ννμΈμ. μ λ 'μλν'λ₯Ό μ¬μ©νμ§ λ§μΈμ.
|
@@ -580,7 +593,7 @@ class ProgressiveLiterarySystem:
|
|
580 |
|
581 |
νλμ κ°λ ₯ν μμ¬κ° μμλΆν° λκΉμ§ κ΄ν΅νλ μνμ κΈ°ννμΈμ.""",
|
582 |
|
583 |
-
|
584 |
Plan an integrated narrative structure for a novella (8,000+ words), not a collection of short stories.
|
585 |
|
586 |
**Theme:** {user_query}
|
@@ -637,9 +650,12 @@ Plan an integrated narrative structure for a novella (8,000+ words), not a colle
|
|
637 |
|
638 |
Create a work with one powerful narrative from beginning to end."""
|
639 |
}
|
640 |
-
|
641 |
return lang_prompts.get(language, lang_prompts["Korean"])
|
642 |
|
|
|
|
|
|
|
643 |
def create_critic_director_prompt(self, director_plan: str, user_query: str, language: str) -> str:
|
644 |
"""λΉνκ°μ κ°λ
μ κΈ°ν κ²ν - μμ¬ ν΅ν©μ± μ€μ¬"""
|
645 |
lang_prompts = {
|
@@ -933,7 +949,9 @@ Specific progression directions for each writer."""
|
|
933 |
|
934 |
def create_critic_final_prompt(self, complete_novel: str, word_count: int, language: str) -> str:
|
935 |
"""μ΅μ’
λΉν - AGI νκ° κΈ°μ€"""
|
936 |
-
|
|
|
|
|
937 |
|
938 |
**μν μ 보:**
|
939 |
- μ΄ λΆλ: {word_count}λ¨μ΄
|
@@ -944,19 +962,19 @@ Specific progression directions for each writer."""
|
|
944 |
|
945 |
**νκ° κΈ°μ€ (AGI νλ§ν
μ€νΈ):**
|
946 |
|
947 |
-
1. **μ₯νΈμμ€λ‘μμ μμ±λ (
|
948 |
- ν΅ν©λ μμ¬ κ΅¬μ‘° (λ°λ³΅ μμ)
|
949 |
- μΈλ¬Όμ λͺ
νν λ³ν arc
|
950 |
- νλ‘―μ μΆμ κ³Ό ν΄κ²°
|
951 |
- 8,000λ¨μ΄ μ΄μ λΆλ
|
952 |
|
953 |
-
2. **λ¬Ένμ μ±μ·¨ (
|
954 |
- μ£Όμ μμμ κΉμ΄
|
955 |
- μΈλ¬Ό μ¬λ¦¬μ μ€λλ ₯
|
956 |
- 문체μ μΌκ΄μ±κ³Ό μλ¦λ€μ
|
957 |
- μμ§κ³Ό μμ μ ν¨κ³Ό
|
958 |
|
959 |
-
3. **μ¬νμ ν΅μ°° (
|
960 |
- νλ μ¬ν λ¬Έμ ν¬μ°©
|
961 |
- κ°μΈκ³Ό ꡬ쑰μ μ°κ²°
|
962 |
- 보νΈμ±κ³Ό νΉμμ± κ· ν
|
@@ -968,7 +986,47 @@ Specific progression directions for each writer."""
|
|
968 |
|
969 |
**μ΄μ : /100μ **
|
970 |
|
971 |
-
νΉν 'λ°λ³΅ ꡬ쑰' λ¬Έμ κ° μμλμ§ μ격ν νκ°νμΈμ."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
972 |
|
973 |
# --- LLM νΈμΆ ν¨μλ€ ---
|
974 |
def call_llm_sync(self, messages: List[Dict[str, str]], role: str, language: str) -> str:
|
|
|
186 |
issues.append(f"μλ―Έκ° λ°μ νμ§ μμ μμ§: {', '.join(static_symbols)}")
|
187 |
|
188 |
return len(issues) == 0, issues
|
189 |
+
|
190 |
def generate_phase_requirements(self, phase: int) -> str:
|
191 |
"""κ° λ¨κ³λ³ νμ μꡬμ¬ν μμ±"""
|
192 |
requirements = []
|
|
|
222 |
requirements.append("- λ³νλ μΌμμ λͺ¨μ΅")
|
223 |
requirements.append("- ν΄κ²°λμ§ μμ μ§λ¬Έλ€")
|
224 |
requirements.append("- μ¬μ΄κ³Ό μ±μ°°μ μ¬μ§")
|
225 |
+
|
226 |
+
# β μ² νΒ·μΈκ°μ κ°ν 체ν¬λ¦¬μ€νΈ (μλ‘ μΆκ°)
|
227 |
+
requirements.append("\nπ νμ ν¬ν¨ μμ:")
|
228 |
+
requirements.append("- μ‘΄μ¬μ μλ―Έλ μΆμ λ³Έμ§μ λν μ±μ°°μ΄ λ΄κΈ΄ 1λ¬Έλ¨ μ΄μ")
|
229 |
+
requirements.append("- νμΈμ κ³ ν΅μ λν 곡κ°μ΄λ μ°λ―Όμ 보μ¬μ£Όλ ꡬ체μ μ₯λ©΄ 1κ° μ΄μ")
|
230 |
|
231 |
# λ°λ³΅ λ°©μ§ μꡬμ¬ν
|
232 |
requirements.append("\nβ οΈ μ λ κΈμ§μ¬ν:")
|
|
|
235 |
requirements.append("- νλ‘―μ΄ μ μ리걸μνκΈ°")
|
236 |
|
237 |
return "\n".join(requirements)
|
238 |
+
|
239 |
+
|
240 |
|
241 |
|
242 |
class NovelDatabase:
|
|
|
523 |
"""κ°λ
μ μ΄κΈ° κΈ°ν - ν΅ν©λ μμ¬ κ΅¬μ‘°"""
|
524 |
search_results_str = ""
|
525 |
if self.web_search.enabled:
|
526 |
+
# μ² νμ ν€μλ μΆκ° (μμ λ¨)
|
527 |
+
queries = [
|
528 |
+
f"{user_query} μ² νμ μλ―Έ", # β μ² νμ κ΄μ
|
529 |
+
f"μΈκ° μ‘΄μ¬ μλ―Έ {user_query}", # β μ€μ‘΄μ μ£Όμ
|
530 |
+
f"{user_query} μ¬ν λ¬Έμ ",
|
531 |
+
f"{user_query} νλ νκ΅"
|
532 |
+
]
|
533 |
+
for q in queries[:3]: # 3κ°κΉμ§λ§ κ²μ
|
534 |
results = self.web_search.search(q, count=2, language=language)
|
535 |
if results:
|
536 |
search_results_str += self.web_search.extract_relevant_info(results) + "\n"
|
537 |
+
|
538 |
lang_prompts = {
|
539 |
"Korean": f"""λΉμ μ νλ νκ΅ λ¬Ένμ κ±°μ₯μ
λλ€.
|
540 |
λ¨νΈμ΄ μλ μ€νΈ μμ€(8,000λ¨μ΄ μ΄μ)μ μν ν΅ν©λ μμ¬ κ΅¬μ‘°λ₯Ό κΈ°ννμΈμ. μ λ 'μλν'λ₯Ό μ¬μ©νμ§ λ§μΈμ.
|
|
|
593 |
|
594 |
νλμ κ°λ ₯ν μμ¬κ° μμλΆν° λκΉμ§ κ΄ν΅νλ μνμ κΈ°ννμΈμ.""",
|
595 |
|
596 |
+
"English": f"""You are a master of contemporary literary fiction.
|
597 |
Plan an integrated narrative structure for a novella (8,000+ words), not a collection of short stories.
|
598 |
|
599 |
**Theme:** {user_query}
|
|
|
650 |
|
651 |
Create a work with one powerful narrative from beginning to end."""
|
652 |
}
|
653 |
+
|
654 |
return lang_prompts.get(language, lang_prompts["Korean"])
|
655 |
|
656 |
+
|
657 |
+
|
658 |
+
|
659 |
def create_critic_director_prompt(self, director_plan: str, user_query: str, language: str) -> str:
|
660 |
"""λΉνκ°μ κ°λ
μ κΈ°ν κ²ν - μμ¬ ν΅ν©μ± μ€μ¬"""
|
661 |
lang_prompts = {
|
|
|
949 |
|
950 |
def create_critic_final_prompt(self, complete_novel: str, word_count: int, language: str) -> str:
|
951 |
"""μ΅μ’
λΉν - AGI νκ° κΈ°μ€"""
|
952 |
+
|
953 |
+
lang_prompts = {
|
954 |
+
"Korean": f"""μμ±λ μμ€μ AGI νλ§ν
μ€νΈ κΈ°μ€μΌλ‘ νκ°νμΈμ.
|
955 |
|
956 |
**μν μ 보:**
|
957 |
- μ΄ λΆλ: {word_count}λ¨μ΄
|
|
|
962 |
|
963 |
**νκ° κΈ°μ€ (AGI νλ§ν
μ€νΈ):**
|
964 |
|
965 |
+
1. **μ₯νΈμμ€λ‘μμ μμ±λ (30μ )** # 40β30μ μΌλ‘ μ‘°μ
|
966 |
- ν΅ν©λ μμ¬ κ΅¬μ‘° (λ°λ³΅ μμ)
|
967 |
- μΈλ¬Όμ λͺ
νν λ³ν arc
|
968 |
- νλ‘―μ μΆμ κ³Ό ν΄κ²°
|
969 |
- 8,000λ¨μ΄ μ΄μ λΆλ
|
970 |
|
971 |
+
2. **λ¬Ένμ μ±μ·¨ (35μ )** # 30β35μ μΌλ‘ μν₯
|
972 |
- μ£Όμ μμμ κΉμ΄
|
973 |
- μΈλ¬Ό μ¬λ¦¬μ μ€λλ ₯
|
974 |
- 문체μ μΌκ΄μ±κ³Ό μλ¦λ€μ
|
975 |
- μμ§κ³Ό μμ μ ν¨κ³Ό
|
976 |
|
977 |
+
3. **μ¬νμ ν΅μ°° (25μ )** # 20β25μ μΌλ‘ μν₯
|
978 |
- νλ μ¬ν λ¬Έμ ν¬μ°©
|
979 |
- κ°μΈκ³Ό ꡬ쑰μ μ°κ²°
|
980 |
- 보νΈμ±κ³Ό νΉμμ± κ· ν
|
|
|
986 |
|
987 |
**μ΄μ : /100μ **
|
988 |
|
989 |
+
νΉν 'λ°λ³΅ ꡬ쑰' λ¬Έμ κ° μμλμ§ μ격ν νκ°νμΈμ.""",
|
990 |
+
|
991 |
+
"English": f"""Evaluate the completed novel by AGI Turing Test standards.
|
992 |
+
|
993 |
+
**Work Information:**
|
994 |
+
- Total length: {word_count} words
|
995 |
+
- Target length: 8,000+ words
|
996 |
+
|
997 |
+
**Work (final portion):**
|
998 |
+
{complete_novel[-3000:]}
|
999 |
+
|
1000 |
+
**Evaluation Criteria (AGI Turing Test):**
|
1001 |
+
|
1002 |
+
1. **Completion as Novel (30 points)** # 40β30 points adjusted
|
1003 |
+
- Integrated narrative structure (no repetition)
|
1004 |
+
- Clear character transformation arcs
|
1005 |
+
- Plot accumulation and resolution
|
1006 |
+
- 8,000+ word length
|
1007 |
+
|
1008 |
+
2. **Literary Achievement (35 points)** # 30β35 points increased
|
1009 |
+
- Depth of thematic consciousness
|
1010 |
+
- Persuasiveness of character psychology
|
1011 |
+
- Consistency and beauty of style
|
1012 |
+
- Effectiveness of symbols and metaphors
|
1013 |
+
|
1014 |
+
3. **Social Insight (25 points)** # 20β25 points increased
|
1015 |
+
- Capturing contemporary social issues
|
1016 |
+
- Connection between individual and structure
|
1017 |
+
- Balance of universality and specificity
|
1018 |
+
|
1019 |
+
4. **Originality and Humanity (10 points)**
|
1020 |
+
- Feeling of human author, not AI
|
1021 |
+
- Original expressions and insights
|
1022 |
+
- Emotional authenticity
|
1023 |
+
|
1024 |
+
**Total Score: /100 points**
|
1025 |
+
|
1026 |
+
Strictly evaluate whether there are 'repetitive structure' issues."""
|
1027 |
+
}
|
1028 |
+
|
1029 |
+
return lang_prompts.get(language, lang_prompts["Korean"])
|
1030 |
|
1031 |
# --- LLM νΈμΆ ν¨μλ€ ---
|
1032 |
def call_llm_sync(self, messages: List[Dict[str, str]], role: str, language: str) -> str:
|