feat(channel): add channel support across various components and locales
- Introduced a new `channel` field in multiple request and message structures to track the source channel (e.g., "web", "api", "im"). - Updated frontend API calls and chat components to include the `channel` parameter, ensuring consistent channel tracking in user messages. - Enhanced localization files to support channel labels in English, Korean, Russian, and Chinese. - Added database migration scripts to incorporate the `channel` column in the messages table, facilitating the storage of channel information. - Refactored related functions and components to accommodate the new channel feature, improving overall message context and tracking.
This commit is contained in:
@@ -143,6 +143,7 @@ CREATE TABLE IF NOT EXISTS messages (
|
||||
mentioned_items TEXT DEFAULT '[]',
|
||||
is_completed BOOLEAN NOT NULL DEFAULT 0,
|
||||
is_fallback BOOLEAN NOT NULL DEFAULT 0,
|
||||
channel VARCHAR(50) NOT NULL DEFAULT '',
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at DATETIME
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
-- Migration: 000025_message_channel (rollback)
|
||||
-- Description: Remove channel column from messages
|
||||
ALTER TABLE messages DROP COLUMN IF EXISTS channel;
|
||||
@@ -0,0 +1,9 @@
|
||||
-- Migration: 000025_message_channel
|
||||
-- Description: Add channel column to messages to track the source channel (web, api, im, etc.)
|
||||
DO $$ BEGIN RAISE NOTICE '[Migration 000025] Adding channel column to messages'; END $$;
|
||||
|
||||
ALTER TABLE messages ADD COLUMN IF NOT EXISTS channel VARCHAR(50) NOT NULL DEFAULT '';
|
||||
|
||||
COMMENT ON COLUMN messages.channel IS 'Source channel of the message: web, api, im, etc.';
|
||||
|
||||
DO $$ BEGIN RAISE NOTICE '[Migration 000025] channel column added to messages successfully'; END $$;
|
||||
Reference in New Issue
Block a user