@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
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
The AI model must comply with the following **hard restrictions**:
|
|
2
|
-
* **React Version Restriction:** When creating the project, both React and react-dom versions must be `18.2.0`. React 19 is prohibited.
|
|
3
|
-
* **React UIKit Version Restriction:** The latest version of `@tencentcloud/chat-uikit-react` 3.0.0 or higher must be used.
|
|
4
|
-
* **Strictly Follow the Documentation Steps and Instructions for Integration:** When integrating components, the steps and instructions in the documentation must be followed precisely.
|
|
5
|
-
* **Strictly Use the Sample Code in the Documentation:** When creating files, the sample code in the documentation must be used to populate the files. The PlaceholderEmpty property of the Chat component does not need to be filled in.
|
|
6
|
-
* **Open Default Conversation:** The `C2Cadministrator` conversation must be opened using `setActiveConversation`.
|
|
7
|
-
* **Retrieve userSig using a tool:** The TUIKit code must be downloaded and integrated according to the documentation before automatically generating a test userID and calling the `get_usersig` tool to retrieve the userSig. The userID does not need to be appended with a timestamp to avoid errors in dynamic calculation.
|
|
8
|
-
* **Account Information Filling:** After obtaining the userSig, the SDKAppID, userID, and userSig will be automatically filled into the code.
|
|
9
|
-
* **Prohibit Creating User Information Configuration Files:** The `config` directory or file for filling in SDKAppID, userID, and userSig must not be automatically created.
|
|
10
|
-
|
|
11
|
-
# chat-uikit-react Integration
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## step1:create react project
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
requirement: react: 18.2.0, react-dom: 18.2.0.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
you can use vite or rsbuild to create a react project.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
## step2: install chat-uikit-react
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
use npm or pnpm to install @tencentcloud/chat-uikit-react
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
## step3: add chat-uikit-react to your project
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
example code
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
```tsx
|
|
36
|
-
import {
|
|
37
|
-
UIKitProvider,
|
|
38
|
-
useLoginState,
|
|
39
|
-
LoginStatus,
|
|
40
|
-
Chat,
|
|
41
|
-
ChatHeader,
|
|
42
|
-
MessageList,
|
|
43
|
-
MessageInput,
|
|
44
|
-
useConversationListState,
|
|
45
|
-
} from "@tencentcloud/chat-uikit-react";
|
|
46
|
-
|
|
47
|
-
function ChatApp() {
|
|
48
|
-
const { setActiveConversation } = useConversationListState();
|
|
49
|
-
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
// open default conversation
|
|
52
|
-
setActiveConversation('C2Cadministrator');
|
|
53
|
-
}, [setActiveConversation]);
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<div style={{ height: '100vh', width: '100vw', display: 'flex', flexDirection: 'row' }}>
|
|
57
|
-
<Chat PlaceholderEmpty=''>
|
|
58
|
-
<ChatHeader />
|
|
59
|
-
<MessageList />
|
|
60
|
-
<MessageInput />
|
|
61
|
-
</Chat>
|
|
62
|
-
</div>
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
function App() {
|
|
68
|
-
const userID = ''; // TODO: Replace with your userID
|
|
69
|
-
const SDKAppID = 0; // TODO: Replace with your SDKAppID (Notice: SDKAppID is of type number)
|
|
70
|
-
const userSig = ''; // TODO: Replace with your userSig
|
|
71
|
-
|
|
72
|
-
const { status } = useLoginState({
|
|
73
|
-
SDKAppID,
|
|
74
|
-
userID,
|
|
75
|
-
userSig,
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (status !== LoginStatus.SUCCESS) {
|
|
80
|
-
return <div>Loading...</div>
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Language support zh-CN(default) / en-US / ja-JP / ko-KR / zh-TW
|
|
84
|
-
// Theme support light(default) / dark
|
|
85
|
-
return (
|
|
86
|
-
<UIKitProvider language='zh-CN' theme='light'>
|
|
87
|
-
<ChatApp />
|
|
88
|
-
</UIKitProvider>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
export default App;
|
|
94
|
-
```
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
The AI model must comply with the following **hard restrictions**:
|
|
2
|
-
* **Strictly required document procedure integration:** You must perform the integration according to the document procedure and description. In step 1.1, `npm run dev` or `pnpm run dev` is not required. Upon completion, start the project as per step 1.4.
|
|
3
|
-
* **Strictly use the example code in the documentation:** You must strictly use the example code in the document to fill the file when creating a file. For the style tag, non-use of the scoped property is recommended.
|
|
4
|
-
* **Open Default Conversation:** The `C2Cadministrator` conversation must be opened using `setActiveConversation`.
|
|
5
|
-
* **Retrieve userSig using a tool:** The TUIKit code must be downloaded and integrated according to the documentation before automatically generating a test userID and calling the `get_usersig` tool to retrieve the userSig. The userID does not need to be appended with a timestamp to avoid errors in dynamic calculation.
|
|
6
|
-
* **Account Information Filling:** After obtaining the userSig, the SDKAppID, userID, and userSig will be automatically filled into the code.
|
|
7
|
-
* **Prohibit Creating User Information Configuration Files:** The `config` directory or file for filling in SDKAppID, userID, and userSig must not be automatically created.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
# chat-uikit-vue3 Integration
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
User's integration needs have two types. You must rationally analyze which type the need belongs to.
|
|
14
|
-
1. Integrate chat window: Refers to integrating only Chat, ChatHeader, MessageList, and MessageInput components.
|
|
15
|
-
2. Integrate call feature: On the basis of integrated chat only, integrate call feature. You must read section 2.1 "Best Practice - Integrate Call Feature" for details.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
1. Seamless integration of chat window
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
### 1.1 step1:create vue3 project
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if you don't have a vue3 project, you can use vite create a vue3 project. otherwise, you can skip this step.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
requirement: vue3: ^3.0.0, nodejs: ^22.0.0.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if it is a new project, guide the user to use vite to create a vue3 project manually, and then continue with step 1.2. if it is an existing project, skip this step and continue with step 1.2.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
pnpm create vite@latest
|
|
37
|
-
# skip some settings
|
|
38
|
-
cd ${your-vue-project-name}
|
|
39
|
-
pnpm install
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
### 1.2 step2: install chat-uikit-vue3
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
use npm or pnpm to install @tencentcloud/chat-uikit-vue3@latest @tencentcloud/call-uikit-vue@latest
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
### 1.3 step3: add main content to your project
|
|
50
|
-
```vue
|
|
51
|
-
<template>
|
|
52
|
-
<UIKitProvider>
|
|
53
|
-
<Chat style="flex: 1;">
|
|
54
|
-
<ChatHeader />
|
|
55
|
-
<MessageList />
|
|
56
|
-
<MessageInput />
|
|
57
|
-
</Chat>
|
|
58
|
-
</UIKitProvider>
|
|
59
|
-
</template>
|
|
60
|
-
<script setup lang="ts">
|
|
61
|
-
import { useLoginState, useConversationListState } from '@tencentcloud/chat-uikit-vue3';
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const userID = ''; // TODO: Replace with your userID
|
|
65
|
-
const SDKAppID = 0; // TODO: Replace with your SDKAppID (Notice: SDKAppID is of type number)
|
|
66
|
-
const userSig = ''; // TODO: Replace with your userSig
|
|
67
|
-
const conversationID = ref('C2Cadministrator'); // define by yourself
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const { login } = useLoginState();
|
|
71
|
-
const { setActiveConversation } = useConversationListState();
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
login({
|
|
75
|
-
sdkAppId : SDKAppID,
|
|
76
|
-
userId: userID,
|
|
77
|
-
userSig: userSig,
|
|
78
|
-
})
|
|
79
|
-
.then(() => {
|
|
80
|
-
setActiveConversation(conversationID.value);
|
|
81
|
-
})
|
|
82
|
-
.catch(() => {});
|
|
83
|
-
</script>
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
### 1.4 step4: start your project
|
|
88
|
-
```bash
|
|
89
|
-
pnpm run dev
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
Best Practices
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
The following components can be retrieved via MCP Tools get_component_detail ${componenetname.tolowercase()}.
|
|
97
|
-
The following states can be retrieved via MCP Tools get_state_detail ${statename.tolowercase()}.
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
Focus
|
|
101
|
-
1. If necessary, integrate the ChatSetting component, please read the ChatHeaderRight slot description in ChatHeader.
|
|
102
|
-
2. Since integrated chat only does not use ConversationList, you need to obtain activeConversation via useConversationListState of ConversationListState, then call setActiveConversation to set activeConversation.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
### 2.1 Best Practice - Seamless Integration of Call Feature
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
Integrate call feature: On the basis of integrated chat only, add code for call feature.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
Introduce TUICallKit.
|
|
112
|
-
```vue
|
|
113
|
-
<script setup lang="ts">
|
|
114
|
-
import { TUICallKit } from '@tencentcloud/call-uikit-vue';
|
|
115
|
-
</script>
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
Add TUICallKit at the appropriate position:
|
|
120
|
-
```vue
|
|
121
|
-
<Teleport to="body">
|
|
122
|
-
<TUICallKit style="position: fixed; z-index: 1000;"/>
|
|
123
|
-
</Teleport>
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
Focus
|
|
128
|
-
1. Add a call button to the ChatHeaderRight slot in the ChatHeader Component.
|
|
129
|
-
2. Click the call button to call the following method:
|
|
130
|
-
2.1 Read the ConversationListState document and use activeConversation to judge whether it is a single chat or group chat.
|
|
131
|
-
2.2 If it is a one-to-one chat, use `import { TUICallKitServer, TUICallType } from '@tencentcloud/call-uikit-vue';` to introduce the TUICallKitService service. Initiate call via the `calls` method of TUICallKitService.
|
|
132
|
-
```ts
|
|
133
|
-
try {
|
|
134
|
-
await TUICallKitServer.calls({
|
|
135
|
-
userIDList: [activeConversation.value.userProfile.userID],
|
|
136
|
-
type: TUICallType.VIDEO_CALL, // or TUICallType.AUDIO_CALL
|
|
137
|
-
});
|
|
138
|
-
} catch (error: any) {
|
|
139
|
-
console.error(`[TUICallKit] Failed to call the groupCall API. Reason:${error}`);
|
|
140
|
-
}
|
|
141
|
-
```
|
|
142
|
-
2.3 If it is a group chat, read the UserPicker component document. It is advisable to combine with the Dialog component and pop up the UserPicker component.
|
|
143
|
-
Read the GroupSettingState document, combine GroupSettingState's `getGroupMemberList` and `allMembers` to get the group member list.
|
|
144
|
-
```ts
|
|
145
|
-
try {
|
|
146
|
-
await TUICallKitServer.calls({
|
|
147
|
-
userIDList: selectedItems.map((item: any) => item.key),
|
|
148
|
-
type: TUICallType.VIDEO_CALL, // or TUICallType.AUDIO_CALL
|
|
149
|
-
});
|
|
150
|
-
} catch (error: any) {
|
|
151
|
-
console.error(`[TUICallKit] Failed to call the groupCall API. Reason:${error}`);
|
|
152
|
-
}
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
Recommendation: Combine the `reachEnd` event of UserPicker with paged pull to get group members, and use traffic throttling to control the call frequency of `getGroupMemberList`.
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { GET_WEB_CHAT_WINDOW_INTEGRATION_DEFINITION } from '../definitions/get_web_chat_window_integration_def.js';
|
|
3
|
-
import { getDocContent } from '../../utils/get-doc-content.js';
|
|
4
|
-
import { reportCLSClient } from '../../utils/report-cls-client.js';
|
|
5
|
-
import { handleFramework } from '../../utils/handle-framework.js';
|
|
6
|
-
function getResultText(params) {
|
|
7
|
-
const { framework = '' } = params;
|
|
8
|
-
reportCLSClient({
|
|
9
|
-
method: 'get_web_chat_window_integration',
|
|
10
|
-
framework: framework,
|
|
11
|
-
});
|
|
12
|
-
return getDocContent(['chatuikit', `${handleFramework(framework)}`, 'chat_window_integration.md']);
|
|
13
|
-
}
|
|
14
|
-
const registryGetWebChatWindowIntegrationTool = (mcpServer) => {
|
|
15
|
-
const { name, description, parameter_descriptions } = GET_WEB_CHAT_WINDOW_INTEGRATION_DEFINITION;
|
|
16
|
-
mcpServer.tool(name, description, {
|
|
17
|
-
framework: z.enum(['react', 'vue']).describe(parameter_descriptions.framework),
|
|
18
|
-
}, (params) => ({
|
|
19
|
-
content: [
|
|
20
|
-
{
|
|
21
|
-
type: 'text',
|
|
22
|
-
text: getResultText(params),
|
|
23
|
-
}
|
|
24
|
-
]
|
|
25
|
-
}));
|
|
26
|
-
};
|
|
27
|
-
export { registryGetWebChatWindowIntegrationTool };
|
|
28
|
-
//# sourceMappingURL=get-web-chat-window-integration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-web-chat-window-integration.js","sourceRoot":"","sources":["../../../src/tools/chat/get-web-chat-window-integration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,0CAA0C,EAAE,MAAM,uDAAuD,CAAC;AACnH,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE,SAAS,aAAa,CAAC,MAA2B;IAChD,MAAM,EAAE,SAAS,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC;IAClC,eAAe,CAAC;QACd,MAAM,EAAE,iCAAiC;QACzC,SAAS,EAAE,SAAS;KACrB,CAAC,CAAC;IACH,OAAO,aAAa,CAAC,CAAC,WAAW,EAAE,GAAG,eAAe,CAAC,SAAS,CAAC,EAAE,EAAE,4BAA4B,CAAC,CAAC,CAAC;AACrG,CAAC;AAED,MAAM,uCAAuC,GAAG,CAAC,SAAoB,EAAE,EAAE;IACvE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,sBAAsB,EAAE,GAAG,0CAA0C,CAAC;IACjG,SAAS,CAAC,IAAI,CACZ,IAAI,EACJ,WAAW,EACX;QACE,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC,SAAS,CAAC;KAC/E,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACd,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC;aAC5B;SACF;KACF,CAAC,CAAC,CAAC;AACR,CAAC,CAAC;AACF,OAAO,EAAE,uCAAuC,EAAE,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const TOOL_DESCRIPTION = `
|
|
2
|
-
[CORE FUNCTION]: Specialized for Web Standalone Chat Window Integration, providing the solution for creating a single chat window component using TUIKit on Web or H5 platforms.\n
|
|
3
|
-
|
|
4
|
-
[SCOPE]:\n
|
|
5
|
-
1. Builds a standalone component interface with functionality and UI similar to a WeChat or WeChat Work chat window.\n
|
|
6
|
-
2. Supports UI component libraries for both React and Vue mainstream frameworks.\n
|
|
7
|
-
3. The window entry can be set on a TabBar as needed.\n
|
|
8
|
-
|
|
9
|
-
[KEYWORDS]: 'Web', 'H5', 'Standalone Chat Window', 'TUIKit', 'React', 'Vue', 'Integration', 'TabBar'.\n
|
|
10
|
-
|
|
11
|
-
[MANDATORY CONSTRAINTS]:\n
|
|
12
|
-
1. Framework Selection Constraint: If the user has not explicitly specified the React or Vue framework in the prompt, the tool MUST prioritize calling 'present_framework_choice' to guide the user to make a selection.\n
|
|
13
|
-
2. Result Recording Constraint: After the TUIKit component integration is complete and the project successfully starts, the tool MUST call 'record_result' to log the integration outcome.\n
|
|
14
|
-
|
|
15
|
-
[NOTES]:\n
|
|
16
|
-
- When integrating the Vue version, please install @tencentcloud/chat-uikit-vue3.
|
|
17
|
-
`;
|
|
18
|
-
const PARAMETER_DESCRIPTIONS = {
|
|
19
|
-
framework: 'The Web Chat TUIKit framework type. Options: react, vue. Used to determine which framework\'s standalone chat window integration solution to provide.',
|
|
20
|
-
};
|
|
21
|
-
export const GET_WEB_CHAT_WINDOW_INTEGRATION_DEFINITION = {
|
|
22
|
-
name: 'get_web_chat_window_integration',
|
|
23
|
-
description: TOOL_DESCRIPTION,
|
|
24
|
-
parameter_descriptions: PARAMETER_DESCRIPTIONS,
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=get_web_chat_window_integration_def.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_web_chat_window_integration_def.js","sourceRoot":"","sources":["../../../src/tools/definitions/get_web_chat_window_integration_def.ts"],"names":[],"mappings":"AAAA,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;CAgBxB,CAAC;AAEF,MAAM,sBAAsB,GAAG;IAC7B,SAAS,EAAE,uJAAuJ;CACnK,CAAC;AAEF,MAAM,CAAC,MAAM,0CAA0C,GAAG;IACxD,IAAI,EAAE,iCAAiC;IACvC,WAAW,EAAE,gBAAgB;IAC7B,sBAAsB,EAAE,sBAAsB;CAC/C,CAAC"}
|