Setting Properties of the AI Assistant Widget
This widget quickly generates an AI dialog box to help R&D personnel with coding, knowledge queries, job-related information, and document compilation.
This widget is built using the Vue3 architecture. To ensure proper functionality, make sure your application is using the Vue3 framework. For details, see Configuring Application Compatibility.

Data Binding
- Value binding: Value binding is similar to the v-model of the Vue. Bidirectional data binding is created on the widget. Value binding automatically selects the correct method to update the element based on the widget type. In addition, it checks events that cause binding data changes to update data.
- In the Data Binding area, click
in the value binding area. The Select Model dialog box is displayed.
- Click New.
- Set Model Name and Source, and click Next.
Figure 2 Defining a model
There are four types of models: Custom, Objects, Services, and Events. Each type of model contains parameter definitions and method definitions. Methods are APIs defined on models. In general, these APIs are called in event scripts (such as page loading events and mouse click events) associated with frontend widgets to implement certain logic.
Table 1 Model types Type
Model Description
Model Parameter Description
Model Method Description
API Calling Method
Custom
Models defined by developers.
Defined by developers. Subnodes can be added.
Developer-defined method.
$model.ref("modelName").actionName();
Objects
Object models are generated based on the mapping of the object table. For details about the object model, see Objects.
The system automatically obtains all fields of an object. Developers can select some fields as parameters.
The system automatically generates four methods: query, save, delete, and count.
- Query: $model.ref("modelName").query(param);
- Save: $model.ref("modelName").save();
- Delete: $model.ref("modelName").delete();
- Statistics: $model.ref("modelName").count();
Services
Service models are generated by mapping backend services. Currently, service models can only be mapped to flows or scripts. For details about the service model, see Flows and Scripts.
The parameters are mapped to the inputParam and outputParam sections based on the input and output parameters of backend services.
The run method is automatically generated to execute a flow or a script associated with the model.
$model.ref("modelName").run();
Events
For event models, data binding is created based on fields of a backend event. Model data can be updated based on the web socket.
Parameters are generated by mapping fields of backend events.
Directly use.
Directly use.
In addition to the methods defined in models, the platform provides the following standard APIs for all models:
- Obtaining model data: $model.ref("modelName").getData();
- Setting model data: $model.ref("modelName").setData();
- Setting model field values: $model.ref("modelName").setValue(key,value);
- On the Settings page of the new model, perform the following operations:
- If Source is set to Custom in the previous step, you need to add customized parameters and types of subnodes.
- If Source is set to Objects in the previous step, you need to configure the object and fields associated with the model.
- If Source is set to Services in the previous step, you need to configure the backend service associated with the model. The backend service can be a script, flow, or public API.
- If Source is set to Events in the previous step, you need to configure the event and event fields associated with the model.
- Click Next.
Generally, you do not need to add a method. If you need to add or modify a method, refer to the method generated by the object and service by default.
- Click OK.
- In the Data Binding area, click
- Property Binding: Binds a property of a container widget, such as hiding, style, and elastic layout, to a specific model field. Once bound, these properties automatically update in sync with the model field's value, functioning in a manner akin to Vue's v-bind directive.
- In the Data Binding area, click + next to Property Binding.
- Select a property of the container from the Properties drop-down list.
- Under Field, click
. The model selection page is displayed.
- Click New.
- Set Model Name and Source, and click Next.
There are four types of models: Custom, Objects, Services, and Events. Each type of model contains parameter definitions and method definitions. Methods are APIs defined on models. In general, these APIs are called in event scripts (such as page loading events and mouse click events) associated with frontend widgets to implement certain logic. For details, see Table 1.Figure 3 Defining a model
- On the Settings page of the new model, perform the following operations:
- If Source is set to Custom in the previous step, you need to add customized parameters and types of subnodes.
- If Source is set to Objects in the previous step, you need to configure the object and fields associated with the model.
- If Source is set to Services in the previous step, you need to configure the backend service associated with the model. The backend service can be a script, flow, or public API.
- If Source is set to Events in the previous step, you need to configure the event and event fields associated with the model.
- Click Next.
Generally, you do not need to add a method. If you need to add or modify a method, refer to the method generated by the object and service by default.
- Click OK.
Basic Properties
After basic properties are bound through data, the values of the bound data are used during running.
- Name: Set the name of the AI assistant. Default value: AI Assistant.
- Logo: Set the logo for the AI assistant. Recommended formats: JPG, JPEG, PNG, GIF. Maximum image size: 50 MB.
- Content Area Background: Set the content area background image for the AI assistant. Recommended formats: JPG, JPEG, PNG, GIF. Maximum image size: 50 MB.
Figure 4 Content area
- Placeholder: Set the placeholder of the input card for the AI assistant.
Figure 5 Placeholders
- Welcome Message: Set the greeting of the AI assistant widget.
Figure 6 Greetings
- Show Shortcuts: Whether to display shortcuts. It is enabled by default. After this function is enabled, you need to set the shortcut.
- Shortcuts: Set shortcuts to improve efficiency and simplify operations. When Show Shortcuts is enabled, this parameter must be set to a JSON string.
Figure 7 Shortcuts
[ { "key": "text abstract", "label": "Text Abstract", "desc": "What are the advantages of low-code" }, { "key": "keyword extraction", "label": "Keyword Extraction", "desc": "Extract keywords from the document for me" }, { "key": "text translation", "label": "Text Translation", "desc": "Translate a sentence for me" } ]
- Show Suggested Questions: Specifies whether to display Suggested Questions on the AI assistant UI. This function is enabled by default. After this function is enabled, you need to set the questions.
- Suggested Questions: Set questions users might ask to help them quickly find relevant content. When Show Suggested Questions is enabled, this parameter must be set to a JSON string.
Figure 8 Suggested questions
[ { "label": "Typical Usage Scenarios of Low-Code", "value": "Lightweight app building, no-code app building, and industry app building" }, { "label": "What Are the Advantages of Low-Code" "value": "Lower the application building threshold, accelerate agile service innovation, and support large-scale enterprise application building." } ]
- Description: Set the AI assistant's description in JSON format.
Figure 9 Description
[ "AI assistant's description", "Develops code, searches for knowledge and task info, and creates documentation." ]
- Show Likes: Show likes in the answer area. By default, this function is disabled.
- Show Dislikes: Show dislikes in the answer area. By default, this function is disabled.
- Show Chat History: Show older dialogs. By default, this function is enabled. After enabling this function, developers can view common user questions.
Figure 10 Chat history
- Chats: Shows the historical dialog list, which must be in JSON format.
Figure 11 Historical dialog list
[ { "id": 15453742, "sessionId": "c19809****202a4dab1", "title": "title", "createTime": "2025-03-31 17:37:46", "updateTime": "2025-04-01 19:47:14", "messages": [] } ]
- Terms of Use Link: Add link if you want to display your terms of use.
Figure 12 Effect after setting the terms of use link
- Privacy Statement Link: Add link if you want to display your privacy statement.
Figure 13 Effect after setting the privacy statement link
Advanced Properties
- Knowledge: Whether to use the knowledge base. By default, this function is disabled. If you have a large number of documents that are hard to use and query efficiency is low, the AI assistant can call the foundation model API to get answers. Additionally, RAG technology works with the knowledge base to provide a more intelligent and natural dialog experience, improving the accuracy and relevance of information retrieval.
To enable the function of building a knowledge base, submit a service ticket.Figure 14 Enabling the knowledge base
- Show Model: Whether to enable connection to the foundation model connector. This function is disabled by default. To enable it, you need to first configure the foundation model connection details in the connector and select the corresponding connector in the AI assistant widget. For details about how to create a foundation model connector, see Using a Connector to Call a Foundation Model.
Figure 15 Enabling the Show Model function
- Default Model: Click Set Default Model and add the created foundation model connector.
- Temperature: Controls how random the output is. The higher this setting, the more random the results.
- Diversity: Returns content whose probability sum is greater than or equal to top_p and controls how diversified the output is. The higher this setting, the more diverse the results. top_p is the name of the foundation model core sampling parameter.
- Repetition Penalty: 0 indicates no penalty. Positive: discourages repetition. Negative: encourages repetition
Common
- Name: Name of the current widget.
- Hid: Whether to hide the widget. In this mode, the widget is statically hidden. You can set this property to a Boolean model field. By controlling the value of this field in custom JavaScript code, you can dynamically determine whether to hide the widget. This dynamic setting has the highest priority.
Style
- Layout: Set the width and height of the widget.
- Font: Set the font size, style, and color.
- Background: Set the background color and transparency.
- Border: Set the border color and width. The unit can be px, em, or %.
- Shadow: Set the shadow color and style. The units px, em, and % are supported.
- Advance
- Style Code: Style code of the widget. After the widget style is set, the style code is automatically displayed in this area. You can also customize the style code to configure the widget in detail. The customized code can be entered in multiple lines and the style parameters are highlighted.
- Style Class: Name of the CSS style class of the widget, which can be referenced in the CSS code.
Event
Click the AI assistant widget and add events for the widget on the Events tab page.

