Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1316,7 +1316,7 @@ All detected repetitions must be removed."""
|
|
1316 |
return lang_prompts.get(language, lang_prompts["Korean"])
|
1317 |
|
1318 |
|
1319 |
-
|
1320 |
critic_feedback: str, language: str) -> str:
|
1321 |
"""์๊ฐ ์์ ํ๋กฌํํธ"""
|
1322 |
target_words = MIN_WORDS_PER_WRITER
|
@@ -1347,7 +1347,7 @@ All detected repetitions must be removed."""
|
|
1347 |
์ ๋ฉด ์ฌ์์ฑ์ด ํ์ํ๋ฉด ๊ณผ๊ฐํ ์์ ํ์ธ์.
|
1348 |
์์ ๋ณธ๋ง ์ ์ํ์ธ์."""
|
1349 |
|
1350 |
-
|
1351 |
"""ํธ์ง์ ํ๋กฌํํธ - ๋ฐ๋ณต ์ ๊ฑฐ ์ ๋ฌธ"""
|
1352 |
|
1353 |
lang_prompts = {
|
@@ -1438,7 +1438,7 @@ Briefly summarize major changes."""
|
|
1438 |
|
1439 |
return lang_prompts.get(language, lang_prompts["Korean"])
|
1440 |
|
1441 |
-
|
1442 |
"""์ต์ข
๋นํ - AGI ํ๊ฐ ๊ธฐ์ค"""
|
1443 |
|
1444 |
lang_prompts = {
|
@@ -1544,7 +1544,7 @@ Carefully review for any remaining repetitions after editing."""
|
|
1544 |
return lang_prompts.get(language, lang_prompts["Korean"])
|
1545 |
|
1546 |
# --- LLM ํธ์ถ ํจ์๋ค ---
|
1547 |
-
|
1548 |
full_content = ""
|
1549 |
for chunk in self.call_llm_streaming(messages, role, language):
|
1550 |
full_content += chunk
|
@@ -1552,7 +1552,7 @@ Carefully review for any remaining repetitions after editing."""
|
|
1552 |
raise Exception(f"LLM Call Failed: {full_content}")
|
1553 |
return full_content
|
1554 |
|
1555 |
-
|
1556 |
try:
|
1557 |
system_prompts = self.get_system_prompts(language)
|
1558 |
full_messages = [{"role": "system", "content": system_prompts.get(role, "")}, *messages]
|
|
|
1316 |
return lang_prompts.get(language, lang_prompts["Korean"])
|
1317 |
|
1318 |
|
1319 |
+
def create_writer_revision_prompt(self, writer_number: int, initial_content: str,
|
1320 |
critic_feedback: str, language: str) -> str:
|
1321 |
"""์๊ฐ ์์ ํ๋กฌํํธ"""
|
1322 |
target_words = MIN_WORDS_PER_WRITER
|
|
|
1347 |
์ ๋ฉด ์ฌ์์ฑ์ด ํ์ํ๋ฉด ๊ณผ๊ฐํ ์์ ํ์ธ์.
|
1348 |
์์ ๋ณธ๋ง ์ ์ํ์ธ์."""
|
1349 |
|
1350 |
+
def create_editor_prompt(self, complete_novel: str, issues: List[str], language: str) -> str:
|
1351 |
"""ํธ์ง์ ํ๋กฌํํธ - ๋ฐ๋ณต ์ ๊ฑฐ ์ ๋ฌธ"""
|
1352 |
|
1353 |
lang_prompts = {
|
|
|
1438 |
|
1439 |
return lang_prompts.get(language, lang_prompts["Korean"])
|
1440 |
|
1441 |
+
def create_critic_final_prompt(self, complete_novel: str, word_count: int, language: str) -> str:
|
1442 |
"""์ต์ข
๋นํ - AGI ํ๊ฐ ๊ธฐ์ค"""
|
1443 |
|
1444 |
lang_prompts = {
|
|
|
1544 |
return lang_prompts.get(language, lang_prompts["Korean"])
|
1545 |
|
1546 |
# --- LLM ํธ์ถ ํจ์๋ค ---
|
1547 |
+
def call_llm_sync(self, messages: List[Dict[str, str]], role: str, language: str) -> str:
|
1548 |
full_content = ""
|
1549 |
for chunk in self.call_llm_streaming(messages, role, language):
|
1550 |
full_content += chunk
|
|
|
1552 |
raise Exception(f"LLM Call Failed: {full_content}")
|
1553 |
return full_content
|
1554 |
|
1555 |
+
def call_llm_streaming(self, messages: List[Dict[str, str]], role: str, language: str) -> Generator[str, None, None]:
|
1556 |
try:
|
1557 |
system_prompts = self.get_system_prompts(language)
|
1558 |
full_messages = [{"role": "system", "content": system_prompts.get(role, "")}, *messages]
|