@tencent-rtc/mcp 1.3.0 → 1.3.1
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/package.json +2 -2
- package/resource/doc/chatuikit/react/integration.md +430 -49
- package/resource/doc/chatuikit/react/workflow.md +258 -0
- package/resource/doc/chatuikit/vue/integration.md +355 -144
- package/resource/doc/chatuikit/vue/workflow.md +395 -0
- package/tools/chat/get-web-chat-integration.js +31 -14
- package/tools/chat/get-web-chat-integration.js.map +1 -1
- package/tools/definitions/get_web_chat_uikit_integration_def.js +19 -12
- package/tools/definitions/get_web_chat_uikit_integration_def.js.map +1 -1
- package/tools/index.js +0 -2
- package/tools/index.js.map +1 -1
- package/tools/live/get-web-live-uikit-integration.js +1 -1
- package/utils/generate-structured-result.js +2 -2
- package/utils/generate-structured-result.js.map +1 -1
- package/utils/report-cls-client.js +1 -1
- package/utils/report-es-client.js +1 -1
- package/resource/doc/chatuikit/react/chat_window_integration.md +0 -94
- package/resource/doc/chatuikit/vue/chat_window_integration.md +0 -156
- package/tools/chat/get-web-chat-window-integration.js +0 -28
- package/tools/chat/get-web-chat-window-integration.js.map +0 -1
- package/tools/definitions/get_web_chat_window_integration_def.js +0 -26
- package/tools/definitions/get_web_chat_window_integration_def.js.map +0 -1
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# React Chat TUIKit Code Generation Workflow Instructions
|
|
2
|
+
|
|
3
|
+
## 📋 Purpose
|
|
4
|
+
|
|
5
|
+
This document provides a **code generation blueprint** for implementing React Chat TUIKit core features, guiding the Agent to **prioritize real-time documentation** retrieved from tools.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🛑 Mandatory Execution Constraints (Guardrails)
|
|
10
|
+
|
|
11
|
+
The Agent MUST strictly follow these rules when generating code:
|
|
12
|
+
|
|
13
|
+
### 1. Documentation-Driven Integration
|
|
14
|
+
- **MUST** strictly follow the `llm_code_generation_instructions_md` steps from tool results
|
|
15
|
+
|
|
16
|
+
### 2. Silent Execution
|
|
17
|
+
- **MUST** automatically install dependencies and start the project after all code generation is complete
|
|
18
|
+
|
|
19
|
+
### 3. Zero External Configuration
|
|
20
|
+
- **FORBIDDEN** to create any `config.js` or `.env` files
|
|
21
|
+
- Credentials (SDKAppID, UserID, UserSig) **MUST** be directly injected into code variables
|
|
22
|
+
|
|
23
|
+
### 4. Auto-Retrieve Authentication Credentials
|
|
24
|
+
- **MUST** call `get_usersig` tool to obtain test credentials
|
|
25
|
+
- **FORBIDDEN** to ask users to manually input credentials
|
|
26
|
+
- UserID generation should be simple (e.g., `test001`), **AVOID** dynamic timestamps to prevent logic errors
|
|
27
|
+
|
|
28
|
+
### 5. Default Active Conversation
|
|
29
|
+
- Integration logic **MUST** include `setActiveConversation` call
|
|
30
|
+
- **MUST** activate `C2Cadministrator` conversation by default
|
|
31
|
+
|
|
32
|
+
### 6. React Version Constraint
|
|
33
|
+
- When creating projects, React and React-DOM versions **MUST** be `18.2.0`
|
|
34
|
+
- **FORBIDDEN** to use React 19
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 📦 TUIKit Version & Dependency Automation
|
|
39
|
+
|
|
40
|
+
After generating code, the Agent **MUST** automatically execute the following dependency chain:
|
|
41
|
+
|
|
42
|
+
### 1. Core Dependency Versions (Recommended)
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"react": "18.2.0",
|
|
47
|
+
"react-dom": "18.2.0",
|
|
48
|
+
"@tencentcloud/chat-uikit-react": "latest",
|
|
49
|
+
"@tencentcloud/call-uikit-react": "latest"
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 2. Build Environment Patch (Vite/esbuild)
|
|
54
|
+
|
|
55
|
+
If Vite project is detected, Agent **MUST** add patch configuration to `package.json` for esbuild-wasm compatibility:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"overrides": {
|
|
60
|
+
"esbuild": "npm:esbuild-wasm@latest"
|
|
61
|
+
},
|
|
62
|
+
"resolutions": {
|
|
63
|
+
"esbuild": "npm:esbuild-wasm@latest"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 🛠️ Integration Mode Selection (Goals)
|
|
71
|
+
|
|
72
|
+
Based on user's `goals`, Agent **MUST** choose the corresponding execution path:
|
|
73
|
+
|
|
74
|
+
### 1. Full-Featured Integration
|
|
75
|
+
|
|
76
|
+
**Goal**: Implement a complete IM application similar to WeChat
|
|
77
|
+
|
|
78
|
+
**Core Components**:
|
|
79
|
+
- `ConversationList` (conversation list)
|
|
80
|
+
- `Chat` (chat container)
|
|
81
|
+
- `ContactList` (contact list)
|
|
82
|
+
- `Search` (cloud search)
|
|
83
|
+
|
|
84
|
+
**Execution Reference**:
|
|
85
|
+
- Follow the `integration.md` instructions retrieved in real-time from tool results
|
|
86
|
+
|
|
87
|
+
**Use Cases**:
|
|
88
|
+
- Building standalone chat applications
|
|
89
|
+
- Requiring complete conversation management, contacts, and group management features
|
|
90
|
+
- Serving as core functional module of web applications
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### 2. Chat-Only Integration
|
|
95
|
+
|
|
96
|
+
**Goal**: Suitable for customer service, consultation, detail page private chat, and other pure conversation scenarios
|
|
97
|
+
|
|
98
|
+
**Core Components**:
|
|
99
|
+
- `Chat` (chat container)
|
|
100
|
+
- `MessageList` (message list)
|
|
101
|
+
- `ChatHeader` (chat header)
|
|
102
|
+
- `MessageInput` (input box)
|
|
103
|
+
|
|
104
|
+
**Execution Reference**:
|
|
105
|
+
- Follow the `integration.md` instructions retrieved in real-time from tool results
|
|
106
|
+
|
|
107
|
+
**Use Cases**:
|
|
108
|
+
- Customer service scenarios (users click consultation button to enter chat page)
|
|
109
|
+
- Medical online consultation (patient-doctor one-on-one communication)
|
|
110
|
+
- Order detail page private chat (buyer-seller communication)
|
|
111
|
+
- Private messaging in social applications
|
|
112
|
+
|
|
113
|
+
**🔴 Default Excluded Features (Agent MUST Comply)**:
|
|
114
|
+
|
|
115
|
+
When generating chat-only mode code, Agent **MUST exclude by default** the following features and components:
|
|
116
|
+
|
|
117
|
+
1. **Default NO Sidebar Integration**
|
|
118
|
+
- DO NOT generate any sidebar-related code by default
|
|
119
|
+
- DO NOT import conversation list, contacts, or other sidebar components by default
|
|
120
|
+
- Chat window should be standalone, pure chat interface WITHOUT sidebar by default
|
|
121
|
+
|
|
122
|
+
2. **Default NO ChatSetting Integration**
|
|
123
|
+
- DO NOT generate conversation settings or group management features by default
|
|
124
|
+
- DO NOT add settings button on ChatHeader right side by default
|
|
125
|
+
- DO NOT import ChatSetting component by default
|
|
126
|
+
|
|
127
|
+
3. **Default NO In-Conversation Search**
|
|
128
|
+
- DO NOT add message search functionality by default
|
|
129
|
+
- DO NOT add search entry in chat interface by default
|
|
130
|
+
- DO NOT import Search component by default
|
|
131
|
+
|
|
132
|
+
4. **Default NO ConversationList Integration**
|
|
133
|
+
- In chat-only mode, users specify conversation ID through external routes/parameters
|
|
134
|
+
- DO NOT need conversation switching functionality by default
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
**⚠️ Exception Handling When User Explicitly Requests**:
|
|
139
|
+
|
|
140
|
+
If user **explicitly requests** adding extended features in chat-only mode, Agent **SHOULD allow and execute**:
|
|
141
|
+
|
|
142
|
+
**Trigger Conditions** (any one satisfied):
|
|
143
|
+
- User explicitly states: "need ChatSetting", "integrate chat settings", "add conversation settings feature"
|
|
144
|
+
- User explicitly states: "need Search", "add search functionality", "integrate in-conversation search"
|
|
145
|
+
- User explicitly states: "need Sidebar", "add sidebar"
|
|
146
|
+
- User explicitly requests other extended features
|
|
147
|
+
|
|
148
|
+
**Agent Execution Flow**:
|
|
149
|
+
1. ✅ **Confirm User Needs**: Recognize that user actively requests extended features
|
|
150
|
+
2. ✅ **Allow Integration**: On top of chat-only mode foundation, additionally integrate components requested by user
|
|
151
|
+
3. ✅ **Stay Restrained**: Only add features explicitly requested by user, DO NOT arbitrarily expand other features
|
|
152
|
+
4. ✅ **Follow Documentation**: Correctly integrate required components according to integration documentation
|
|
153
|
+
|
|
154
|
+
**Example Scenarios**:
|
|
155
|
+
|
|
156
|
+
**Scenario 1: User Explicitly Requests ChatSetting**
|
|
157
|
+
```
|
|
158
|
+
User: "Help me build a chat-only chat window with Vue, need to integrate ChatSetting functionality"
|
|
159
|
+
Agent Execution:
|
|
160
|
+
✅ Integrate core chat components (Chat, MessageList, ChatHeader, MessageInput)
|
|
161
|
+
✅ Additionally integrate ChatSetting component (because user explicitly requested)
|
|
162
|
+
❌ DO NOT integrate Sidebar, Search, or other features not requested by user
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Scenario 2: User Explicitly Requests In-Conversation Search**
|
|
166
|
+
```
|
|
167
|
+
User: "Build a chat-only chat window with message search functionality"
|
|
168
|
+
Agent Execution:
|
|
169
|
+
✅ Integrate core chat components
|
|
170
|
+
✅ Additionally integrate Search component (because user explicitly requested)
|
|
171
|
+
❌ DO NOT integrate Sidebar, ChatSetting, or other features not requested by user
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**Scenario 3: User Does NOT Explicitly Request Extended Features**
|
|
175
|
+
```
|
|
176
|
+
User: "Help me build a chat-only chat window with Vue"
|
|
177
|
+
Agent Execution:
|
|
178
|
+
✅ Only integrate core chat components (Chat, MessageList, ChatHeader, MessageInput)
|
|
179
|
+
❌ DO NOT integrate any extended features (Sidebar, ChatSetting, Search, etc.)
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
**Agent Code Generation Constraints**:
|
|
185
|
+
- ✅ **Generate by Default**: Only `Chat`, `MessageList`, `ChatHeader`, `MessageInput` core chat components
|
|
186
|
+
- ✅ **When User Explicitly Requests**: On top of core components, additionally integrate extended features explicitly requested by user
|
|
187
|
+
- ⚠️ **Judgment Criteria**: Check if user requirements contain explicit feature keywords (e.g., "ChatSetting", "search", "settings", etc.)
|
|
188
|
+
- ✅ **Stay Restrained**: DO NOT arbitrarily add features not explicitly requested by user
|
|
189
|
+
- ✅ **Stay Simple**: Core philosophy of chat-only mode is lightweight conversation interface
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## 📞 Extended Feature: Audio/Video Calling (TUICallKit)
|
|
194
|
+
|
|
195
|
+
If requirements include "calling" or "video" functionality, Agent **MUST** execute:
|
|
196
|
+
|
|
197
|
+
### Component Mounting
|
|
198
|
+
- Use React Portal to mount TUICallKit component to body
|
|
199
|
+
|
|
200
|
+
### Interaction Injection
|
|
201
|
+
|
|
202
|
+
**Inject call buttons in ChatHeader's right slot (ChatHeaderRight)**
|
|
203
|
+
- Icons: phone, camera, etc.
|
|
204
|
+
|
|
205
|
+
**Private Chat Logic**:
|
|
206
|
+
- Initiate calls via `TUICallKitServer.calls`
|
|
207
|
+
- UserID automatically extracted from current active conversation
|
|
208
|
+
|
|
209
|
+
**Group Chat Logic**:
|
|
210
|
+
- Need to integrate `UserPicker` component
|
|
211
|
+
- Guide user to select group members before initiating call
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## 🔄 Complete Automation Flow Summary
|
|
216
|
+
|
|
217
|
+
```mermaid
|
|
218
|
+
graph TD
|
|
219
|
+
A[Receive Goals Requirements] --> B[Call get_web_chat_uikit_integration to Fetch Documentation]
|
|
220
|
+
B --> C[Auto Execute npm install]
|
|
221
|
+
C --> D[Agent Generates Code Files Based on Real-Time Documentation]
|
|
222
|
+
D --> E[Call get_usersig to Obtain Test Credentials]
|
|
223
|
+
E --> F[Inject Credentials & Auto Activate C2Cadministrator Conversation]
|
|
224
|
+
F --> G{Check Call Requirements}
|
|
225
|
+
G -->|Yes| H[Integrate TUICallKit & Mounting Logic]
|
|
226
|
+
G -->|No| I[Skip]
|
|
227
|
+
H --> J[record_result & Prompt User to Run]
|
|
228
|
+
I --> J
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## ✍️ Agent Code Generation Example Instructions (Prompts)
|
|
234
|
+
|
|
235
|
+
When Agent starts writing code, should follow this semantic logic:
|
|
236
|
+
|
|
237
|
+
> "Following `full-featured` mode, generate a React TUIKit integration page for me. Please auto-configure `C2Cadministrator` default activation, and inject credentials obtained from `get_usersig` tool. FORBIDDEN to create config files."
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## 📝 Key Points Summary
|
|
242
|
+
|
|
243
|
+
| Category | Requirements |
|
|
244
|
+
|----------|--------------|
|
|
245
|
+
| **Documentation First** | Strictly follow latest documentation instructions from tool results |
|
|
246
|
+
| **Silent Integration** | Start development server AFTER code generation is complete |
|
|
247
|
+
| **Credential Injection** | Auto call `get_usersig`, directly inject into code |
|
|
248
|
+
| **Default Conversation** | Auto activate `C2Cadministrator` conversation |
|
|
249
|
+
| **Dependency Management** | Auto detect and install required dependency packages |
|
|
250
|
+
| **React Version** | Use React 18.2.0, AVOID React 19 |
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## 🔗 Related Tool References
|
|
255
|
+
|
|
256
|
+
- `get_usersig` - Obtain test credentials
|
|
257
|
+
- `get_web_chat_uikit_integration` - Retrieve real-time integration documentation
|
|
258
|
+
- `record_result` - Record integration results
|