Event |
Description |
---|---|
on-message |
When a user clicks the send button, this event is triggered. You can obtain the current conversation content using the following script: // Current widget const _component = context.$component.current; // Obtain the current conversation data. const messages = _component.getMessages() console.log(messages ); |
on-stop |
Click the stop button to end the conversation and terminate the connection with a foundation model. // Current widget const _component = context.$component.current; // Obtain the data of the current operation column. const currentRecord = _component.getCurrentRecord(); console.log(currentRecord); |
on-click-history |
This event is triggered when an item in the chat list is clicked. You can obtain the data of the clicked item using the following script: // Current widget const _component = context.$component.current; // Obtain the content of the clicked item. var currentChat = _component.getCurrentHistoryData(); console.log(currentChat ); |
on-change-history |
This event is triggered when the name in the chat list is changed. You can obtain the modified data using the following script: // Current widget const _component = context.$component.current; // Obtain the content of the clicked item. var currentChat = _component.getCurrentHistoryData(); console.log(currentChat ); |
on-delete-history |
This event is triggered when data in the chat list is deleted. You can obtain the chat content to be deleted using the following script: // Obtain the data to be deleted based on the current widget. const _component = context.$component.current; const currentData = _component.getCurrentHistoryData(); |
on-new-chat |
This event is triggered when a new chat is created. After this event is triggered, the current chat list is cleared and a new chat starts. |
on-refresh |
This event is triggered when Suggested Questions is clicked. The configuration takes effect only when the Show Suggested Questions function is enabled. |
on-like |
This event is triggered when the like button is clicked. You can obtain the content in the like area using the following script: // Current widget const _component = context.$component.current; // Obtain the data of the current operation column. const currentRecord = _component.getCurrentRecord(); console.log(currentRecord); |
on-dislike |
This event is triggered when you click the dislike button. You can obtain the content in the dislike area using the following script: // Current widget const _component = context.$component.current; // Obtain the modified data. const currentRecord = _component.getCurrentRecord(); console.log(currentRecord); |
on-finish |
This event is triggered when the current dialog is answered or you click the stop button. You can obtain the content of the current dialog using the following script: // Current widget const _component = context.$component.current; // Obtain the current conversation data. const messages = _component.getMessages() console.log(messages ); |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot