AI控制器代码
This commit is contained in:
@@ -42,48 +42,50 @@ import java.util.concurrent.CompletableFuture;
|
||||
@RequestMapping("/aitutor/aichat")
|
||||
public class AiChatController extends BaseController {
|
||||
|
||||
// private static final String DIFY_BASE_URL = "http://172.16.129.101:6100";
|
||||
private static final String DIFY_BASE_URL = "http://47.112.118.149:8100";
|
||||
/**
|
||||
* Dify API的访问密钥
|
||||
* 用于身份验证,授权访问Dify服务
|
||||
*/
|
||||
private static final String DIFY_API_KEY = "app-BfPtBZDNBuHOS9K1PaZrxQYE";
|
||||
|
||||
// private static final String DIFY_API_KEY = "app-BfPtBZDNBuHOS9K1PaZrxQYE";
|
||||
private static final String DIFY_API_KEY = "app-2wjqcYI9n6igHTVHdH8qXlnh";
|
||||
/**
|
||||
* Dify API的URL地址
|
||||
* 用于发送聊天消息请求到Dify服务
|
||||
*/
|
||||
|
||||
private static final String DIFY_API_URL = "http://172.16.129.101/v1:6100/v1/chat-messages";
|
||||
private static final String DIFY_API_URL = DIFY_BASE_URL+"/v1/chat-messages";
|
||||
|
||||
/**
|
||||
* Dify反馈API的基础URL
|
||||
* 用于提交消息反馈(点赞、点踩等)
|
||||
*/
|
||||
private static final String DIFY_FEEDBACK_BASE_URL = "http://172.16.129.101/v1:6100/v1/messages";
|
||||
private static final String DIFY_FEEDBACK_BASE_URL = DIFY_BASE_URL+"/v1/messages";
|
||||
|
||||
/**
|
||||
* Dify获取反馈API的基础URL
|
||||
* 用于获取消息反馈(点赞、点踩等)
|
||||
*/
|
||||
private static final String DIFY_API_FEEDBACK_URL = "http://172.16.129.101/v1:6100/v1/app/feedbacks?page=";
|
||||
private static final String DIFY_API_FEEDBACK_URL = DIFY_BASE_URL+"/v1/app/feedbacks?page=";
|
||||
|
||||
/**
|
||||
* Dify消息历史记录API的基础URL
|
||||
* 用于获取消息历史记录
|
||||
*/
|
||||
private static final String DIFY_API_HISTORY_URL = "http://172.16.129.101/v1:6100/v1/messages";
|
||||
private static final String DIFY_API_HISTORY_URL = DIFY_BASE_URL+"/v1/messages";
|
||||
|
||||
/**
|
||||
* Dify会话API的基础URL
|
||||
* 用于获取会话列表
|
||||
*/
|
||||
private static final String DIFY_CONVERSATIONS_URL = "http://172.16.129.101/v1:6100/v1/conversations";
|
||||
private static final String DIFY_CONVERSATIONS_URL = DIFY_BASE_URL+"/v1/conversations";
|
||||
|
||||
/**
|
||||
* Dify文件上传API的URL地址
|
||||
* 用于上传文件到Dify服务,支持图文多模态理解
|
||||
*/
|
||||
private static final String DIFY_FILES_URL = "http://172.16.129.101/v1:6100/v1/files/upload";
|
||||
private static final String DIFY_FILES_URL = DIFY_BASE_URL+"/v1/files/upload";
|
||||
|
||||
/**
|
||||
* Redis中会话ID的key前缀
|
||||
@@ -532,7 +534,7 @@ public class AiChatController extends BaseController {
|
||||
return successResult;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("网络请求失败,请稍后重试");
|
||||
return AjaxResult.error("网络请求失败,请稍后重试getMessagesToAdmin");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("请求处理失败: " + e.getMessage());
|
||||
@@ -571,7 +573,7 @@ public class AiChatController extends BaseController {
|
||||
return successResult;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("网络请求失败,请稍后重试");
|
||||
return AjaxResult.error("网络请求失败,请稍后重试getMessagesToUser");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("请求处理失败: " + e.getMessage());
|
||||
|
Reference in New Issue
Block a user