mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 07:49:19 +08:00
fix: 草稿首次落库前先改绑发布助手会话,避免路由重挂新建空会话
This commit is contained in:
@@ -27,6 +27,8 @@ class PatchSessionBody(BaseModel):
|
||||
title: str | None = Field(default=None, min_length=1, max_length=200)
|
||||
llmProviderId: int | None = None
|
||||
llmModel: str | None = None
|
||||
# 未落库会话(local-*)改绑到稳定业务键,如系统草稿 ID
|
||||
sceneRef: str | None = Field(default=None, min_length=1, max_length=200)
|
||||
|
||||
|
||||
def _session_vo(s) -> dict:
|
||||
@@ -84,11 +86,23 @@ async def patch_session(
|
||||
actor: Actor = Depends(current_actor),
|
||||
svc: SessionService = Depends(session_service),
|
||||
):
|
||||
if body.title is None and body.llmModel is None and body.llmProviderId is None:
|
||||
if (
|
||||
body.title is None
|
||||
and body.llmModel is None
|
||||
and body.llmProviderId is None
|
||||
and body.sceneRef is None
|
||||
):
|
||||
raise HTTPException(status_code=400, detail="无有效更新字段")
|
||||
try:
|
||||
s = None
|
||||
if body.title is not None:
|
||||
if body.sceneRef is not None:
|
||||
s = await svc.rebind_scene_ref(
|
||||
actor,
|
||||
thread_id,
|
||||
scene_ref=body.sceneRef,
|
||||
title=body.title,
|
||||
)
|
||||
elif body.title is not None:
|
||||
s = await svc.rename(actor, thread_id, body.title)
|
||||
if body.llmModel is not None or body.llmProviderId is not None:
|
||||
if body.llmModel is None or body.llmProviderId is None:
|
||||
|
||||
Reference in New Issue
Block a user