UChat Official

Introduction

In this detailed overview, we explore the process of creating and managing sources within your dashboard interface.

Sources are essential components that allow you to restrict user options, whether through static lists or dynamic API-driven data.

This guide covers the step-by-step procedures for setting up static and dynamic sources, how to configure them, and how they appear within your application's interface. Whether you're a beginner or looking to refine your setup, this summary provides clear instructions, rich formatting, and practical insights to optimize your workflow.

Step-by-Step Breakdown of Source Management

1. Accessing the Sources Section

  • Navigate to your dashboard.

  • Click on the Sources section.

  • You will see an interface similar to this:

*Note:*

2. Creating a New Source

  • Click on New Source.

  • Enter a unique name for your source, e.g., "Types".

  • You will be prompted to select the source type:

Type

Description

Static Source

Manually enter all options.

Dynamic Source

Fetch options via an API request.

3. Configuring a Static Source

  • Select Static Source.

  • Add options by clicking Add Item.

  • For each option, specify:

Field

Description

Label

How the option appears to users (e.g., "Type 1").

Value

The actual value stored or processed (e.g., "type1").

  • Example entries:

Label

Value

Type 1

type1

Type 2

type2

Type 3

type3

  • Click Save to finalize the static source.

4. Configuring a Dynamic Source

  • Select Dynamic Source.

  • Choose an existing API request (e.g., TXS).

  • Test the API request to verify data retrieval.

  • Identify the main key (path) where data is stored, e.g., data.

  • Copy this path and paste it into the source configuration.

  • Map the data fields:

Field

Description

Label

The display name (e.g., "name").

Value

The actual value (e.g., "name").

  • Example: If the API returns:

{
  "data": [
    {"name": "Option 1", "id": "opt1"},
    {"name": "Option 2", "id": "opt2"}
  ]
}
  • The path is data, and the label/value fields are name and id.

  • Click Save to complete the dynamic source setup.

How to Use Sources in Actions

1. Assigning Sources to Actions

  • Navigate to the Actions tab.

  • Select an existing action or create a new one.

  • For string or checkbox types, choose the appropriate input type.

  • Add your source(s):

Multiple Sources

Description

Add multiple sources

Allows combining static and dynamic options.

  • Click Save.

2. Visualizing Sources in the Interface

  • Access the Mini App interface.

  • Click on Added Action.

  • Observe the dropdown options:

Source Type

Appearance

Features

Static Source

Regular dropdown list

Fixed options, e.g., "Economic", "Business".

Dynamic Source

Dropdown with refresh icon

Fetches latest data from API when refreshed.

  • Refresh icon: Clicking it updates options dynamically from the API.

Additional Insights and Best Practices

Static vs. Dynamic Sources

Aspect

Static Source

Dynamic Source

Setup

Manual entry of options

API request configuration

Flexibility

Fixed options

Real-time data fetching

Maintenance

Easy for small, unchanging lists

Suitable for frequently updated data

Use Cases

Predefined categories, fixed choices

Live data, external databases

API Request Configuration Tips

  • Identify the main data path (e.g., data).

  • Map label and value fields accurately.

  • Test API responses thoroughly.

  • Use refresh icons to ensure data is current.

Best Practices

  • Unique Naming: Always assign unique names to sources for easy management.

  • Consistent Mapping: Ensure label and value fields are correctly mapped to prevent errors.

  • Regular Testing: Periodically test API requests to verify data integrity.

  • User Experience: Use refresh icons for dynamic sources to keep options updated without page reloads.

Final Thoughts and Summary

In conclusion, mastering sources in your dashboard enhances user interaction and data management. Whether opting for static sources for fixed options or dynamic sources for real-time data, the process involves straightforward steps:

  • Accessing the Sources section.

  • Creating new sources with unique identifiers.

  • Configuring static options manually.

  • Setting up dynamic options via API requests.

  • Assigning sources to actions and visualizing them in the interface.

By following these guidelines, you can efficiently restrict user choices, streamline data fetching, and improve overall application responsiveness. Remember to test your configurations regularly and update API paths as needed to maintain data accuracy.