tencent cloud

Dialog API Documentation (WebSocket)
Last updated:2026-02-12 12:14:59
Dialog API Documentation (WebSocket)
Last updated: 2026-02-12 12:14:59
WebSocket is a connection-oriented, full-duplex channel. Before establishing connection, you must get Token from the server. This token is required to create a WebSocket connection with the server. The token is valid only at that time when establishing connection and will be discarded upon success of link establishment.
Access Process Diagram:




1. Retrieve the Token for Establishing a Websocket Connection

1.1 Calling Method

Call the GetWsToken API through the Tencent Cloud SDK to get Token. See the GetWsToken document.
Note:
The obtained Token can be used for only once session connection and will expire. Please establish a persistent connection promptly after obtaining the Token. If other connections need to be established, you must reobtain the Token.
Tag-related values no longer use this API for transmission. Refer to the Data structure in custom_variables to import parameters related to the search in the knowledge library.

1.2 How to Obtain AppKey

In the Application Management interface, find your running application (it must be published first), click Call, and a "Call Information" window will pop up.



In the Call Information window, you can see the AppKey. Click Copy just.




2. Using Token to Create a Websocket Connection

Request Address: wss://wss.lke.tencentcloud.com/v1/qbot/chat/conn/?EIO=4&transport=websocket.
Request protocol: Socket.IO v4 (Reference Documentation)

2.1 Establish a Connection

After the Websocket connection is established successfully, the server response is as follows:
0{"sid":"xxx","upgrades":[],"pingInterval":25000,"pingTimeout":5000}

2.2 Transmit Token for Authentication

Socket.IO auth messaging.
After establishing a connection and receiving the server response, send the Token for authentication. The Token format is as follows:
40{"token":"xx-xx-xx-xx-xx"}

2.3 Heartbeat Processing

The heartbeat packet sent by the server is as follows ("2" is the content of the heartbeat packet):
2
At this point, the client must respond ("3" is the content of the response):
3
Note:
Socket IO V4 has a heartbeat packet, which must be processed, otherwise the connection will be disconnected by the server.
If you implement the Client yourself, pay attention to heartbeat packet processing. This document provides a Demo that has already handled heartbeat packets automatically.


3. WebSocket Support Event

The Socket.IO event format is as follows. Pay attention to its structure when implementing. It is recommended to use the standard Client provided by Socket.IO or refer to the frontend and backend Demo as specified in this document.
42["Type",{"payload":{event body}}]

Example:
42["send",{"payload":{see the data structure for each following event}}]

3.1 Send Event

Event Name: send
Event Direction: Frontend > Backend
Note:
Publish application before sending send event.
When a user sends a message (send event), the server will return the message without modification (reply event, where is_from_self = true) so that the message is acknowledged by the server and the message ID and timestamp are updated.
If you need to carry knowledge tag information, include it when obtaining the token.
Data structure
Name
Type
Required
Description
request_id
string(255)
No
Request ID, used to identify a request (connect messages, recommend using a different request_id per request).
For easy troubleshooting, it is required.
session_id
string(64)
Yes
Conversation ID, used to identify a session (provided by an external system, it is advisable for different client sessions to import different session_id, otherwise messages from different users within the same application may get mixed up).
Parameter Length: 2 to 64 characters
Verification rule: ^[a-zA-Z0-9_-]{2,64}$. Normally, uuid can be used to generate this value.
uuid example: 1b9c0b03-dc83-47ac-8394-b366e3ea67ef
content
string
Yes
Message content. If sending picture, transmit Markdown format image link herein, such as ![](image link). Among them, image link needs to be public read [image ingestion into tcadp cos is required].
Maximum value limit: Different models have differences in maximum value. Refer to the InputLenLimit of the ListModel API.
file_infos
Object array
No
File information. If you fill this field, the content field can be empty. For data structure, refer to file_infos, dependent on real-time document parsing.
Note:
If there is no file information, this field can be left blank or set to an empty array.
custom_variables
map[string]string
No
Workflow scenario:
Custom parameters can be used to pass parameters to the API parameter field of the workflow start node. The workflow can identify and use the parameters through this API parameter field. For details, refer to the start node operation instructions.

