增加了基于目录的文章主题维护,避免偏题
This commit is contained in:
@@ -0,0 +1,50 @@
|
|||||||
|
# chapter_directory_parser.py
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import re
|
||||||
|
|
||||||
|
def get_chapter_info_from_directory(novel_directory_content: str, chapter_number: int):
|
||||||
|
"""
|
||||||
|
从给定的 novel_directory_content 文本中,解析 “第X章” 行,并提取本章的标题和可能的简述。
|
||||||
|
返回一个 dict: {
|
||||||
|
"chapter_title": <字符串>,
|
||||||
|
"chapter_brief": <字符串> (若没有则为空)
|
||||||
|
}
|
||||||
|
注意:目录文本示例格式:
|
||||||
|
第1章 :潮起
|
||||||
|
第2章 :阴影浮现 - 主要角色冲突爆发
|
||||||
|
...
|
||||||
|
也可能没有简述,只有一个简单标题。
|
||||||
|
"""
|
||||||
|
|
||||||
|
# 将文本逐行拆分
|
||||||
|
lines = novel_directory_content.splitlines()
|
||||||
|
|
||||||
|
# 章节匹配:形如 “第5章 :xxx” or “第5章: xxx” or “第5章 xxx”
|
||||||
|
pattern = re.compile(r'^第\s*(\d+)\s*章\s*[::]?\s*(.*)$')
|
||||||
|
|
||||||
|
for line in lines:
|
||||||
|
match = pattern.match(line.strip())
|
||||||
|
if match:
|
||||||
|
chap_num = int(match.group(1))
|
||||||
|
if chap_num == chapter_number:
|
||||||
|
# group(2) 可能是标题及简述的混合
|
||||||
|
full_title = match.group(2).strip()
|
||||||
|
# 这里假设用 '-' 进一步区分“标题 - 简述”,也可能用户没写“ - ”
|
||||||
|
if ' - ' in full_title:
|
||||||
|
# 根据你的目录格式自由处理
|
||||||
|
parts = full_title.split(' - ', 1)
|
||||||
|
return {
|
||||||
|
"chapter_title": parts[0].strip(),
|
||||||
|
"chapter_brief": parts[1].strip()
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
return {
|
||||||
|
"chapter_title": full_title,
|
||||||
|
"chapter_brief": ""
|
||||||
|
}
|
||||||
|
|
||||||
|
# 如果没有匹配到,返回默认
|
||||||
|
return {
|
||||||
|
"chapter_title": f"第{chapter_number}章",
|
||||||
|
"chapter_brief": ""
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ from ui import NovelGeneratorGUI
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
root = tk.Tk()
|
root = tk.Tk()
|
||||||
root.title("Novel Generator - Innovative Flow")
|
root.title("Novel Generator")
|
||||||
app = NovelGeneratorGUI(root)
|
app = NovelGeneratorGUI(root)
|
||||||
root.mainloop()
|
root.mainloop()
|
||||||
|
|
||||||
|
|||||||
+44
-26
@@ -31,9 +31,15 @@ from prompt_definitions import (
|
|||||||
chapter_outline_prompt, chapter_write_prompt
|
chapter_outline_prompt, chapter_write_prompt
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# ============ 新增:导入 chapter_directory_parser ============
|
||||||
|
from chapter_directory_parser import get_chapter_info_from_directory
|
||||||
|
|
||||||
# ============ 日志配置 ============
|
# ============ 日志配置 ============
|
||||||
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")
|
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")
|
||||||
|
def debug_log(prompt: str, response_content: str):
|
||||||
|
"""在控制台打印或记录下每次Prompt与Response,[调试]"""
|
||||||
|
logging.info(f"\n[Prompt >>>] {prompt}\n")
|
||||||
|
logging.info(f"[Response >>>] {response_content}\n")
|
||||||
# ============ 向量检索相关 ============
|
# ============ 向量检索相关 ============
|
||||||
|
|
||||||
VECTOR_STORE_DIR = "vectorstore"
|
VECTOR_STORE_DIR = "vectorstore"
|
||||||
@@ -143,10 +149,7 @@ def Novel_novel_directory_generate(
|
|||||||
temperature=temperature
|
temperature=temperature
|
||||||
)
|
)
|
||||||
|
|
||||||
def debug_log(prompt: str, response_content: str):
|
|
||||||
"""在控制台打印或记录下每次Prompt与Response,[调试]"""
|
|
||||||
logging.info(f"\n[Prompt >>>] {prompt}\n")
|
|
||||||
logging.info(f"[Response >>>] {response_content}\n")
|
|
||||||
|
|
||||||
def generate_base_setting(state: OverallState) -> Dict[str, str]:
|
def generate_base_setting(state: OverallState) -> Dict[str, str]:
|
||||||
prompt = set_prompt.format(
|
prompt = set_prompt.format(
|
||||||
@@ -289,13 +292,15 @@ def summarize_recent_chapters(model: ChatOpenAI, chapters_text_list: List[str])
|
|||||||
combined_text = "\n".join(chapters_text_list)
|
combined_text = "\n".join(chapters_text_list)
|
||||||
# 在这里可以写一个更详细的提示
|
# 在这里可以写一个更详细的提示
|
||||||
prompt = f"""\
|
prompt = f"""\
|
||||||
这是最近几章的故事内容,请生成一份详细的短期内容摘要(不少于一章篇幅的细节),用于帮助后续创作时回顾细节。请着重强调发生的事件、角色的心理和关系变化、冲突或悬念等。
|
这是最近几章的故事内容,请生成一份详细的短期内容摘要(不少于一章篇幅的细节),用于帮助后续创作时回顾细节。
|
||||||
|
请着重强调发生的事件、角色的心理和关系变化、冲突或悬念等。
|
||||||
|
|
||||||
{combined_text}
|
{combined_text}
|
||||||
"""
|
"""
|
||||||
response = model.invoke(prompt)
|
response = model.invoke(prompt)
|
||||||
if not response:
|
if not response:
|
||||||
return ""
|
return ""
|
||||||
|
debug_log(prompt, response.content)
|
||||||
return response.content.strip()
|
return response.content.strip()
|
||||||
|
|
||||||
# ============ 生成章节草稿 & 定稿 ============
|
# ============ 生成章节草稿 & 定稿 ============
|
||||||
@@ -319,16 +324,20 @@ def generate_chapter_draft(
|
|||||||
仅生成当前章节的草稿,不更新全局摘要/角色状态/向量库。
|
仅生成当前章节的草稿,不更新全局摘要/角色状态/向量库。
|
||||||
并将生成的内容写到 "chapter_{novel_number}.txt" 覆盖写入。
|
并将生成的内容写到 "chapter_{novel_number}.txt" 覆盖写入。
|
||||||
同时生成 "outline_{novel_number}.txt" 存储大纲内容。
|
同时生成 "outline_{novel_number}.txt" 存储大纲内容。
|
||||||
|
|
||||||
recent_chapters_summary: 最近 3 章的“短期内容摘要”
|
recent_chapters_summary: 最近 3 章的“短期内容摘要”
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# 0) 根据 novel_number 从 novel_novel_directory 中获取本章标题及简述
|
||||||
|
chapter_info = get_chapter_info_from_directory(novel_novel_directory, novel_number)
|
||||||
|
chapter_title = chapter_info["chapter_title"]
|
||||||
|
chapter_brief = chapter_info["chapter_brief"]
|
||||||
|
|
||||||
# 1) 从向量库检索往期上下文
|
# 1) 从向量库检索往期上下文
|
||||||
relevant_context = get_relevant_context_from_vector_store(
|
relevant_context = get_relevant_context_from_vector_store(
|
||||||
api_key, base_url, "回顾剧情", k=2
|
api_key, base_url, "回顾剧情", k=2
|
||||||
)
|
)
|
||||||
|
|
||||||
# 2) 生成大纲(增加 recent_chapters_summary)
|
# 2) 生成大纲
|
||||||
model = ChatOpenAI(
|
model = ChatOpenAI(
|
||||||
model=model_name,
|
model=model_name,
|
||||||
api_key=api_key,
|
api_key=api_key,
|
||||||
@@ -337,22 +346,26 @@ def generate_chapter_draft(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Prompt 拼接
|
# Prompt 拼接
|
||||||
outline_prompt = (
|
outline_prompt_text = chapter_outline_prompt.format(
|
||||||
chapter_outline_prompt
|
|
||||||
+ "\n\n【最近几章摘要】\n" + recent_chapters_summary
|
|
||||||
+ "\n\n【用户指导】\n" + (user_guidance if user_guidance else "(无)")
|
|
||||||
).format(
|
|
||||||
novel_setting=novel_settings,
|
novel_setting=novel_settings,
|
||||||
character_state=character_state + "\n\n【历史上下文】\n" + relevant_context,
|
character_state=character_state + "\n\n【历史上下文】\n" + relevant_context,
|
||||||
global_summary=global_summary,
|
global_summary=global_summary,
|
||||||
novel_number=novel_number
|
novel_number=novel_number,
|
||||||
|
chapter_title=chapter_title,
|
||||||
|
chapter_brief=chapter_brief
|
||||||
)
|
)
|
||||||
|
|
||||||
response_outline = model.invoke(outline_prompt)
|
# 在后面加上用户指导与最近章节摘要(可根据需要灵活组织)
|
||||||
|
outline_prompt_text += f"\n\n【本章目录标题与简述】\n标题:{chapter_title}\n简述:{chapter_brief}\n"
|
||||||
|
outline_prompt_text += f"\n【最近几章摘要】\n{recent_chapters_summary}"
|
||||||
|
outline_prompt_text += f"\n\n【用户指导】\n{user_guidance if user_guidance else '(无)'}"
|
||||||
|
|
||||||
|
response_outline = model.invoke(outline_prompt_text)
|
||||||
if not response_outline:
|
if not response_outline:
|
||||||
logging.warning("outline_chapter: No response.")
|
logging.warning("generate_chapter_draft: outline no response.")
|
||||||
chapter_outline = ""
|
chapter_outline = ""
|
||||||
else:
|
else:
|
||||||
|
debug_log(outline_prompt_text, response_outline.content)
|
||||||
chapter_outline = response_outline.content.strip()
|
chapter_outline = response_outline.content.strip()
|
||||||
|
|
||||||
# 将大纲写到 outline_{novel_number}.txt
|
# 将大纲写到 outline_{novel_number}.txt
|
||||||
@@ -363,23 +376,27 @@ def generate_chapter_draft(
|
|||||||
save_string_to_txt(chapter_outline, outline_file)
|
save_string_to_txt(chapter_outline, outline_file)
|
||||||
|
|
||||||
# 3) 生成正文草稿
|
# 3) 生成正文草稿
|
||||||
writing_prompt = (
|
writing_prompt_text = chapter_write_prompt.format(
|
||||||
chapter_write_prompt
|
|
||||||
+ "\n\n【最近几章摘要】\n" + recent_chapters_summary
|
|
||||||
+ "\n\n【用户指导】\n" + (user_guidance if user_guidance else "(无)")
|
|
||||||
).format(
|
|
||||||
novel_setting=novel_settings,
|
novel_setting=novel_settings,
|
||||||
character_state=character_state + "\n\n【历史上下文】\n" + relevant_context,
|
character_state=character_state + "\n\n【历史上下文】\n" + relevant_context,
|
||||||
global_summary=global_summary,
|
global_summary=global_summary,
|
||||||
chapter_outline=chapter_outline,
|
chapter_outline=chapter_outline,
|
||||||
word_number=word_number
|
word_number=word_number,
|
||||||
|
chapter_title=chapter_title,
|
||||||
|
chapter_brief=chapter_brief
|
||||||
)
|
)
|
||||||
|
|
||||||
response_chapter = model.invoke(writing_prompt)
|
# 同样插入用户指导和最近摘要
|
||||||
|
writing_prompt_text += f"\n\n【本章目录标题与简述】\n标题:{chapter_title}\n简述:{chapter_brief}\n"
|
||||||
|
writing_prompt_text += f"\n【最近几章摘要】\n{recent_chapters_summary}"
|
||||||
|
writing_prompt_text += f"\n\n【用户指导】\n{user_guidance if user_guidance else '(无)'}"
|
||||||
|
|
||||||
|
response_chapter = model.invoke(writing_prompt_text)
|
||||||
if not response_chapter:
|
if not response_chapter:
|
||||||
logging.warning("write_chapter: No response.")
|
logging.warning("generate_chapter_draft: writing no response.")
|
||||||
chapter_content = ""
|
chapter_content = ""
|
||||||
else:
|
else:
|
||||||
|
debug_log(writing_prompt_text, response_chapter.content)
|
||||||
chapter_content = response_chapter.content.strip()
|
chapter_content = response_chapter.content.strip()
|
||||||
|
|
||||||
# 4) 覆盖写到 chapter_{novel_number}.txt
|
# 4) 覆盖写到 chapter_{novel_number}.txt
|
||||||
@@ -407,8 +424,6 @@ def finalize_chapter(
|
|||||||
2. 更新全局摘要、角色状态文件;
|
2. 更新全局摘要、角色状态文件;
|
||||||
3. 如果字数明显少于 word_number 的 80%,则自动调用 enrich_chapter_text 再次扩写;
|
3. 如果字数明显少于 word_number 的 80%,则自动调用 enrich_chapter_text 再次扩写;
|
||||||
4. 更新向量库。
|
4. 更新向量库。
|
||||||
|
|
||||||
* 注意:实际应用中,用户也可以再次编辑 chapter_{n}.txt 后再点定稿,这里示例不做 GUI 级别的文本编辑逻辑。
|
|
||||||
"""
|
"""
|
||||||
# 读取当前章节内容
|
# 读取当前章节内容
|
||||||
chapters_dir = os.path.join(filepath, "chapters")
|
chapters_dir = os.path.join(filepath, "chapters")
|
||||||
@@ -458,6 +473,7 @@ def finalize_chapter(
|
|||||||
if not response:
|
if not response:
|
||||||
logging.warning("update_global_summary: No response.")
|
logging.warning("update_global_summary: No response.")
|
||||||
return old_summary
|
return old_summary
|
||||||
|
debug_log(prompt, response.content)
|
||||||
return response.content.strip()
|
return response.content.strip()
|
||||||
|
|
||||||
new_global_summary = update_global_summary(chapter_text, old_global_summary)
|
new_global_summary = update_global_summary(chapter_text, old_global_summary)
|
||||||
@@ -472,6 +488,7 @@ def finalize_chapter(
|
|||||||
if not response:
|
if not response:
|
||||||
logging.warning("update_character_state: No response.")
|
logging.warning("update_character_state: No response.")
|
||||||
return old_state
|
return old_state
|
||||||
|
debug_log(prompt, response.content)
|
||||||
return response.content.strip()
|
return response.content.strip()
|
||||||
|
|
||||||
new_char_state = update_character_state(chapter_text, old_char_state)
|
new_char_state = update_character_state(chapter_text, old_char_state)
|
||||||
@@ -516,6 +533,7 @@ def enrich_chapter_text(
|
|||||||
if not response:
|
if not response:
|
||||||
logging.warning("enrich_chapter_text: No response.")
|
logging.warning("enrich_chapter_text: No response.")
|
||||||
return chapter_text # 无响应时就返回原文
|
return chapter_text # 无响应时就返回原文
|
||||||
|
debug_log(prompt, response.content)
|
||||||
return response.content.strip()
|
return response.content.strip()
|
||||||
|
|
||||||
# ============ 导入外部知识文本 ============
|
# ============ 导入外部知识文本 ============
|
||||||
|
|||||||
+24
-13
@@ -27,7 +27,7 @@ character_prompt = """\
|
|||||||
请你完善以下内容,帮助我们更好地维持人物形象和成长轨迹:
|
请你完善以下内容,帮助我们更好地维持人物形象和成长轨迹:
|
||||||
1. 列出核心角色(至少3个),并对每个角色进行详细性格特征描述。
|
1. 列出核心角色(至少3个),并对每个角色进行详细性格特征描述。
|
||||||
2. 强调每个角色的潜在内心冲突、目标与动机。
|
2. 强调每个角色的潜在内心冲突、目标与动机。
|
||||||
3. 为每个角色添加至少一个“暗线”或隐藏秘密,以及在故事进行中如何可能被揭示的思路。
|
3. 为每个角色添加至少一个“暗线”或隐藏秘密,以及在故事进行中可能如何被揭示。
|
||||||
4. 指出主要角色之间的关键关系和冲突点,为后续情节埋下伏笔。
|
4. 指出主要角色之间的关键关系和冲突点,为后续情节埋下伏笔。
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -66,7 +66,9 @@ novel_directory_prompt = """\
|
|||||||
...
|
...
|
||||||
第{number_of_chapters}章 :< text >
|
第{number_of_chapters}章 :< text >
|
||||||
|
|
||||||
请严格按照上述格式输出每一章的名称,且勿使用Markdown语法。
|
请严格按照上述格式输出每一章的名称,最好在重要情节标题后增加提示性简述,
|
||||||
|
若要加更详细的简述,用“ - ”分隔,如“第2章 :阴影浮现 - 主要角色冲突爆发”。
|
||||||
|
请直接输出,不要使用Markdown语法。
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# =============== 提示词:章节+角色状态流程 ===================
|
# =============== 提示词:章节+角色状态流程 ===================
|
||||||
@@ -78,7 +80,7 @@ summary_prompt = """\
|
|||||||
这是当前的全局摘要(可能为空):
|
这是当前的全局摘要(可能为空):
|
||||||
{global_summary}
|
{global_summary}
|
||||||
|
|
||||||
请在不超过1000字的前提下,基于当前全局摘要和本章新增剧情,更新全局摘要。
|
请在不超过3000字的前提下,基于当前全局摘要和本章新增剧情,更新全局摘要。
|
||||||
保留原有重要信息,并融入本章的新内容。
|
保留原有重要信息,并融入本章的新内容。
|
||||||
不要透露结局,不要过度展开未来剧情。
|
不要透露结局,不要过度展开未来剧情。
|
||||||
"""
|
"""
|
||||||
@@ -100,20 +102,25 @@ update_character_state_prompt = """\
|
|||||||
使用简洁、易读的方式描述,可用条目或段落表示。保持与旧文档风格一致。
|
使用简洁、易读的方式描述,可用条目或段落表示。保持与旧文档风格一致。
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# ------------------ 新增占位符:chapter_title, chapter_brief ------------------
|
||||||
|
|
||||||
chapter_outline_prompt = """\
|
chapter_outline_prompt = """\
|
||||||
以下是当前小说设定与角色状态信息:
|
以下是当前小说设定与角色状态信息:
|
||||||
- 小说设定:{novel_setting}
|
- 小说设定:{novel_setting}
|
||||||
- 角色状态:{character_state}
|
- 角色状态:{character_state}
|
||||||
- 全局摘要:{global_summary}
|
- 全局摘要:{global_summary}
|
||||||
- 本章节编号:第 {novel_number} 章
|
|
||||||
|
|
||||||
请为即将写作的 第{novel_number}章 设计一个简要大纲:
|
现在要为第 {novel_number} 章进行大纲构思。
|
||||||
1. 本章的主要冲突或事件?
|
本章标题:{chapter_title}
|
||||||
2. 哪些角色会出现?情感与目标变化?
|
简述(若有):{chapter_brief}
|
||||||
3. 如何进一步暗示或推动暗线和角色冲突?
|
|
||||||
4. 如何结尾留下悬念?
|
|
||||||
|
|
||||||
直接用1、2、3、4分点说明即可。
|
请围绕本章标题与简述,设计一个详细大纲:
|
||||||
|
1. 本章的主要冲突或事件?如何与标题呼应?
|
||||||
|
2. 哪些角色会出现?他们在此章的目标与动机是否有所变化?
|
||||||
|
3. 如何推动或暗示已存在的暗线、角色冲突或新的悬念?
|
||||||
|
4. 在结尾留下什么悬念或转折?(与本章标题或简述形成呼应或对比)
|
||||||
|
|
||||||
|
请直接用 1、2、3、4 分点说明大纲要点即可。
|
||||||
"""
|
"""
|
||||||
|
|
||||||
chapter_write_prompt = """\
|
chapter_write_prompt = """\
|
||||||
@@ -123,10 +130,14 @@ chapter_write_prompt = """\
|
|||||||
3. 全局摘要:{global_summary}
|
3. 全局摘要:{global_summary}
|
||||||
4. 本章大纲:{chapter_outline}
|
4. 本章大纲:{chapter_outline}
|
||||||
|
|
||||||
|
本章标题:{chapter_title}
|
||||||
|
简述:{chapter_brief}
|
||||||
|
|
||||||
请写出本章节的完整正文:
|
请写出本章节的完整正文:
|
||||||
1. 确保本章字数不少于 {word_number} 字。
|
1. 确保本章字数不少于 {word_number} 字。
|
||||||
2. 不要使用分节标题,直接整体输出正文。
|
2. 内容需与标题“{chapter_title}”相呼应,并尽量呼应简述中的核心要点。
|
||||||
3. 可以着重描写人物心理、环境氛围等,以保证足够长度。
|
3. 不要使用分节标题,直接整体输出正文。
|
||||||
4. 在结尾部分保留一定悬念或剧情转折,为下一章做铺垫。
|
4. 可以着重描写人物心理、环境氛围,以保证足够长度。
|
||||||
|
5. 在结尾部分保留一定悬念或剧情转折,为下一章做铺垫。
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ from consistency_checker import check_consistency
|
|||||||
class NovelGeneratorGUI:
|
class NovelGeneratorGUI:
|
||||||
def __init__(self, master):
|
def __init__(self, master):
|
||||||
self.master = master
|
self.master = master
|
||||||
self.master.title("Novel Generator GUI - Advanced")
|
self.master.title("Novel Generator GUI")
|
||||||
|
|
||||||
# 配置持久化
|
# 配置持久化
|
||||||
self.config_file = "config.json"
|
self.config_file = "config.json"
|
||||||
@@ -93,7 +93,7 @@ class NovelGeneratorGUI:
|
|||||||
self.temperature_var = tk.DoubleVar(value=self.loaded_config.get("temperature", 0.7))
|
self.temperature_var = tk.DoubleVar(value=self.loaded_config.get("temperature", 0.7))
|
||||||
self.temp_value_label = ttk.Label(self.right_frame, text=f"{self.temperature_var.get():.2f}")
|
self.temp_value_label = ttk.Label(self.right_frame, text=f"{self.temperature_var.get():.2f}")
|
||||||
self.temp_value_label.grid(row=3, column=2, padx=5, pady=5, sticky="w")
|
self.temp_value_label.grid(row=3, column=2, padx=5, pady=5, sticky="w")
|
||||||
|
|
||||||
temp_scale = ttk.Scale(self.right_frame, from_=0.0, to=1.0, orient=tk.HORIZONTAL, variable=self.temperature_var)
|
temp_scale = ttk.Scale(self.right_frame, from_=0.0, to=1.0, orient=tk.HORIZONTAL, variable=self.temperature_var)
|
||||||
temp_scale.grid(row=3, column=1, padx=5, pady=5, sticky="we")
|
temp_scale.grid(row=3, column=1, padx=5, pady=5, sticky="we")
|
||||||
def update_temp_label(*args):
|
def update_temp_label(*args):
|
||||||
@@ -299,6 +299,7 @@ class NovelGeneratorGUI:
|
|||||||
# 获取最近3章文本,生成短期摘要
|
# 获取最近3章文本,生成短期摘要
|
||||||
chapters_dir = os.path.join(filepath, "chapters")
|
chapters_dir = os.path.join(filepath, "chapters")
|
||||||
recent_3_texts = get_last_n_chapters_text(chapters_dir, chap_num, n=3)
|
recent_3_texts = get_last_n_chapters_text(chapters_dir, chap_num, n=3)
|
||||||
|
|
||||||
# 用当前模型生成一个较为详细的最近剧情摘要
|
# 用当前模型生成一个较为详细的最近剧情摘要
|
||||||
model_obj = self.get_llm_model(model_name, api_key, base_url, temperature)
|
model_obj = self.get_llm_model(model_name, api_key, base_url, temperature)
|
||||||
recent_chapters_summary = summarize_recent_chapters(model_obj, recent_3_texts)
|
recent_chapters_summary = summarize_recent_chapters(model_obj, recent_3_texts)
|
||||||
@@ -457,7 +458,6 @@ class NovelGeneratorGUI:
|
|||||||
清空向量库按钮:弹出二次确认,若确认则执行 clear_vector_store()。
|
清空向量库按钮:弹出二次确认,若确认则执行 clear_vector_store()。
|
||||||
"""
|
"""
|
||||||
def confirmed_clear():
|
def confirmed_clear():
|
||||||
# 再次确认
|
|
||||||
second_confirm = messagebox.askyesno("二次确认", "你确定真的要删除所有向量数据吗?此操作不可恢复!")
|
second_confirm = messagebox.askyesno("二次确认", "你确定真的要删除所有向量数据吗?此操作不可恢复!")
|
||||||
if second_confirm:
|
if second_confirm:
|
||||||
clear_vector_store()
|
clear_vector_store()
|
||||||
|
|||||||
Reference in New Issue
Block a user