Description
Add workspace binding support to channel settings so that conversations created by IM channels (Telegram, Lark, DingTalk, WeChat) can have access to project files.
Currently, when a message arrives from an IM channel, the backend creates a conversation with an empty workspace (workspace=''), resulting in a temporary directory with no access to project files.
Proposed Changes
1. New API Endpoint
PUT /api/channel/settings/{platform}/workspace
Body: { "workspace": "/path/to/project" }
This should persist the workspace path in channel settings, similar to the existing PUT /api/channel/settings/{platform}/assistant and PUT /api/channel/settings/{platform}/default-model endpoints.
2. Update IChannelPlatformSettings Response
The GET /api/channel/settings/{platform} response should include the workspace field:
{
"platform": "telegram",
"assistant": { "assistant_id": "..." },
"default_model": { "id": "...", "use_model": "..." },
"workspace": "/path/to/project"
}
3. Use Workspace When Creating Channel Conversations
When a message arrives from an IM channel and the backend creates/reactivates a conversation:
- If
settings.workspace is non-empty, use it as the conversation's workspace (equivalent to custom_workspace: true)
- If
settings.workspace is empty/null, maintain current behavior (temporary workspace)
This gives the assistant access to project files when responding to IM messages.
Context
- Frontend changes (types, IPC route, UI) have been implemented in the AionUi desktop client on branch
feat/channel-workspace-binding
- The
IChannelSession type already has a workspace?: string field that can be used
- The
TChatConversation.extra.workspace field already exists and is used by regular conversations
Files to Update (AionCore)
- Channel settings handler — add
workspace to platform settings struct
- Channel conversation creation — use
settings.workspace when creating conversations from IM messages
- API routes — add
PUT /api/channel/settings/{platform}/workspace
Description
Add workspace binding support to channel settings so that conversations created by IM channels (Telegram, Lark, DingTalk, WeChat) can have access to project files.
Currently, when a message arrives from an IM channel, the backend creates a conversation with an empty workspace (
workspace=''), resulting in a temporary directory with no access to project files.Proposed Changes
1. New API Endpoint
This should persist the workspace path in channel settings, similar to the existing
PUT /api/channel/settings/{platform}/assistantandPUT /api/channel/settings/{platform}/default-modelendpoints.2. Update
IChannelPlatformSettingsResponseThe
GET /api/channel/settings/{platform}response should include theworkspacefield:{ "platform": "telegram", "assistant": { "assistant_id": "..." }, "default_model": { "id": "...", "use_model": "..." }, "workspace": "/path/to/project" }3. Use Workspace When Creating Channel Conversations
When a message arrives from an IM channel and the backend creates/reactivates a conversation:
settings.workspaceis non-empty, use it as the conversation's workspace (equivalent tocustom_workspace: true)settings.workspaceis empty/null, maintain current behavior (temporary workspace)This gives the assistant access to project files when responding to IM messages.
Context
feat/channel-workspace-bindingIChannelSessiontype already has aworkspace?: stringfield that can be usedTChatConversation.extra.workspacefield already exists and is used by regular conversationsFiles to Update (AionCore)
workspaceto platform settings structsettings.workspacewhen creating conversations from IM messagesPUT /api/channel/settings/{platform}/workspace