feat: 简化微信渠道账号连接
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
import { EMPTY_CLOUD_CONFIGURATION, type CloudAgentConfiguration, type CloudAgentDraft, type CloudAgentPage, type CreateCloudAgent, type SaveCloudAgentDraft, type CloudUpload } from '../../shared/cloud-agents';
|
||||
import { operationPlan } from './cloud-agent-operations';
|
||||
|
||||
const retiredChannelOperations = new Set([
|
||||
'channelPolicy',
|
||||
'createChannelPairing',
|
||||
'channelCallers',
|
||||
'revokeChannelCaller',
|
||||
]);
|
||||
import { CloudAgentJournal } from './cloud-agent-journal';
|
||||
import type { CloudRecent } from '../../shared/cloud-agents';
|
||||
import { WORKS_SQUARE_CONFIG } from '../api/works-config';
|
||||
@@ -45,8 +52,6 @@ const MESSAGES: Record<string, string> = {
|
||||
channel_session_control_failed: '微信会话操作失败,请刷新后重试',
|
||||
channel_delivery_not_found: '渠道交付记录不存在',
|
||||
channel_delivery_retry_failed: '文件补发失败,请刷新交付记录后重试',
|
||||
self_pairing_removed: '本人无需配对,请直接使用绑定时扫码的微信发送消息',
|
||||
pairing_expired: '邀请码已过期,请重新生成',
|
||||
verification_required: '请先完成微信验证',
|
||||
artifact_unavailable: '文件已不可用,请刷新文件列表',
|
||||
operation_unavailable: '操作状态暂时无法确认,请稍后查询',
|
||||
@@ -61,10 +66,6 @@ const MESSAGES: Record<string, string> = {
|
||||
run_active: '当前会话仍在执行,请稍后重试',
|
||||
run_not_active: '当前会话没有可操作的运行',
|
||||
channel_session_unavailable: '新的微信会话暂时无法建立',
|
||||
pairing_invalid: '配对请求无效,请刷新后重试',
|
||||
invitation_invalid: '邀请码无效或已撤销',
|
||||
invitation_consumed: '邀请码已经使用',
|
||||
invites_disabled: '当前渠道仅允许本人使用',
|
||||
agentbus_unavailable: '渠道服务暂时不可用,请稍后重试',
|
||||
};
|
||||
|
||||
@@ -253,6 +254,10 @@ export class CloudAgentsModule {
|
||||
await this.journal.remove(binding.accountKey, id, () => this.requireCurrent(binding));
|
||||
return { discarded: true };
|
||||
}
|
||||
if (retiredChannelOperations.has(pending.operation)) {
|
||||
await this.journal.remove(binding.accountKey, id, () => this.requireCurrent(binding));
|
||||
return { operation: pending.operation, input: pending.input, discarded: true, retired: true };
|
||||
}
|
||||
if (pending.operation === 'wechatBindVerification' || pending.operation === 'channelAccountWechatBindVerification') {
|
||||
// The verification code is intentionally never persisted. First recover the
|
||||
// durable provider receipt: the code may already have been consumed even if
|
||||
@@ -337,7 +342,7 @@ export class CloudAgentsModule {
|
||||
'createChannelAccount', 'routeChannelAccount', 'enableChannelAccount', 'pauseChannelAccount', 'disconnectChannelAccount',
|
||||
'channelAccountWechatBindStart', 'channelAccountWechatBindVerification', 'channelAccountWechatUnbind',
|
||||
'createChannelBinding', 'switchChannelBindingAgent', 'enableChannelBinding', 'pauseChannelBinding', 'disconnectChannelBinding',
|
||||
'channelPolicy', 'createChannelPairing', 'wechatBindStart', 'wechatBindVerification', 'wechatUnbind', 'revokeChannelCaller',
|
||||
'wechatBindStart', 'wechatBindVerification', 'wechatUnbind',
|
||||
'channelConversationControl', 'retryChannelDeliveryPart'];
|
||||
let result: unknown;
|
||||
if (recoverable.includes(plan.operation)) {
|
||||
|
||||
Reference in New Issue
Block a user