Customize the value of API parameter. Multiple key:value pairs can be configured, where key is the name of the custom parameter and value is the runtime value of the corresponding user-defined parameter.
Note:
Both the key and value in the map are of string type, for example {"UserID":"10220022"}. Invalid parameters include: {"UserID": 10220022}. The value can also be a json string, such as {"Data": "{\\"UserID\\":\\"10220022\\",\\"Score\\":{\\"Chinese\\":89,\\"Math\\":98}}"}

Knowledge Base Retrieval Scope Settings Scenario:
Custom parameters are used to set the search scope in the knowledge library. If needed, input multiple parameter values separated by English vertical bars (|), for example: "user1|user2".
Note:
If you need to specify a knowledge base for retrieval in a question, you can input relevant tag values through this field. For details, refer to Set Knowledge Base Search Scope.
system_role
string
No
Role directive (Note prompt content) uses the default setting of the application configuration when empty, and takes the current value when filled.
Maximum value limit: Different models have differences in maximum value. Refer to the RoleLenLimit of the ListModel API.
incremental
bool
No
Control whether the content in reply event and thinking event is incrementally output, false by default.
Note:
This field set to true only takes effect for reply and thinking events.
Effect of reply event:

Effect of thinking event:

model_name
string
No
Support importing a specified model during the dialogue process. Using different model names under the same session_id maintains context correlation with each other.
The following custom models are currently supported:
Deepseek/deepseek-v3.1-terminus: DeepSeek-V3.1-Terminus
Deepseek/deepseek-v3-250324: DeepSeek-V3-0324
Deepseek/deepseek-r1-0528: DeepSeek-R1-0528
Note:
Ensure the selected model has sufficient tokens or postpaid mode is enabled to avoid errors during the process.
stream
string
No
Whether streaming is enabled. Value ranges from...to...
Empty string: follow application configuration
enable: streaming
disable: Non-streaming transmission
workflow_status
string
No
Whether workflow is enabled. Value ranges from...to...
Empty string: follow application configuration (the page has no portal to configure workflow, which is enabled by default)
enable: Enable workflow
disable: Disable workflow
file_infos
Data structure of file information:
Name
Type
Required
Description
file_name
string
Yes
Document name.
file_size
string
Yes
Real-time document parsing API response file size.
file_url
string
Yes
Real-time document parsing API response file URL.
file_type
string
Yes
File type.
doc_id
string
Yes
Real-time document parsing API response doc_id.

3.2 Reply Event

Event Name: reply
Event Direction: Backend > Frontend
Note:
If the received message has is_evil == true, it means the message hit sensitive content and failed to send.
Due to concurrency overrun causing queue timeout, the "concurrency limit exceeded" error will be triggered.
Data Structure:
Name
Type
Description
request_id
string(255)
Request ID, used to identify a request (connect messages, recommend using a different request_id per request).
content
string
Reply message content
file_infos
Object array
File Information
record_id
string(64)
Unique message ID
related_record_id
string(64)
Associated Unique Message ID
session_id
string(64)
Conversation ID, used to identify a session (provided by an external system, it is advisable for different client sessions to import different session_id, otherwise messages from different users within the same application may get mixed up).
is_from_self
bool
Whether the message is sent by the client
can_rating
bool
Whether the message record can be evaluated
timestamp
int64
message timestamp (in seconds)
is_final
bool
Whether the reply event message output is completed
In streaming mode, messages are returned multiple times, each time overwriting the previous answer.
When is_final == true, the stop generation button is hidden and the like and dislike buttons are displayed.
reference and reply events have no fixed sequential relationship. It is not recommended to use this field as the identification of message completion.
is_evil
bool
whether it hits sensitive content
Note: After message uplink, sensitive content detection is first performed, and a [reply] event is returned to inform the sensitive content detection result. Normal business logic processing starts only after sensitive content detection is passed.

