mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-06-29 15:31:05 +08:00
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:
@@ -1253,7 +1253,7 @@ class ChatChannel(DataBaseModel):
|
||||
name = CharField(max_length=128, null=False, help_text="Bot name", index=False)
|
||||
channel = CharField(max_length=128, null=False, help_text="Chat channel type", index=True)
|
||||
config = JSONField(null=False, default={}, help_text="Channel credential & settings")
|
||||
dialog_id = CharField(max_length=32, null=True, default=None, help_text="connected dialog id", index=True)
|
||||
chat_id = CharField(max_length=32, null=True, default=None, help_text="connected chat id", index=True)
|
||||
status = IntegerField(default=1, index=True)
|
||||
|
||||
def __str__(self):
|
||||
@@ -1778,6 +1778,7 @@ def migrate_db():
|
||||
alter_db_column_type(migrator, "file", "size", BigIntegerField(default=0, index=True))
|
||||
alter_db_add_column(migrator, "tenant", "ocr_id", CharField(max_length=128, null=True, help_text="default ocr model ID", index=True))
|
||||
alter_db_column_type(migrator, "chat_channel", "status", IntegerField(default=1, index=True))
|
||||
alter_db_rename_column(migrator, "chat_channel", "dialog_id", "chat_id")
|
||||
# Drop both the explicit "idx_*" name from later migrations AND the
|
||||
# Peewee-auto-derived "<table-as-classname>_<col1>_<col2>" name from the
|
||||
# original TenantModelInstance definition (commit dc4b82523). Databases
|
||||
|
||||
@@ -34,7 +34,7 @@ class ChatChannelService(CommonService):
|
||||
cls.model.id,
|
||||
cls.model.name,
|
||||
cls.model.channel,
|
||||
cls.model.dialog_id,
|
||||
cls.model.chat_id,
|
||||
cls.model.status,
|
||||
Dialog.name.alias("dialog_name"),
|
||||
]
|
||||
@@ -43,7 +43,7 @@ class ChatChannelService(CommonService):
|
||||
.join(
|
||||
Dialog,
|
||||
join_type=JOIN.LEFT_OUTER,
|
||||
on=(Dialog.id == cls.model.dialog_id),
|
||||
on=(Dialog.id == cls.model.chat_id),
|
||||
)
|
||||
.where(cls.model.tenant_id == tenant_id)
|
||||
.order_by(cls.model.create_time.desc())
|
||||
|
||||
Reference in New Issue
Block a user