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

@@ -58,10 +58,10 @@ export const AddedChannelCard = (props: IAddedChannelCardProps) => {
>
<div className="flex flex-col gap-0.5">
<div className="text-sm text-text-primary">{item.name}</div>
{item.dialog_id ? (
{item.chat_id ? (
<div className="text-xs text-text-secondary flex items-center gap-1">
<Link2 size={12} />
{item.dialog_name || item.dialog_id}
{item.dialog_name || item.chat_id}
</div>
) : (
<div className="text-xs text-text-secondary/60">

View File

@@ -22,12 +22,12 @@ const ConnectDialogModal = ({
const { dialogs } = useChatChannelDialogList();
const { connect, connecting } = useConnectChatChannelDialog();
const [dialogId, setDialogId] = useState<string | undefined>(
channel?.dialog_id ?? undefined,
channel?.chat_id ?? undefined,
);
useEffect(() => {
setDialogId(channel?.dialog_id ?? undefined);
}, [channel?.id, channel?.dialog_id]);
setDialogId(channel?.chat_id ?? undefined);
}, [channel?.id, channel?.chat_id]);
const options = useMemo(
() => (dialogs || []).map((d) => ({ label: d.name, value: d.id })),

View File

@@ -166,7 +166,7 @@ export const useConnectChatChannelDialog = () => {
dialogId: string | null;
}) => {
const { data } = await updateChatChannel(params.channelId, {
dialog_id: params.dialogId,
chat_id: params.dialogId,
});
if (data.code === 0) {
message.success(t('message.operated'));

View File

@@ -11,8 +11,8 @@ export interface IChatChannelBase {
id: string;
name: string;
channel: ChatChannelKey;
// Connected assistant (dialog), joined in by the list endpoint.
dialog_id?: string | null;
// Connected assistant (chat), joined in by the list endpoint.
chat_id?: string | null;
dialog_name?: string | null;
}