is_llm_generated
bool
whether the content is generated by the model
reply_method
uint8
Response method as follows:
1: large model reply
2: unknown question reply
3: refused question reply
4: sensitive reply
5: accepted Q&A pair reply with precedence
6: welcome message reply
7: number of concurrencies exceeded reply
8: global intervention knowledge
9: task flow reply
10: task flow answer
11: search engine reply
12: polished knowledge reply
13: image understanding reply
14: real-time document reply
15: clarification confirmation reply
16: workflow reply
17: workflow operation completed
18: Intelligent Agent reply
19: multi-intent reply
knowledge
Object array
Hit knowledge
option_cards
string array
Tab, proprietary task flow
Description: This field may be empty. If empty, the field will not be returned.
custom_params
string array
Custom business parameter for transparently transmitting business parameters in QA
Description: This field may be empty. If empty, the field will not be returned.
task_flow
Object
Task flow debug information
Description: This field may be empty. If empty, the field will not be returned.
work_flow
Object
Workflow debug information
Description: This field may be empty. If empty, the field will not be returned.
quote_infos
Object array
Quoted information.
Data structure of knowledge hit
Name
Type
Description
id
string
Hit knowledge ID
type
uint32
Hit knowledge Type:
1: Q&A
2: Document fragment
seg_id
string
Segment ID. You can view the segment details via the DescribeSegments API.

Data structure of workflow debugging information.
Name
Type
Description
workflow_name
string
Workflow name
workflow_id
string
Workflow ID.
qworkflow_run_id
string
Workflow run ID
option_cards
string array
Tab
current_node
Object
Current Node Info
outputs
string array
Output Result
current_node Current workflow node info:
Name
Type
Description
NodeID
string
Node ID
NodeType
int32
Node type:
0: not specified.
1: Start Node
2: Parameter Extractor Node
3: LLM Node
4: Knowledge Q&A Node
5: Knowledge Retrieve Node
6: Tag Extractor Node
7: code execution node.
8: Tool Node
9: Logical Judgment Node
10: Reply Node → Message Node
11: Tab Node
12: Loop Node
13: Intent Recognizer Node
14: Workflow Node
15: Plugin Node
16: End Node
NodeName
string
Node name.
Status
int32
Status:
0: Initial status
1: running
2: operation successful
3: execution failed
Input
string
Input of the node. json string (including ordinary string).
Output
string
Final output of the node. json string (including ordinary string).
TaskOutput
string
Task output. (Original output)
FailMessage
string
exception message
CostMilliSeconds
string
Total time consumed by the node. If the node is called multiple times, the duration is the sum of all calls.
Reply
string
Reply content of the current node. Current parameter extraction, message node, and end reply node may not be empty.
BelongNodeID
string
ID of the referenced node when the associated workflow is referenced. The workflow to which the task belongs is not empty when referenced.
StatisticInfo
Object
LLM statistical information
StatisticInfo LLM statistical information:
Name
Type
Description
ModelName
string
Model Name
FirstTokenCost
uint32
First token duration
TotalCost
uint32
reasoning total time
InputTokens
uint32
Input token count
OutputTokens
uint32
Output token count
TotalTokens
uint32
Input + output total token
quote_infos refers to the information data structure:
Name
Type
Description
index
int
The index of the reference, the icon should be designed and implemented by the connecting party
position
int
position in the reply content (Chinese character, English character, or symbol counts as one character)
The following figure shows the effect.



quote_infos example (here only shows partial structure, omitted):
[
"reply",
{
"type": "reply",
"payload": {
"can_feedback": true,
"can_rating": false,
"content": "Tencent stock performance on February 13, 2025:\\n\\n### Tencent Holdings (00700.HK) Hong Kong Stock Market Performance\\n\\n- **Stock Fluctuation**: Tencent Holdings stock experienced distinct fluctuations on February 13, 2025, with an intraday amplitude of 4.35%. This reflects both the short-term impact of market emotion and capital competition, as well as the long-term logic of the sector environment and company fundamentals.\\n- **Price Range**: The stock reached a high of HKD 464.6 and a low of HKD 437 on the day.\\n\\n### Tencent Holdings (TCTZF.us) US Stock Market Performance\\n\\n- **Stock Increase**: In the US market, Tencent Holdings (TCTZF.us) stock rose by 5.05% intraday on February 13, 2025, with the latest price at USD 58.10 per share.\\n- **Market Feedback**: This unusual change drew extensive market attention, with investors starting to mine the causes and impact behind it.\\n\\nPlease note, the above information is for reference only. Investment is at risk, please be cautious."
"quote_infos": [
{
"index": 1,
"position": 323
}
],
},
"message_id": "xxxxxxxxxxxxxxxxxxxxxxx"
}
]

