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:
|