feat(im): add file_processing_strategy for IM channels — support direct-to-conversation file handling#1563
Open
Libres-coder wants to merge 1 commit into
Open
feat(im): add file_processing_strategy for IM channels — support direct-to-conversation file handling#1563Libres-coder wants to merge 1 commit into
Libres-coder wants to merge 1 commit into
Conversation
Add file_processing_strategy field to IM channels, supporting two modes: - kb (default): upload files to knowledge base (existing behavior) - direct: parse file content and inject into conversation context Backend: - Add FileProcessingStrategy type and constants to IMChannel model - Update HandleMessage to dispatch based on strategy - Add handleFileMessageDirect and processFileDirect functions - Update buildIMQARequest to accept MessageAttachments - Update handler to accept file_processing_strategy in requests Database: - Add migration 000040: file_processing_strategy column with CHECK constraint Frontend: - Add file_processing_strategy to IMChannel and IMChannelOverview interfaces - Add strategy radio group with conditional KB selector in IMChannelPanel - Add i18n translations for zh-CN, en-US, ru-RU, ko-KR
Author
|
ptal,thx! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
IM channels currently only support uploading files to a knowledge base (
kbstrategy). If noknowledge_base_idis configured, files are rejected with an error. This PR adds afile_processing_strategyfield with two modes:kb(default) — Upload files to knowledge base (existing behavior)direct— Parse file content and inject it directly into the agent conversation contextChanges
Backend (Go):
internal/im/types.goFileProcessingStrategytype, constants (FileProcessingStrategyKB,FileProcessingStrategyDirect), and field onIMChannelinternal/im/service.goHandleMessageto dispatch based on strategy; addhandleFileMessageDirectandprocessFileDirect; updatebuildIMQARequestto acceptMessageAttachmentsinternal/handler/im.gofile_processing_strategyin create/update request structsDatabase:
migrations/versioned/000040_im_file_strategy.up.sqlfile_processing_strategycolumn with CHECK constraint ('kb','direct')migrations/versioned/000040_im_file_strategy.down.sqlFrontend:
frontend/src/api/agent/index.tsfile_processing_strategytoIMChannelandIMChannelOverviewinterfacesfrontend/src/components/IMChannelPanel.vuekbfrontend/src/i18n/locales/zh-CN.tsfrontend/src/i18n/locales/en-US.tsfrontend/src/i18n/locales/ru-RU.tsfrontend/src/i18n/locales/ko-KR.tsHow
directstrategy worksMessageAttachmentand inject into QA pipeline viabuildIMQARequestBackward Compatibility
'kb', preserving existing behavior for all existing channelsBeforeCreate/BeforeSavehooks ensure empty values default to'kb'