3.3 Token Statistics Event

Event Name: token_stat
Event Direction: Backend > Frontend
Data Structure:
Name
Type
Description
session_id
string(64)
Session id
request_id
string(255)
Request id for sending corresponding event
record_id
string(64)
Message record id for sending corresponding event
status_summary
string
Conversation status. This round: processing. Successful: success. Failed: failed.
status_summary_title
string
Conversation status description. This round
elapsed
int
Call duration. This round: ms
token_count
int
token consumption of this round request (when containing multiple processes, the count will be aggregated).
procedures
Object array
Invocation process list
Data structure of the procedures invocation process list
Name
Type
Description
name
string
English name, one-to-one correspondence with the title field below
knowledge, task_flow, search_engine, image, large_language_model, pot_math, file
title
string
Invocation process description, corresponding to the name field. The Chinese meanings are as follows:
Call knowledge base, call task flow, call search engine, call image understanding, large model reply, call calculator, read file
status
string
Invocation process status. In processing: processing. Successful: success. Failed: failed.
input_count
int
Token consumption of this process input
output_count
int
Token consumption of this process output
count
int
Token consumption of this process: input + output
Example:
[
"token_stat",
{
"type": "token_stat",
"payload": {
"elapsed": 1616,
"order_count": 50000000,
"procedures": [
{
"count": 323,
"input_count": 308,
"name": "knowledge",
"output_count": 15,
"status": "success",
"title": "Call the knowledge base"
}
],
"record_id": "Hpe_20240625_185659_215_EsH2uf8L",
"request_id": "8PUcDU6xyQ-301747294000",
"session_id": "2d071ef7-ef76-44df-84a4-9210672ed700c8",
"status_summary": "success",
"status_summary_title": "Call knowledge base"
"token_count": 323,
"used_count": 553
},
"message_id": "89d91395-06bc-4f2e-b240-06f7b4498b0c6e"
}
]

3.4 Rate Event

Event Name: rating
Event Direction: Bidirectional
Note:
When the client sends a rating event, the client will also receive this event so that the client can confirm the message was sent successfully.
Data Structure:
Name
Type
Required
Description
record_id
string(64)
Yes
Message ID (message ID of the rated reply event)
score
uint8
Yes
Score:
1: Like
2: Dislike
reasons
string array
No
Selected reasons (user feedback, can have multiple)
feedback_content
string
No
feedback content

3.5 Disable Build Event

Event name: stop_generation
Event Direction: Frontend > Backend
Data Structure:
Name
Type
Required
Description
record_id
string(64)
Yes
Message ID (message ID of the reply event that needs to be stopped)

3.6 Reference Source Event

