@xpert-ai/plugin-community-wechat 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +353 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +139 -0
- package/dist/lib/constants.d.ts +23 -0
- package/dist/lib/constants.js +23 -0
- package/dist/lib/conversation-user-key.d.ts +13 -0
- package/dist/lib/conversation-user-key.js +28 -0
- package/dist/lib/conversation.service.d.ts +215 -0
- package/dist/lib/conversation.service.js +1179 -0
- package/dist/lib/decorators.d.ts +2 -0
- package/dist/lib/decorators.js +3 -0
- package/dist/lib/entities/index.d.ts +4 -0
- package/dist/lib/entities/index.js +4 -0
- package/dist/lib/entities/wechat-personal-account.entity.d.ts +19 -0
- package/dist/lib/entities/wechat-personal-account.entity.js +83 -0
- package/dist/lib/entities/wechat-personal-conversation-binding.entity.d.ts +14 -0
- package/dist/lib/entities/wechat-personal-conversation-binding.entity.js +65 -0
- package/dist/lib/entities/wechat-personal-message-log.entity.d.ts +27 -0
- package/dist/lib/entities/wechat-personal-message-log.entity.js +108 -0
- package/dist/lib/entities/wechat-personal-trigger-binding.entity.d.ts +17 -0
- package/dist/lib/entities/wechat-personal-trigger-binding.entity.js +71 -0
- package/dist/lib/handoff/index.d.ts +4 -0
- package/dist/lib/handoff/index.js +4 -0
- package/dist/lib/handoff/wechat-personal-chat-callback.processor.d.ts +26 -0
- package/dist/lib/handoff/wechat-personal-chat-callback.processor.js +312 -0
- package/dist/lib/handoff/wechat-personal-chat-dispatch.service.d.ts +26 -0
- package/dist/lib/handoff/wechat-personal-chat-dispatch.service.js +187 -0
- package/dist/lib/handoff/wechat-personal-chat-run-state.service.d.ts +21 -0
- package/dist/lib/handoff/wechat-personal-chat-run-state.service.js +39 -0
- package/dist/lib/handoff/wechat-personal-chat.types.d.ts +69 -0
- package/dist/lib/handoff/wechat-personal-chat.types.js +2 -0
- package/dist/lib/message.d.ts +49 -0
- package/dist/lib/message.js +64 -0
- package/dist/lib/remote-components/wechat-personal-workbench/app.js +1831 -0
- package/dist/lib/tokens.d.ts +1 -0
- package/dist/lib/tokens.js +1 -0
- package/dist/lib/types.d.ts +48 -0
- package/dist/lib/types.js +365 -0
- package/dist/lib/views/wechat-personal-view.provider.d.ts +17 -0
- package/dist/lib/views/wechat-personal-view.provider.js +441 -0
- package/dist/lib/wechat-personal-channel.strategy.d.ts +33 -0
- package/dist/lib/wechat-personal-channel.strategy.js +197 -0
- package/dist/lib/wechat-personal-integration.strategy.d.ts +56 -0
- package/dist/lib/wechat-personal-integration.strategy.js +217 -0
- package/dist/lib/wechat-personal.client.d.ts +29 -0
- package/dist/lib/wechat-personal.client.js +146 -0
- package/dist/lib/wechat-personal.controller.d.ts +50 -0
- package/dist/lib/wechat-personal.controller.js +270 -0
- package/dist/lib/wechat-personal.middleware.d.ts +20 -0
- package/dist/lib/wechat-personal.middleware.js +267 -0
- package/dist/lib/wechat-personal.plugin.d.ts +2 -0
- package/dist/lib/wechat-personal.plugin.js +58 -0
- package/dist/lib/wechat-personal.templates.d.ts +2 -0
- package/dist/lib/wechat-personal.templates.js +100 -0
- package/dist/lib/workflow/index.d.ts +5 -0
- package/dist/lib/workflow/index.js +5 -0
- package/dist/lib/workflow/wechat-personal-trigger-aggregation.service.d.ts +10 -0
- package/dist/lib/workflow/wechat-personal-trigger-aggregation.service.js +39 -0
- package/dist/lib/workflow/wechat-personal-trigger-aggregation.types.d.ts +30 -0
- package/dist/lib/workflow/wechat-personal-trigger-aggregation.types.js +2 -0
- package/dist/lib/workflow/wechat-personal-trigger-flush.processor.d.ts +8 -0
- package/dist/lib/workflow/wechat-personal-trigger-flush.processor.js +39 -0
- package/dist/lib/workflow/wechat-personal-trigger.strategy.d.ts +65 -0
- package/dist/lib/workflow/wechat-personal-trigger.strategy.js +511 -0
- package/dist/lib/workflow/wechat-personal-trigger.types.d.ts +10 -0
- package/dist/lib/workflow/wechat-personal-trigger.types.js +2 -0
- package/dist/xpert-wechat-personal-admin-assistant.yaml +103 -0
- package/dist/xpert-wechat-personal-user-assistant.yaml +127 -0
- package/package.json +79 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare class WechatPersonalAccountEntity {
|
|
2
|
+
static readonly tableName = "plugin_wechat_personal_account";
|
|
3
|
+
id: string;
|
|
4
|
+
integrationId: string;
|
|
5
|
+
uuid: string;
|
|
6
|
+
ownerWxid?: string;
|
|
7
|
+
displayName?: string;
|
|
8
|
+
status: 'online' | 'offline' | 'unknown' | 'disabled' | 'error';
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
lastCallbackAt?: Date;
|
|
11
|
+
lastSendAt?: Date;
|
|
12
|
+
lastError?: string;
|
|
13
|
+
tenantId?: string;
|
|
14
|
+
organizationId?: string;
|
|
15
|
+
createdById?: string;
|
|
16
|
+
updatedById?: string;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
updatedAt: Date;
|
|
19
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
|
11
|
+
let WechatPersonalAccountEntity = class WechatPersonalAccountEntity {
|
|
12
|
+
static { this.tableName = 'plugin_wechat_personal_account'; }
|
|
13
|
+
};
|
|
14
|
+
__decorate([
|
|
15
|
+
PrimaryGeneratedColumn('uuid'),
|
|
16
|
+
__metadata("design:type", String)
|
|
17
|
+
], WechatPersonalAccountEntity.prototype, "id", void 0);
|
|
18
|
+
__decorate([
|
|
19
|
+
Column({ length: 36 }),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], WechatPersonalAccountEntity.prototype, "integrationId", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
Column({ length: 128 }),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], WechatPersonalAccountEntity.prototype, "uuid", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
Column({ nullable: true, length: 128 }),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], WechatPersonalAccountEntity.prototype, "ownerWxid", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
Column({ nullable: true, length: 128 }),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], WechatPersonalAccountEntity.prototype, "displayName", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
Column({ length: 32, default: 'unknown' }),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], WechatPersonalAccountEntity.prototype, "status", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
Column({ type: 'boolean', default: true }),
|
|
40
|
+
__metadata("design:type", Boolean)
|
|
41
|
+
], WechatPersonalAccountEntity.prototype, "enabled", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
Column({ type: 'timestamptz', nullable: true }),
|
|
44
|
+
__metadata("design:type", Date)
|
|
45
|
+
], WechatPersonalAccountEntity.prototype, "lastCallbackAt", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
Column({ type: 'timestamptz', nullable: true }),
|
|
48
|
+
__metadata("design:type", Date)
|
|
49
|
+
], WechatPersonalAccountEntity.prototype, "lastSendAt", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
Column({ nullable: true, length: 512 }),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], WechatPersonalAccountEntity.prototype, "lastError", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
Column({ nullable: true, length: 36 }),
|
|
56
|
+
__metadata("design:type", String)
|
|
57
|
+
], WechatPersonalAccountEntity.prototype, "tenantId", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
Column({ nullable: true, length: 36 }),
|
|
60
|
+
__metadata("design:type", String)
|
|
61
|
+
], WechatPersonalAccountEntity.prototype, "organizationId", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
Column({ nullable: true, length: 36 }),
|
|
64
|
+
__metadata("design:type", String)
|
|
65
|
+
], WechatPersonalAccountEntity.prototype, "createdById", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
Column({ nullable: true, length: 36 }),
|
|
68
|
+
__metadata("design:type", String)
|
|
69
|
+
], WechatPersonalAccountEntity.prototype, "updatedById", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
CreateDateColumn({ type: 'timestamptz' }),
|
|
72
|
+
__metadata("design:type", Date)
|
|
73
|
+
], WechatPersonalAccountEntity.prototype, "createdAt", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
UpdateDateColumn({ type: 'timestamptz' }),
|
|
76
|
+
__metadata("design:type", Date)
|
|
77
|
+
], WechatPersonalAccountEntity.prototype, "updatedAt", void 0);
|
|
78
|
+
WechatPersonalAccountEntity = __decorate([
|
|
79
|
+
Entity(WechatPersonalAccountEntity.tableName),
|
|
80
|
+
Index('plugin_wechat_personal_account_integration_uuid_uq', ['integrationId', 'uuid'], { unique: true }),
|
|
81
|
+
Index('plugin_wechat_personal_account_tenant_org_idx', ['tenantId', 'organizationId'])
|
|
82
|
+
], WechatPersonalAccountEntity);
|
|
83
|
+
export { WechatPersonalAccountEntity };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class WechatPersonalConversationBindingEntity {
|
|
2
|
+
static readonly tableName = "plugin_wechat_personal_conversation_binding";
|
|
3
|
+
id: string;
|
|
4
|
+
conversationUserKey: string;
|
|
5
|
+
xpertId: string;
|
|
6
|
+
conversationId: string;
|
|
7
|
+
lastActiveAt?: Date;
|
|
8
|
+
tenantId?: string;
|
|
9
|
+
organizationId?: string;
|
|
10
|
+
createdById?: string;
|
|
11
|
+
updatedById?: string;
|
|
12
|
+
createdAt: Date;
|
|
13
|
+
updatedAt: Date;
|
|
14
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
|
11
|
+
let WechatPersonalConversationBindingEntity = class WechatPersonalConversationBindingEntity {
|
|
12
|
+
static { this.tableName = 'plugin_wechat_personal_conversation_binding'; }
|
|
13
|
+
};
|
|
14
|
+
__decorate([
|
|
15
|
+
PrimaryGeneratedColumn('uuid'),
|
|
16
|
+
__metadata("design:type", String)
|
|
17
|
+
], WechatPersonalConversationBindingEntity.prototype, "id", void 0);
|
|
18
|
+
__decorate([
|
|
19
|
+
Column({ length: 512 }),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], WechatPersonalConversationBindingEntity.prototype, "conversationUserKey", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
Column({ length: 36 }),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], WechatPersonalConversationBindingEntity.prototype, "xpertId", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
Column({ length: 36 }),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], WechatPersonalConversationBindingEntity.prototype, "conversationId", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
Column({ type: 'timestamptz', nullable: true }),
|
|
32
|
+
__metadata("design:type", Date)
|
|
33
|
+
], WechatPersonalConversationBindingEntity.prototype, "lastActiveAt", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
Column({ nullable: true, length: 36 }),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], WechatPersonalConversationBindingEntity.prototype, "tenantId", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
Column({ nullable: true, length: 36 }),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], WechatPersonalConversationBindingEntity.prototype, "organizationId", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
Column({ nullable: true, length: 36 }),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], WechatPersonalConversationBindingEntity.prototype, "createdById", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
Column({ nullable: true, length: 36 }),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], WechatPersonalConversationBindingEntity.prototype, "updatedById", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
CreateDateColumn({ type: 'timestamptz' }),
|
|
52
|
+
__metadata("design:type", Date)
|
|
53
|
+
], WechatPersonalConversationBindingEntity.prototype, "createdAt", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
UpdateDateColumn({ type: 'timestamptz' }),
|
|
56
|
+
__metadata("design:type", Date)
|
|
57
|
+
], WechatPersonalConversationBindingEntity.prototype, "updatedAt", void 0);
|
|
58
|
+
WechatPersonalConversationBindingEntity = __decorate([
|
|
59
|
+
Entity(WechatPersonalConversationBindingEntity.tableName),
|
|
60
|
+
Index('plugin_wechat_personal_conversation_binding_user_key_xpert_uq', ['conversationUserKey', 'xpertId'], {
|
|
61
|
+
unique: true
|
|
62
|
+
}),
|
|
63
|
+
Index('plugin_wechat_personal_conversation_binding_tenant_org_idx', ['tenantId', 'organizationId'])
|
|
64
|
+
], WechatPersonalConversationBindingEntity);
|
|
65
|
+
export { WechatPersonalConversationBindingEntity };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type WechatPersonalMessageDirection = 'inbound' | 'outbound' | 'system';
|
|
2
|
+
export type WechatPersonalMessageLogStatus = 'received' | 'dispatched' | 'sent' | 'skipped' | 'failed';
|
|
3
|
+
export declare class WechatPersonalMessageLogEntity {
|
|
4
|
+
static readonly tableName = "plugin_wechat_personal_message_log";
|
|
5
|
+
id: string;
|
|
6
|
+
integrationId: string;
|
|
7
|
+
uuid: string;
|
|
8
|
+
ownerWxid?: string;
|
|
9
|
+
contactId: string;
|
|
10
|
+
senderId?: string;
|
|
11
|
+
messageId?: string;
|
|
12
|
+
chatType?: 'private' | 'group';
|
|
13
|
+
direction: WechatPersonalMessageDirection;
|
|
14
|
+
status: WechatPersonalMessageLogStatus;
|
|
15
|
+
content?: string;
|
|
16
|
+
payloadSummary?: string;
|
|
17
|
+
error?: string;
|
|
18
|
+
xpertId?: string;
|
|
19
|
+
conversationId?: string;
|
|
20
|
+
conversationUserKey?: string;
|
|
21
|
+
tenantId?: string;
|
|
22
|
+
organizationId?: string;
|
|
23
|
+
createdById?: string;
|
|
24
|
+
updatedById?: string;
|
|
25
|
+
createdAt: Date;
|
|
26
|
+
updatedAt: Date;
|
|
27
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
|
11
|
+
let WechatPersonalMessageLogEntity = class WechatPersonalMessageLogEntity {
|
|
12
|
+
static { this.tableName = 'plugin_wechat_personal_message_log'; }
|
|
13
|
+
};
|
|
14
|
+
__decorate([
|
|
15
|
+
PrimaryGeneratedColumn('uuid'),
|
|
16
|
+
__metadata("design:type", String)
|
|
17
|
+
], WechatPersonalMessageLogEntity.prototype, "id", void 0);
|
|
18
|
+
__decorate([
|
|
19
|
+
Column({ length: 36 }),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], WechatPersonalMessageLogEntity.prototype, "integrationId", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
Column({ length: 128 }),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], WechatPersonalMessageLogEntity.prototype, "uuid", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
Column({ nullable: true, length: 128 }),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], WechatPersonalMessageLogEntity.prototype, "ownerWxid", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
Column({ length: 255 }),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], WechatPersonalMessageLogEntity.prototype, "contactId", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
Column({ nullable: true, length: 255 }),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], WechatPersonalMessageLogEntity.prototype, "senderId", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
Column({ nullable: true, length: 64 }),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], WechatPersonalMessageLogEntity.prototype, "messageId", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
Column({ nullable: true, length: 32 }),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], WechatPersonalMessageLogEntity.prototype, "chatType", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
Column({ length: 16 }),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], WechatPersonalMessageLogEntity.prototype, "direction", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
Column({ length: 24 }),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], WechatPersonalMessageLogEntity.prototype, "status", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
Column({ type: 'text', nullable: true }),
|
|
56
|
+
__metadata("design:type", String)
|
|
57
|
+
], WechatPersonalMessageLogEntity.prototype, "content", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
Column({ type: 'text', nullable: true }),
|
|
60
|
+
__metadata("design:type", String)
|
|
61
|
+
], WechatPersonalMessageLogEntity.prototype, "payloadSummary", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
Column({ nullable: true, length: 512 }),
|
|
64
|
+
__metadata("design:type", String)
|
|
65
|
+
], WechatPersonalMessageLogEntity.prototype, "error", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
Column({ nullable: true, length: 36 }),
|
|
68
|
+
__metadata("design:type", String)
|
|
69
|
+
], WechatPersonalMessageLogEntity.prototype, "xpertId", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
Column({ nullable: true, length: 36 }),
|
|
72
|
+
__metadata("design:type", String)
|
|
73
|
+
], WechatPersonalMessageLogEntity.prototype, "conversationId", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
Column({ nullable: true, length: 512 }),
|
|
76
|
+
__metadata("design:type", String)
|
|
77
|
+
], WechatPersonalMessageLogEntity.prototype, "conversationUserKey", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
Column({ nullable: true, length: 36 }),
|
|
80
|
+
__metadata("design:type", String)
|
|
81
|
+
], WechatPersonalMessageLogEntity.prototype, "tenantId", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
Column({ nullable: true, length: 36 }),
|
|
84
|
+
__metadata("design:type", String)
|
|
85
|
+
], WechatPersonalMessageLogEntity.prototype, "organizationId", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
Column({ nullable: true, length: 36 }),
|
|
88
|
+
__metadata("design:type", String)
|
|
89
|
+
], WechatPersonalMessageLogEntity.prototype, "createdById", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
Column({ nullable: true, length: 36 }),
|
|
92
|
+
__metadata("design:type", String)
|
|
93
|
+
], WechatPersonalMessageLogEntity.prototype, "updatedById", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
CreateDateColumn({ type: 'timestamptz' }),
|
|
96
|
+
__metadata("design:type", Date)
|
|
97
|
+
], WechatPersonalMessageLogEntity.prototype, "createdAt", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
UpdateDateColumn({ type: 'timestamptz' }),
|
|
100
|
+
__metadata("design:type", Date)
|
|
101
|
+
], WechatPersonalMessageLogEntity.prototype, "updatedAt", void 0);
|
|
102
|
+
WechatPersonalMessageLogEntity = __decorate([
|
|
103
|
+
Entity(WechatPersonalMessageLogEntity.tableName),
|
|
104
|
+
Index('plugin_wechat_personal_message_log_message_idx', ['integrationId', 'messageId', 'direction']),
|
|
105
|
+
Index('plugin_wechat_personal_message_log_tenant_org_idx', ['tenantId', 'organizationId']),
|
|
106
|
+
Index('plugin_wechat_personal_message_log_integration_created_idx', ['integrationId', 'createdAt'])
|
|
107
|
+
], WechatPersonalMessageLogEntity);
|
|
108
|
+
export { WechatPersonalMessageLogEntity };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { WechatPersonalGroupTriggerMode } from '../types.js';
|
|
2
|
+
export declare class WechatPersonalTriggerBindingEntity {
|
|
3
|
+
static readonly tableName = "plugin_wechat_personal_trigger_binding";
|
|
4
|
+
id: string;
|
|
5
|
+
integrationId: string;
|
|
6
|
+
xpertId: string;
|
|
7
|
+
sessionTimeoutSeconds: number;
|
|
8
|
+
summaryWindowSeconds: number;
|
|
9
|
+
groupTriggerMode: WechatPersonalGroupTriggerMode;
|
|
10
|
+
groupKeywords?: string[];
|
|
11
|
+
tenantId?: string;
|
|
12
|
+
organizationId?: string;
|
|
13
|
+
createdById?: string;
|
|
14
|
+
updatedById?: string;
|
|
15
|
+
createdAt: Date;
|
|
16
|
+
updatedAt: Date;
|
|
17
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
|
11
|
+
let WechatPersonalTriggerBindingEntity = class WechatPersonalTriggerBindingEntity {
|
|
12
|
+
static { this.tableName = 'plugin_wechat_personal_trigger_binding'; }
|
|
13
|
+
};
|
|
14
|
+
__decorate([
|
|
15
|
+
PrimaryGeneratedColumn('uuid'),
|
|
16
|
+
__metadata("design:type", String)
|
|
17
|
+
], WechatPersonalTriggerBindingEntity.prototype, "id", void 0);
|
|
18
|
+
__decorate([
|
|
19
|
+
Column({ length: 36 }),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], WechatPersonalTriggerBindingEntity.prototype, "integrationId", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
Column({ length: 36 }),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], WechatPersonalTriggerBindingEntity.prototype, "xpertId", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
Column({ type: 'integer', default: 3600 }),
|
|
28
|
+
__metadata("design:type", Number)
|
|
29
|
+
], WechatPersonalTriggerBindingEntity.prototype, "sessionTimeoutSeconds", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
Column({ type: 'integer', default: 0 }),
|
|
32
|
+
__metadata("design:type", Number)
|
|
33
|
+
], WechatPersonalTriggerBindingEntity.prototype, "summaryWindowSeconds", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
Column({ type: 'varchar', length: 32, default: 'mention_or_keywords' }),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], WechatPersonalTriggerBindingEntity.prototype, "groupTriggerMode", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
Column({ type: 'simple-array', nullable: true }),
|
|
40
|
+
__metadata("design:type", Array)
|
|
41
|
+
], WechatPersonalTriggerBindingEntity.prototype, "groupKeywords", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
Column({ nullable: true, length: 36 }),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], WechatPersonalTriggerBindingEntity.prototype, "tenantId", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
Column({ nullable: true, length: 36 }),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], WechatPersonalTriggerBindingEntity.prototype, "organizationId", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
Column({ nullable: true, length: 36 }),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], WechatPersonalTriggerBindingEntity.prototype, "createdById", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
Column({ nullable: true, length: 36 }),
|
|
56
|
+
__metadata("design:type", String)
|
|
57
|
+
], WechatPersonalTriggerBindingEntity.prototype, "updatedById", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
CreateDateColumn({ type: 'timestamptz' }),
|
|
60
|
+
__metadata("design:type", Date)
|
|
61
|
+
], WechatPersonalTriggerBindingEntity.prototype, "createdAt", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
UpdateDateColumn({ type: 'timestamptz' }),
|
|
64
|
+
__metadata("design:type", Date)
|
|
65
|
+
], WechatPersonalTriggerBindingEntity.prototype, "updatedAt", void 0);
|
|
66
|
+
WechatPersonalTriggerBindingEntity = __decorate([
|
|
67
|
+
Entity(WechatPersonalTriggerBindingEntity.tableName),
|
|
68
|
+
Index('plugin_wechat_personal_trigger_binding_integration_uq', ['integrationId'], { unique: true }),
|
|
69
|
+
Index('plugin_wechat_personal_trigger_binding_tenant_org_idx', ['tenantId', 'organizationId'])
|
|
70
|
+
], WechatPersonalTriggerBindingEntity);
|
|
71
|
+
export { WechatPersonalTriggerBindingEntity };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { HandoffMessage, IHandoffProcessor, ProcessContext, ProcessResult } from '@xpert-ai/plugin-sdk';
|
|
2
|
+
import { WechatPersonalChannelStrategy } from '../wechat-personal-channel.strategy.js';
|
|
3
|
+
import { WechatPersonalConversationService } from '../conversation.service.js';
|
|
4
|
+
import { WechatPersonalChatCallbackPayload } from './wechat-personal-chat.types.js';
|
|
5
|
+
import { WechatPersonalChatRunStateService } from './wechat-personal-chat-run-state.service.js';
|
|
6
|
+
export declare class WechatPersonalChatCallbackProcessor implements IHandoffProcessor<WechatPersonalChatCallbackPayload> {
|
|
7
|
+
private readonly wechatChannel;
|
|
8
|
+
private readonly conversationService;
|
|
9
|
+
private readonly runStateService;
|
|
10
|
+
private readonly logger;
|
|
11
|
+
private readonly sourceLocks;
|
|
12
|
+
constructor(wechatChannel: WechatPersonalChannelStrategy, conversationService: WechatPersonalConversationService, runStateService: WechatPersonalChatRunStateService);
|
|
13
|
+
process(message: HandoffMessage<WechatPersonalChatCallbackPayload>, _ctx: ProcessContext): Promise<ProcessResult>;
|
|
14
|
+
private runWithSourceLock;
|
|
15
|
+
private ensureDefaults;
|
|
16
|
+
private createRunState;
|
|
17
|
+
private processPendingEvents;
|
|
18
|
+
private applyStreamEvent;
|
|
19
|
+
private completeRun;
|
|
20
|
+
private failRun;
|
|
21
|
+
private resolveConversationId;
|
|
22
|
+
private resolveNextAvailableSequence;
|
|
23
|
+
private extractFinalMessageText;
|
|
24
|
+
private normalizeFinalText;
|
|
25
|
+
private resolveFallbackText;
|
|
26
|
+
}
|