Getting-started
Let's go through a simple demo to introduce how to use dify-spring-boot-starter features.
Initialization
Create an empty Spring Boot project,Here we are using version 3.2.0 .
Adding Dependencies
Configuration
Add the configuration to application.yml:
dify:
url: http://192.168.1.10 # Please replace with the actual Dify service address
server:
email: admin@admin.com # Please replace the actual Dify service mailbox, if you do not need to call the server-related interfaces can not be filled in!
password: admin123456 # Please replace the password with the actual Dify service password, if you don't need to call the server-related interfaces can not be filled in!
dataset:
api-key: dataset-aaabbbcccdddeeefffggghhh # Please replace with the actual Dify dataset API key, if you don't need to call the dataset-related interfaces can not be filled in!
Use
Getting Message Suggestion Example
@Service
public class DifyChatService {
@Resource
private DifyChat difyChat;
public List<String> messagesSuggested(String messageId, String apiKey, String userId) {
return difyChat.messagesSuggested(messageId, apiKey, userId);
}
}
Wrap-up
With these few simple steps, we have implemented the dify interface call.
For more usage references check the examples