Welcome to DOFBOT-Ultra repository
2. Configure API-KEY
AI Large Model - Dify
Please ensure that the web control program backend process is not running in the background. To close it, refer to the [Get Started Quickly - 2. Access the Terminal] section in [Disable the Auto-Start Web Control Backend Process]. After closing, please restart DofbotUltra!!!
Before starting this feature, you need to close the web control program backend process.
1. Introduction to Dify
Dify is an open-source LLM application development platform that integrates BaaS and LLMOps concepts. It supports low-code/no-code rapid construction of production-grade generative AI applications, is compatible with hundreds of models, and has built-in enterprise-grade RAG and visual workflow. It supports private deployment and full-stack LLMOps management and control.
Dify (Define + Modify) targets developers and enterprises, using an integrated "Backend as a Service + BaaS + LLMOps" solution to lower the barrier from prototype to production for generative AI applications while ensuring data security and compliance.
One of Dify's product forms, the "AI Application Factory", enables "low-code interface for quickly creating chatbots and content generators". We configure the decision layer and execution layer to plan task steps and select execution action functions, achieving dual-model inference. Additionally, for more complex functions, we add knowledge bases so that the decision layer can reference the knowledge base when planning actions, ensuring correct steps.
2. Entering the Robotic Arm Dify Configuration Interface
The Dify backend runs as a Docker service on the DofbotUltra motherboard's host system (not inside a docker container). It must be started before using the robotic arm.
2.1 Start the Dify Backend
Enter the following command directly in any directory on the host system to start Dify (no need to cd to any path, and no need to add sh):
bringup_difyPress Enter and wait for the containers to start. As shown in the figure below, when all services display green, Dify has started successfully.

2.2 Verify Dify Backend Accessibility
Before using the large model functionality, please ensure the Dify backend is accessible. You can confirm it using either of the following methods:
Browser method: On a computer in the same LAN as DofbotUltra, enter the DofbotUltra IP address in the browser address bar (e.g.,
http://192.168.x.x). If the Dify login page opens normally, the backend is ready.Command line method: On the host system of DofbotUltra (not inside a docker container), execute:
xxxxxxxxxxdocker psIn the output list, you should see several Dify-related containers such as
langgenius/dify-*in theUpstate. If not, Dify has not started or failed to start. Please re-executebringup_dify.
2.3 Log in to Dify
Enter the robotic arm's IP address in the browser to access the Dify configuration interface.
The first startup will be very slow. Please wait patiently for 5-10 minutes.

The first login requires an email and password.
Email: yahboom@163.com
Password: yahboom123
After clicking login, you can enter the configuration interface.

3. Studio
When using the chat assistant in the studio, let's take a look at the domestic decision layer - [decision_layer] as an example.

Item 1 contains the prompt. In the prompt, we give the large model an identity, tell it what it can do, output restrictions, basic requirements, special situations, etc.
Item 2 is the model we selected. Item 3 is the input box for sending chat content.
4. Configure Model Provider API Key
This section configures the model provider API Key in the Dify page
Settings -> Model Provider.This type of Key is generally provided by the model service provider, commonly in the format
sk-.... Its purpose is to allow the Dify platform to call Tongyi Qianwen, OpenRouter, and other model services internally.It is not the same as the
decision_AI_api_keyandexecution_AI_api_keyin thelarge_model_interface.yamlfile later. Do not mix them.
As shown in the figure below, click the Y in the upper right corner to enter account settings.

After entering, click [Model Provider].

Click [Configure] on the right. In the Dify we provided, only Tongyi Qianwen has been added. To add other model providers, refer to the later tutorial.

Click [Add API Key].

Then fill in the Tongyi Qianwen API-Key registered in the previous chapter. It is a key starting with sk-. For the [Use International Endpoint] option below, domestic users select No, and international users select Yes. After entering, click [Save].

5. Import Other Provider Models (Provided for Users Needing Other Large Models)
The advantage of the Dify platform is its ability to seamlessly integrate with most global AI models: through Dify's model provider plugins, you can quickly and seamlessly connect to hundreds of global AI models, eliminating the hassle of deployment and setup. Here we use OpenRouter as an example.
Find the OpenRouter model and click Install.

After installation is complete, refresh Dify, fill in the key, and save.

Switch the OpenRouter model in the decision layer/execution layer (if not recharged, check the free model usage in OpenRouter). Finally, publish it. The execution layer must use a visual model with the VL name.

6. International Users Configure Local Function Package
6.1 Check Dify Decision Layer/Execution Layer Application API Key
The decision_AI_api_key and execution_AI_api_key in large_model_interface.yaml are the API Keys used by the robotic arm program to access the Dify decision layer/execution layer applications, not IDs.
The current repository example enables the international version configuration by default. If you previously switched to the domestic version, you need to re-comment out the domestic version lines and enable the international version lines.
Raspberry Pi (inside Docker container) path: /home/yahboom/dofbot_ultra_ws/src/llm/largemodel/config
RDK (native environment) path: /home/sunrise/dofbot_ultra_ws/src/llm/largemodel/config
Open the file large_model_interface.yaml.
Switch decision_AI_api_key and execution_AI_api_key:
International users: Keep the international version lines enabled.
If you previously switched to the domestic version: Re-comment out the domestic version lines and enable the international version lines.

6.2 Voice Parameter Configuration
File path:
Raspberry Pi: /home/yahboom/dofbot_ultra/llm/largemodel/config
RDK: /home/sunrise/dofbot_ultra_ws/src/llm/largemodel/config
Open the file: yahboom.yaml
Change the parameters for whether to use online speech recognition and speech synthesis to false.
Comment out the domestic version parameter options, and uncomment the international version parameters.

6.3 Compile the Function Package
Raspberry Pi: Enter the following command to compile the function package to apply the changes.
xxxxxxxxxxcd /home/yahboom/dofbot_ultra_wscolcon build --packages-select largemodelsource install/setup.bash
RDK: Enter the following command to compile the function package to apply the changes.
xxxxxxxxxxcd /home/sunrise/dofbot_ultra_wscolcon build --packages-select largemodelsource install/setup.bash