Update blueprint.py
This commit is contained in:
@@ -48,6 +48,7 @@ def Chapter_blueprint_generate(
|
|||||||
llm_model: str,
|
llm_model: str,
|
||||||
filepath: str,
|
filepath: str,
|
||||||
number_of_chapters: int,
|
number_of_chapters: int,
|
||||||
|
user_guidance: str = "", # 新增参数
|
||||||
temperature: float = 0.7,
|
temperature: float = 0.7,
|
||||||
max_tokens: int = 4096,
|
max_tokens: int = 4096,
|
||||||
timeout: int = 600
|
timeout: int = 600
|
||||||
@@ -106,7 +107,8 @@ def Chapter_blueprint_generate(
|
|||||||
chapter_list=limited_blueprint,
|
chapter_list=limited_blueprint,
|
||||||
number_of_chapters=number_of_chapters,
|
number_of_chapters=number_of_chapters,
|
||||||
n=current_start,
|
n=current_start,
|
||||||
m=current_end
|
m=current_end,
|
||||||
|
user_guidance=user_guidance # 新增参数
|
||||||
)
|
)
|
||||||
logging.info(f"Generating chapters [{current_start}..{current_end}] in a chunk...")
|
logging.info(f"Generating chapters [{current_start}..{current_end}] in a chunk...")
|
||||||
chunk_result = invoke_with_cleaning(llm_adapter, chunk_prompt)
|
chunk_result = invoke_with_cleaning(llm_adapter, chunk_prompt)
|
||||||
@@ -126,7 +128,8 @@ def Chapter_blueprint_generate(
|
|||||||
if chunk_size >= number_of_chapters:
|
if chunk_size >= number_of_chapters:
|
||||||
prompt = chapter_blueprint_prompt.format(
|
prompt = chapter_blueprint_prompt.format(
|
||||||
novel_architecture=architecture_text,
|
novel_architecture=architecture_text,
|
||||||
number_of_chapters=number_of_chapters
|
number_of_chapters=number_of_chapters,
|
||||||
|
user_guidance=user_guidance # 新增参数
|
||||||
)
|
)
|
||||||
blueprint_text = invoke_with_cleaning(llm_adapter, prompt)
|
blueprint_text = invoke_with_cleaning(llm_adapter, prompt)
|
||||||
if not blueprint_text.strip():
|
if not blueprint_text.strip():
|
||||||
@@ -149,7 +152,8 @@ def Chapter_blueprint_generate(
|
|||||||
chapter_list=limited_blueprint,
|
chapter_list=limited_blueprint,
|
||||||
number_of_chapters=number_of_chapters,
|
number_of_chapters=number_of_chapters,
|
||||||
n=current_start,
|
n=current_start,
|
||||||
m=current_end
|
m=current_end,
|
||||||
|
user_guidance=user_guidance # 新增参数
|
||||||
)
|
)
|
||||||
logging.info(f"Generating chapters [{current_start}..{current_end}] in a chunk...")
|
logging.info(f"Generating chapters [{current_start}..{current_end}] in a chunk...")
|
||||||
chunk_result = invoke_with_cleaning(llm_adapter, chunk_prompt)
|
chunk_result = invoke_with_cleaning(llm_adapter, chunk_prompt)
|
||||||
|
|||||||
Reference in New Issue
Block a user