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:
@@ -1424,6 +1424,7 @@ func (s *Service) handleMessageStream(ctx context.Context, msg *IncomingMessage,
|
||||
userMsg, err := s.messageService.CreateMessage(qaCtx, &types.Message{
|
||||
SessionID: session.ID, Role: "user", Content: msg.Content,
|
||||
RequestID: requestID, CreatedAt: time.Now(), IsCompleted: true,
|
||||
Channel: "im",
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("create user message: %w", err)
|
||||
@@ -1433,6 +1434,7 @@ func (s *Service) handleMessageStream(ctx context.Context, msg *IncomingMessage,
|
||||
assistantMsg, err := s.messageService.CreateMessage(qaCtx, &types.Message{
|
||||
SessionID: session.ID, Role: "assistant",
|
||||
RequestID: requestID, CreatedAt: time.Now(), IsCompleted: false,
|
||||
Channel: "im",
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("create assistant message: %w", err)
|
||||
@@ -1611,6 +1613,7 @@ func (s *Service) runQA(ctx context.Context, session *types.Session, query strin
|
||||
RequestID: requestID,
|
||||
CreatedAt: time.Now(),
|
||||
IsCompleted: true,
|
||||
Channel: "im",
|
||||
})
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("create user message: %w", err)
|
||||
@@ -1623,6 +1626,7 @@ func (s *Service) runQA(ctx context.Context, session *types.Session, query strin
|
||||
RequestID: requestID,
|
||||
CreatedAt: time.Now(),
|
||||
IsCompleted: false,
|
||||
Channel: "im",
|
||||
})
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("create assistant message: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user