From d6897b605475469a9e9d9720a34facda76b262ee Mon Sep 17 00:00:00 2001 From: Jin Hai Date: Mon, 19 Jan 2026 12:45:14 +0800 Subject: [PATCH] Fix chat error (#12693) ### What problem does this PR solve? As title. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Signed-off-by: Jin Hai --- api/apps/dialog_app.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/api/apps/dialog_app.py b/api/apps/dialog_app.py index 32f5cdbc8..33502f402 100644 --- a/api/apps/dialog_app.py +++ b/api/apps/dialog_app.py @@ -44,6 +44,7 @@ async def set_dialog(): name = name.strip() if is_create: + # only for chat creating existing_names = { d.name.casefold() for d in DialogService.query(tenant_id=current_user.id, status=StatusEnum.VALID.value) @@ -68,8 +69,10 @@ async def set_dialog(): meta_data_filter = req.get("meta_data_filter", {}) prompt_config = req["prompt_config"] - if not req.get("kb_ids", []) and not prompt_config.get("tavily_api_key") and "{knowledge}" in prompt_config.get("system", ""): - return get_data_error_result(message="Please remove `{knowledge}` in system prompt since no dataset / Tavily used here.") + if not is_create: + # only for chat updating + if not req.get("kb_ids", []) and not prompt_config.get("tavily_api_key") and "{knowledge}" in prompt_config.get("system", ""): + return get_data_error_result(message="Please remove `{knowledge}` in system prompt since no dataset / Tavily used here.") for p in prompt_config.get("parameters", []): if p["optional"]: