update:1.优化 AI 流式生成和进度显示系统 2.新增写作风格系统提示词支持 3.灵感模式功能增强,支持灵感重写 4.设置页面功能扩展,新增Gemini适配器 5.提示词模板系统优化,调整灵感模式提示词
This commit is contained in:
@@ -133,14 +133,16 @@ class PlotExpansionService:
|
||||
|
||||
# 调用AI生成章节规划
|
||||
logger.info(f"调用AI生成章节规划...")
|
||||
ai_response = await self.ai_service.generate_text(
|
||||
accumulated_text = ""
|
||||
async for chunk in self.ai_service.generate_text_stream(
|
||||
prompt=prompt,
|
||||
provider=provider,
|
||||
model=model
|
||||
)
|
||||
):
|
||||
accumulated_text += chunk
|
||||
|
||||
# 提取内容
|
||||
ai_content = ai_response.get("content", "") if isinstance(ai_response, dict) else ai_response
|
||||
ai_content = accumulated_text
|
||||
|
||||
# 解析AI响应
|
||||
chapter_plans = self._parse_expansion_response(ai_content, outline.id)
|
||||
@@ -236,14 +238,16 @@ class PlotExpansionService:
|
||||
|
||||
# 调用AI生成当前批次
|
||||
logger.info(f"调用AI生成第{batch_num + 1}批...")
|
||||
ai_response = await self.ai_service.generate_text(
|
||||
accumulated_text = ""
|
||||
async for chunk in self.ai_service.generate_text_stream(
|
||||
prompt=prompt,
|
||||
provider=provider,
|
||||
model=model
|
||||
)
|
||||
):
|
||||
accumulated_text += chunk
|
||||
|
||||
# 提取内容
|
||||
ai_content = ai_response.get("content", "") if isinstance(ai_response, dict) else ai_response
|
||||
ai_content = accumulated_text
|
||||
|
||||
# 解析AI响应
|
||||
batch_plans = self._parse_expansion_response(ai_content, outline.id)
|
||||
|
||||
Reference in New Issue
Block a user