fix: rename dialog_id to chat_id in chat_channel (backend + frontend) (#16096)

## Summary

- The `ChatChannel` DB column was renamed from `dialog_id` to `chat_id`
via a migration (added in a prior commit).
- Aligns the REST API layer (`chat_channel_api.py`,
`chat_channel_service.py`) to use `chat_id` consistently.
- Updates the frontend (`interface.ts`, `hooks.ts`,
`connect-dialog-modal.tsx`, `added-channel-card.tsx`) to read/write
`chat_id` instead of `dialog_id`.
- The joined `dialog_name` alias in the list query is unchanged (backend
still returns it under that name).

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Kevin Hu
2026-06-16 19:02:20 +08:00
committed by GitHub
parent 6bfaa3f21e
commit 15f50e5cb2
7 changed files with 16 additions and 15 deletions

View File

@@ -43,7 +43,7 @@ async def create_chat_channel():
"name": req["name"],
"channel": req["channel"],
"config": req["config"],
"dialog_id": req.get("dialog_id") or None
"chat_id": req.get("chat_id") or None
}
ChatChannelService.insert(**channel)
@@ -89,14 +89,14 @@ async def update_chat_channel(channel_id):
req = req["data"]
# Validate the connected dialog (if provided) belongs to the channel's tenant.
if req.get("dialog_id"):
e, dia = DialogService.get_by_id(req["dialog_id"])
if req.get("chat_id"):
e, dia = DialogService.get_by_id(req["chat_id"])
if not e:
return get_data_error_result(message="Can't find this chat assistant!")
if dia.tenant_id != conn.tenant_id:
return _chat_channel_auth_error(channel_id, current_user.id)
update_fields = {fld: req[fld] for fld in ["name", "config", "dialog_id"] if fld in req}
update_fields = {fld: req[fld] for fld in ["name", "config", "chat_id"] if fld in req}
if update_fields:
ChatChannelService.update_by_id(channel_id, update_fields)