feat(chat): 添加获取应用参数接口并优化消息列表功能
- 新增 /parameters/{appid} 接口,用于获取应用参数 - 优化消息列表功能,增加对会话列表的处理 - 添加必要的代码注释,提高代码可读性
This commit is contained in:
parent
717bd036ba
commit
73d3a38ad0
@ -9,6 +9,7 @@ import io.github.guoshiqiufeng.dify.chat.DifyChat;
|
||||
import io.github.guoshiqiufeng.dify.chat.dto.request.ChatMessageSendRequest;
|
||||
import io.github.guoshiqiufeng.dify.chat.dto.request.MessageConversationsRequest;
|
||||
import io.github.guoshiqiufeng.dify.chat.dto.request.MessagesRequest;
|
||||
import io.github.guoshiqiufeng.dify.chat.dto.response.AppParametersResponseVO;
|
||||
import io.github.guoshiqiufeng.dify.chat.dto.response.ChatMessageSendCompletionResponse;
|
||||
import io.github.guoshiqiufeng.dify.chat.dto.response.ChatMessageSendResponse;
|
||||
import io.github.guoshiqiufeng.dify.chat.dto.response.MessageConversationsResponse;
|
||||
@ -90,8 +91,9 @@ public class V1ChatController {
|
||||
request.setUserId(SecurityUtil.getUserInfo().id.toString());
|
||||
return difyChat.conversations(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取会话的消息列表
|
||||
* 获取消息列表
|
||||
*
|
||||
* @param request 请求参数
|
||||
* @return 消息列表
|
||||
@ -147,4 +149,17 @@ public class V1ChatController {
|
||||
String userId = SecurityUtil.getUserInfo().id.toString();
|
||||
return ExceptionUtil.difyException(()->difyChat.messagesSuggested(messageId,apiKey,userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取应用参数
|
||||
* @param appid
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/parameters/{appid}")
|
||||
@PreAuthorize("hasAuthority('dify:chat:query')")
|
||||
public AppParametersResponseVO parameters(@PathVariable String appid){
|
||||
String apiKey = appEntityService.getApikey(appid);
|
||||
return ExceptionUtil.difyException(()->difyChat.parameters(apiKey));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user