引入二级大纲功能,新增父子节点关系及子节点排序,同时调整API与UI以支持嵌套大纲管理
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
@@ -32,6 +34,7 @@ class NovelList(BaseModel):
|
||||
class OutlineCreate(BaseModel):
|
||||
summary: str = Field(min_length=1, max_length=200)
|
||||
detail: str = Field(default="", max_length=1000)
|
||||
parent_id: int | None = None
|
||||
|
||||
|
||||
class OutlineUpdate(BaseModel):
|
||||
@@ -43,9 +46,11 @@ class OutlineUpdate(BaseModel):
|
||||
class OutlineRead(BaseModel):
|
||||
id: int
|
||||
novel_id: int
|
||||
parent_id: int | None = None
|
||||
sort_order: int
|
||||
summary: str
|
||||
detail: str
|
||||
children: list[OutlineRead] = []
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
@@ -175,6 +180,7 @@ class ChatRequest(BaseModel):
|
||||
novel_id: int | None = None
|
||||
page_context: str | None = None # 用户当前所在页面,如 "大纲页" "世界观页"
|
||||
tools_enabled: bool = True # 是否启用工具调用
|
||||
auto_approve_tools: bool = False # 是否自动执行工具(无需人工审批)
|
||||
# 工具审批续传
|
||||
pending_tool_calls: list[PendingToolCall] | None = None
|
||||
assistant_text: str | None = None # LLM 在工具调用前输出的文本
|
||||
@@ -191,3 +197,7 @@ class ChatMessageRead(BaseModel):
|
||||
class ChatMessageList(BaseModel):
|
||||
items: list[ChatMessageRead]
|
||||
total: int
|
||||
|
||||
|
||||
# 解决 OutlineRead 自引用
|
||||
OutlineRead.model_rebuild()
|
||||
|
||||
Reference in New Issue
Block a user