Event Name: reference
Event Direction: Backend > Frontend
Data Structure:
Name
Type
Description
record_id
string(64)
Unique message ID
references
Object array
Reference
Data structure of references
Name
Type
Description
id
string
The id method of use is divided into two parts. See the following two examples:
1. When the reference source Type is 1, 2, or 3, you can call the detail list acquisition source API to view the reference source details. If needed, you can obtain the corresponding parameter through the above API and navigate to: https://lke.cloud.tencent.com/preview?id=${docid}&botBizId=${appid}&page=${page number of the redirected doc document}&name=${name of the redirected sheet}&test=1
Note:
The id field corresponds to the ReferBizIds field in DescribeRefer
2. When the reference source type is 4, the id represents the serial numbers of multiple reference sources.
type
uint32
Reference source type
1: Q&A
2: Document fragment
4: Content retrieved online
Note:
When type = 2, the granularity of the reference return is document slice dimensional data, which needs to be used with the id field. A document [doc_id] may contain multiple slices. Determine whether to show duplicates.
url
string
When type = 2, this url is the custom redirect link set for opening the external reference link of the document.
When type = 4, this url is the source address found in the online search.
name
string
Reference source name
doc_id
uint64
Reference document ID
doc_biz_id
uint64
Reference document business ID. You can call the Document Detail API to check the basic information of the corresponding document.
doc_name
string
Reference document name
qa_biz_id
string
Reference QA business ID
Example 1:
Reference source type:
1: Q&A
2: Document fragment
Call the detail list of acquisition source API to view reference details. At this point, the id field corresponds to the ReferBizIds field in DescribeRefer.
reference event:
[
"reference",
{
"type": "reference",
"payload": {
"record_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"references": [
{
"doc_biz_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"doc_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"doc_name": "100 Idioms and Their Historical Figures' Stories (1).docx"
"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"name": "100 Idioms and Its Historical Figures Stories+ (1)"
"qa_biz_id": "0",
"type": 2,
"url": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
],
"trace_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
"message_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
]
Example 2:
Reference source type:
4: Content retrieved online
At this point, in the received thought event or reply event, the [3] [4] in the content field represent the index of the source retrieved online in references.
reply event (here only show, partial structure omitted):
[
"reply",
{
"type": "reply",
"payload": {
"can_feedback": true,
"can_rating": false,
"content": "\\n\\nAs of 14:59 on February 13, 2025, the total box office of "Nezha 2" ("Nezha: The Devil's Birth") (including pre-sale)
The revenue has exceeded **980 million CNY**, just one step away from the 1 billion milestone[3][4][7][8]. This box office result has surpassed "Black Panther".
Became the only non-Hollywood film in the top 18 of the global box office chart. According to Beacon Professional Edition's prediction, "Ne Zha 2" may finally reach **15.338 billion yuan**, while Maoyan predicts a higher **16.032 billion yuan**.
In addition, the overseas box office of the video has exceeded 6.27 million RMB.
},
"message_id": "**************************"
}
]
reference event:
[
"reference",
{
"type": "reference",
"payload": {
"record_id": "**************************",
"references": [
{
"doc_biz_id": "0",
"doc_id": "0",
"doc_name": "",
"id": "1",
"name": "Grossing over 8.2 billion, it entered the top 31 global box office charts! Nezha 2's overseas premiere moved audiences to tears, with merchandise selling out within 3 days."
"qa_biz_id": "0",
"type": 4,
"url": "https://new.qq.com/rain/a/20250210A04P8O00"
},
{
"doc_biz_id": "0",
"doc_id": "0",
"doc_name": "",
"id": "2",
"name": "Just now! Nezha 2 box office exceeds 9 billion."
"qa_biz_id": "0",
"type": 4,
"url": "https://new.qq.com/rain/a/20250211A07V6J00"
},
{
"doc_biz_id": "0",
"doc_id": "0",
"doc_name": "",
"id": "3",
"name": "Sprint to billions of box office. "Nezha 2" grosses 9.8 billion."
"qa_biz_id": "0",
"type": 4,
"url": "https://view.inews.qq.com/a/20250213A04F7F00?scene=qqsearch"
},
{
"doc_biz_id": "0",
"doc_id": "0",
"doc_name": "",
"id": "4",
"name": "Box office of 'Nezha 2' hits 9.8 billion CNY, film and television stocks surge"
"qa_biz_id": "0",
"type": 4,
"url": "https://view.inews.qq.com/a/20250213A04L4M00?scene=qqsearch"
},
{
"doc_biz_id": "0",
"doc_id": "0",
"doc_name": "",
"id": "5",
"name": "Ne Zha 2 box office exceeds 3 billion"
"qa_biz_id": "0",
"type": 4,
"url": "https://new.qq.com/rain/a/20250202A03TL500"
},
{
"doc_biz_id": "0",
"doc_id": "0",
"doc_name": "",
"id": "6",
"name": "Ne Zha 2 box office surpasses last year's champion"
"qa_biz_id": "0",
"type": 4,
"url": "https://new.qq.com/rain/a/20250203A02PAT00"
},
{
"doc_biz_id": "0",
"doc_id": "0",
"doc_name": "",
"id": "7",
"name": "Box office of 'Nezha 2' hits 9.8 billion CNY",
"qa_biz_id": "0",
"type": 4,
"url": "https://view.inews.qq.com/a/20250213A04DPH00?scene=qqsearch"
}
],
"trace_id": "**************************"
},
"message_id": "**************************"
}
]

3.7 Error Event

Event Name: error
Event Direction: Backend > Frontend
Data Structure:
Name
Type
Description
request_id
string(255)
Request ID, used to identify a request (connect messages, recommend using a different request_id per request).
error
Object
Error
error: erroneous data structure
Name
Type
Description
code
uint32
Error code
message
string
Error Message

3.8 Think Event

Event Name: thought
Event Direction: Backend > Frontend
Note:
This event currently only returns when using the DeepSeek-R1 model.
Data Structure:
Name
Type
Description
elapsed
int
Call duration. This round: ms
is_workflow
bool
Whether workflow
procedures
Object array
Invocation process list
record_id
string(64)
Message record id for sending corresponding event
request_id
string(255)
Request id for sending corresponding event
session_id
string(64)
Session id
trace_id
string
Link id
workflow_name
string
Workflow name
Data structure of the procedures
Name
Type
Description
debugging
Object
debugging information
index
uint32
Process Index
name
string
English name, one-to-one correspondence with the title field below. knowledge, task_flow, search_engine, image, large_language_model, pot_math, file, thought
title
string
Invocation process description, corresponding to the name field. The Chinese meanings are as follows:
Call knowledge base, call task flow, call search engine, call image understanding, large model reply, call calculator, read file, think
status
string
Status:
processing - active; success - success; failed - failed
icon
string
icon for show
switch
string
whether to switch over the Agent
workflow_name
string
Workflow name
plugin_type
int32
Plugin type.
0: Custom plugin; 1: Official plugin; 2: Workflow
elapsed
uint32
Request execution time, ms
Data structure for debugging:
Name
Type
Description
content
string
content output during debugging
Effect:



Example:
[
"thought",
{
"type": "thought",
"payload": {
"elapsed": 0,
"is_workflow": false,
"procedures": [
{
"debugging": {
"content": "\\nOK, the user is asking about the features of DeepSeek-R1, and this is already the third time. The previous two times, I have already listed its high efficiency, long-context processing, versatility across multiple fields, security compliance, multilingual support, flexible deployment, and cost-effectiveness in detail. The user might be confirming the information or hoping for a more concise or different perspective in the response.\\n\\nI need to consider why the user is repeating the question. Possible situations include: the user did not fully understand the previous answer and needs a simpler summary; or they want to confirm the accuracy of the information; or they want to know if there are any new updates. In addition, the user might be testing the consistency of the responses, or they need the information for specific scenarios, such as reports or comparing different models.\\n\\nNext, I should check if the previous answers were comprehensive and if any important features were missed. For example, whether the training data, supported frameworks, or specific performance metrics were mentioned. Additionally, the user might be interested in technical details, such as the model structure, training methods, or practical applications."
},
"elapsed": 9954,
"icon": "https://lke-realtime-1251316161.cos.ap-guangzhou.myqcloud.com/icon/thinking.png",
"index": 0,
"name": "thought",
"plugin_type": 0,
"status": "processing",
"switch": "",
"title": "Think"
"workflow_name": ""
}
],
"record_id": "piQ_20250208_140511_254_45ja7HPq",
"request_id": "rjbuFuYeDB-8487350785",
"session_id": "dfd04cd0-ef69-4fb6-a447-a0b44018a93f",
"trace_id": "9a9613dbaa9edd27958bd1180c524295 / piQ_20250208_140511_254_45ja7HPq",
"workflow_name": ""
},
"message_id": "7070ef0d-4c28-4d5a-abc8-2ea2e7fa027d"
}
]

4. Error Code

Error Code
Error Message
400
Request parameter error, please refer to the access documentation
460001
Token verification failed
460002
Event handler not found
460004
Application does not exist
460006
Message does not exist or insufficient permissions
460007
Session creation failed
460008
Failed to render Prompt
460009
Visitor does not exist
460010
The session does not exist or insufficient permissions
460011
Exceeding the concurrency limit
460020
Model request timeout
460021
Knowledge base not released
460022
Failed to create visitor.
460023
Failed to like or dislike the message
460024
Invalid tag
460025
Image analysis failed.
460031
The number of connections for this application has exceeded the request limit. Try again later.
460032
Current application model insufficient balance
460033
Application does not exist or insufficient permissions
460034
Content too long
460035
Content too long, computation has been stopped
460036
Process node preview parameter error
460037
Search for resource exhausted, call failed
460038
The AppID request has abnormal behavior, call failed

5. Quick Deployment

The adp-chat-client code includes a complete process of connection establishment and message sending and receiving. Refer to integration solution based on the official open-source project ADP-chat-client for details to proceed with rapid client deployment and seamless integration of your Intelligent Agent application, embedding the dialogue feature of your Intelligent Agent application into your business system.

6. Front-End Rendering Component

If you do not need the complete client and only require a front-end component to render large model reply messages, you can install it directly through npm:
Message Rendering Component (Vue 2 or React): lke-component - npm
Message Rendering Component (Vue 3): lke-component-vue3 - npm
Installation Command:
Framework
Package name
Installation
Vue2
lke-component
npm i lke-component
Vue3
lke-component-vue3
npm i lke-component-vue3
React
lke-component
npm i lke-component

Vue2 Example Code

Registration Service

// main.js
import Vue from 'vue'
import lkeComponent from 'lke-component'

Vue.use(lkeComponent)

Use Case

<template>
<div>
<!-- thinking process -->
<MsgThought
v-if="thought.content"
:content="thought.content"
:title="thought.title"
:status="thought.status"
:elapsed="thought.elapsed"
/>

<!-- message content -->
<MsgContent
:content="message.content"
:isFinal="message.isFinal"
:isReplaceLinks="true"
clazzMd="answer-md"
/>

<!-- loading... -->
<MsgLoading
v-if="loading"
:loadingMessage="true"
loadingText="Thinking..."
/>
</div>
</template>

<script>
export default {
data() {
return {
loading: false,
message: {
content: '',
isFinal: true
},
thought: {
content: '',
title: 'Think Done'
status: 'success',
elapsed: 0
}
}
}
}
</script>

On-Demand Import

<script>
import { MsgContent, MsgLoading, MsgThought } from 'lke-component'

export default {
components: { MsgContent, MsgLoading, MsgThought }
}
</script>

Vue3 Example Code

Global Registration

// main.js
import { createApp } from 'vue'
import App from './App.vue'
import lkeComponent from 'lke-component-vue3'
import 'lke-component-vue3/style.css'

createApp(App).use(lkeComponent).mount('#app')

Example Code

<template>
<div>
<MsgThought
v-for="(thought, i) in thoughts"
:key="i"
:content="thought.content"
:title="thought.title"
:titleIcon="thought.titleIcon"
:nodeName="thought.nodeName"
:status="thought.status"
:elapsed="thought.elapsed"
/>

<MsgContent
:content="message.content"
:isFinal="message.isFinal"
:isPrintAnimate="!message.isFinal"
/>
</div>
</template>

<script setup>
import { ref } from 'vue'

const message = ref({
content: '',
isFinal: true
})

const thoughts = ref([])
</script>

On-Demand Import Component

<script setup>
import { MsgContent, MsgThought } from 'lke-component-vue3'
import 'lke-component-vue3/style.css'
</script>

React Example Code

Use Case

import { useState } from 'react'
import { MsgContent, MsgThought } from 'lke-component/react'
import 'lke-component/css' // must import style

export default function Chat() {
const [message, setMessage] = useState({
content: '',
isFinal: true
})

const [thoughts, setThoughts] = useState([])

return (
<div>
{thoughts.map((thought, i) => (
<MsgThought
key={i}
content={thought.content}
title={thought.title}
titleIcon={thought.titleIcon}
nodeName={thought.nodeName}
status={thought.status}
elapsed={thought.elapsed}
detailVisible={thought.detailVisible}
onTitleClick={() => {
// Toggle unfold/collapse
const next = [...thoughts]
next[i].detailVisible = !next[i].detailVisible
setThoughts(next)
}}
/>
))}

<MsgContent
content={message.content}
isFinal={message.isFinal}
isReplaceLinks={true}
clazzMd="answer-md"
/>
</div>
)
}

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback