Commit d8462d72 authored by alex yao's avatar alex yao

feat:首页插件查询

parent c4b4ee9b
select
bgaa.agent_id,
bgaa.agent_avatar,
bgaa.agent_title,
bgaa.agent_desc
from biz_agent_application_publish bgaa
join biz_agent_application_index_plugin baaip on bgaa.agent_id = baaip.agent_id and baaip.is_deleted = 'N'
where bgaa.is_deleted='N'
<<and LOCATE(:search,bgaa.agent_title)>>
\ No newline at end of file
package cn.com.poc.agent_application.query;
import java.io.Serializable;
/**
* Query Condition class for AgentApplicationIndexPluginQuery
*/
public class AgentApplicationIndexPluginQueryCondition implements Serializable{
private static final long serialVersionUID = 1L;
private java.lang.String search;
public java.lang.String getSearch(){
return this.search;
}
public void setSearch(java.lang.String search){
this.search = search;
}
}
\ No newline at end of file
package cn.com.poc.agent_application.query;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import cn.com.yict.framemax.data.model.BaseItemClass;
/**
* Query Item class for AgentApplicationIndexPluginQuery
*/
@Entity
public class AgentApplicationIndexPluginQueryItem extends BaseItemClass implements Serializable{
private static final long serialVersionUID = 1L;
/** agent_id
*agent_id
*/
private java.lang.String agentId;
@Column(name = "agent_id")
public java.lang.String getAgentId(){
return this.agentId;
}
public void setAgentId(java.lang.String agentId){
this.agentId = agentId;
}
/** agent_avatar
*agent_avatar
*/
private java.lang.String agentAvatar;
@Column(name = "agent_avatar")
public java.lang.String getAgentAvatar(){
return this.agentAvatar;
}
public void setAgentAvatar(java.lang.String agentAvatar){
this.agentAvatar = agentAvatar;
}
/** agent_title
*agent_title
*/
private java.lang.String agentTitle;
@Column(name = "agent_title")
public java.lang.String getAgentTitle(){
return this.agentTitle;
}
public void setAgentTitle(java.lang.String agentTitle){
this.agentTitle = agentTitle;
}
/** agent_desc
*agent_desc
*/
private java.lang.String agentDesc;
@Column(name = "agent_desc")
public java.lang.String getAgentDesc(){
return this.agentDesc;
}
public void setAgentDesc(java.lang.String agentDesc){
this.agentDesc = agentDesc;
}
}
\ No newline at end of file
package cn.com.poc.agent_application.service;
import cn.com.poc.agent_application.query.AgentApplicationIndexPluginQueryCondition;
import cn.com.poc.agent_application.query.AgentApplicationIndexPluginQueryItem;
import cn.com.yict.framemax.core.service.BaseService;
import java.util.List;
/**
* @author alex.yao
* @date 2025/5/14
*/
public interface BizAgentApplicationIndexPluginService extends BaseService {
List<AgentApplicationIndexPluginQueryItem> agentApplicationIndexPluginQuery(AgentApplicationIndexPluginQueryCondition condition);
}
package cn.com.poc.agent_application.service.impl;
import cn.com.poc.agent_application.query.AgentApplicationIndexPluginQueryCondition;
import cn.com.poc.agent_application.query.AgentApplicationIndexPluginQueryItem;
import cn.com.poc.agent_application.service.BizAgentApplicationIndexPluginService;
import cn.com.yict.framemax.core.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author alex.yao
* @date 2025/5/14
*/
@Service
public class BizAgentApplicationIndexPluginServiceImpl extends BaseServiceImpl implements BizAgentApplicationIndexPluginService {
@Override
public List<AgentApplicationIndexPluginQueryItem> agentApplicationIndexPluginQuery(AgentApplicationIndexPluginQueryCondition condition) {
return this.sqlDao.query(condition, AgentApplicationIndexPluginQueryItem.class);
}
}
package cn.com.poc.expose.aggregate; package cn.com.poc.expose.aggregate;
import cn.com.poc.agent_application.entity.BizAgentApplicationApiProfileEntity; import cn.com.poc.agent_application.entity.BizAgentApplicationApiProfileEntity;
import cn.com.poc.agent_application.query.AgentApplicationIndexPluginQueryItem;
import cn.com.poc.agent_application.query.MemberCollectQueryItem; import cn.com.poc.agent_application.query.MemberCollectQueryItem;
import cn.com.yict.framemax.data.model.PagingInfo; import cn.com.yict.framemax.data.model.PagingInfo;
...@@ -83,4 +84,12 @@ public interface AgentApplicationExposeService { ...@@ -83,4 +84,12 @@ public interface AgentApplicationExposeService {
*/ */
BizAgentApplicationApiProfileEntity resetApiProfile(Long memberId) throws Exception; BizAgentApplicationApiProfileEntity resetApiProfile(Long memberId) throws Exception;
/**
* 获取首页插件
*
* @param search
* @return
*/
List<AgentApplicationIndexPluginQueryItem> getHomePlugins(String search);
} }
...@@ -4,6 +4,8 @@ import cn.com.poc.agent_application.aggregate.AgentApplicationService; ...@@ -4,6 +4,8 @@ import cn.com.poc.agent_application.aggregate.AgentApplicationService;
import cn.com.poc.agent_application.constant.AgentApplicationDialoguesRecordConstants; import cn.com.poc.agent_application.constant.AgentApplicationDialoguesRecordConstants;
import cn.com.poc.agent_application.constant.AgentApplicationGCConfigConstants; import cn.com.poc.agent_application.constant.AgentApplicationGCConfigConstants;
import cn.com.poc.agent_application.entity.*; import cn.com.poc.agent_application.entity.*;
import cn.com.poc.agent_application.query.AgentApplicationIndexPluginQueryCondition;
import cn.com.poc.agent_application.query.AgentApplicationIndexPluginQueryItem;
import cn.com.poc.agent_application.query.MemberCollectQueryCondition; import cn.com.poc.agent_application.query.MemberCollectQueryCondition;
import cn.com.poc.agent_application.query.MemberCollectQueryItem; import cn.com.poc.agent_application.query.MemberCollectQueryItem;
import cn.com.poc.agent_application.service.*; import cn.com.poc.agent_application.service.*;
...@@ -107,6 +109,9 @@ public class AgentApplicationExposeServiceImpl implements AgentApplicationExpose ...@@ -107,6 +109,9 @@ public class AgentApplicationExposeServiceImpl implements AgentApplicationExpose
@Resource @Resource
private BizAgentApplicationApiProfileService bizAgentApplicationApiProfileService; private BizAgentApplicationApiProfileService bizAgentApplicationApiProfileService;
@Resource
private BizAgentApplicationIndexPluginService bizAgentApplicationIndexPluginService;
@Override @Override
public void callAgentApplication(String agentId, String dialogsId, String input, List<String> fileUrls, String channel, String imageUrl, HttpServletResponse httpServletResponse) throws Exception { public void callAgentApplication(String agentId, String dialogsId, String input, List<String> fileUrls, String channel, String imageUrl, HttpServletResponse httpServletResponse) throws Exception {
...@@ -375,6 +380,14 @@ public class AgentApplicationExposeServiceImpl implements AgentApplicationExpose ...@@ -375,6 +380,14 @@ public class AgentApplicationExposeServiceImpl implements AgentApplicationExpose
return bizAgentApplicationApiProfileService.resetProfile(memberId); return bizAgentApplicationApiProfileService.resetProfile(memberId);
} }
@Override
public List<AgentApplicationIndexPluginQueryItem> getHomePlugins(String search) {
AgentApplicationIndexPluginQueryCondition condition = new AgentApplicationIndexPluginQueryCondition();
condition.setSearch(search);
return bizAgentApplicationIndexPluginService.agentApplicationIndexPluginQuery(condition);
}
private void createCNQuestion() { private void createCNQuestion() {
Message message = new Message(); Message message = new Message();
message.setRole(LLMRoleEnum.USER.getRole()); message.setRole(LLMRoleEnum.USER.getRole());
......
package cn.com.poc.expose.dto;
/**
* @author alex.yao
* @date 2025/5/14
*/
public class IndexPluginDto {
private String agentId;
private String agentTitle;
private String agentDesc;
private String agentAvatar;
public String getAgentId() {
return agentId;
}
public void setAgentId(String agentId) {
this.agentId = agentId;
}
public String getAgentTitle() {
return agentTitle;
}
public void setAgentTitle(String agentTitle) {
this.agentTitle = agentTitle;
}
public String getAgentDesc() {
return agentDesc;
}
public void setAgentDesc(String agentDesc) {
this.agentDesc = agentDesc;
}
public String getAgentAvatar() {
return agentAvatar;
}
public void setAgentAvatar(String agentAvatar) {
this.agentAvatar = agentAvatar;
}
}
...@@ -115,4 +115,12 @@ public interface AgentApplicationRest extends BaseRest { ...@@ -115,4 +115,12 @@ public interface AgentApplicationRest extends BaseRest {
* @return 应用API配置 * @return 应用API配置
*/ */
AgentApplicationApiProfileDto resetApiProfile() throws Exception; AgentApplicationApiProfileDto resetApiProfile() throws Exception;
/**
* 获取首页插件
*
* @param search 搜索关键字
*/
List<IndexPluginDto> getHomePlugins(@RequestParam(required = false) String search);
} }
...@@ -288,4 +288,21 @@ public class AgentApplicationRestImpl implements AgentApplicationRest { ...@@ -288,4 +288,21 @@ public class AgentApplicationRestImpl implements AgentApplicationRest {
result.setApiSecret(apiProfileEntity.getApiSecret()); result.setApiSecret(apiProfileEntity.getApiSecret());
return result; return result;
} }
@Override
public List<IndexPluginDto> getHomePlugins(String search) {
List<AgentApplicationIndexPluginQueryItem> homePlugins = agentApplicationExposeService.getHomePlugins(search);
List<IndexPluginDto> result = new ArrayList<>();
if (CollectionUtils.isNotEmpty(homePlugins)) {
result = homePlugins.stream().map(item -> {
IndexPluginDto dto = new IndexPluginDto();
dto.setAgentId(item.getAgentId());
dto.setAgentTitle(item.getAgentTitle());
dto.setAgentDesc(item.getAgentDesc());
dto.setAgentAvatar(item.getAgentAvatar());
return dto;
}).collect(Collectors.toList());
}
return result;
}
} }
...@@ -54,7 +54,7 @@ public class DocumentUnderstandIngFunction extends AbstractLargeModelFunction { ...@@ -54,7 +54,7 @@ public class DocumentUnderstandIngFunction extends AbstractLargeModelFunction {
return result; return result;
} }
JSONObject jsonObject = JSON.parseObject(content); JSONObject jsonObject = JSON.parseObject(content);
if (!jsonObject.containsKey("question") || !jsonObject.containsKey("file_url")){ if (!jsonObject.containsKey("question") || !jsonObject.containsKey("file_url")) {
return result; return result;
} }
...@@ -64,7 +64,7 @@ public class DocumentUnderstandIngFunction extends AbstractLargeModelFunction { ...@@ -64,7 +64,7 @@ public class DocumentUnderstandIngFunction extends AbstractLargeModelFunction {
String documentContent; String documentContent;
try { try {
documentContent = DocumentLoad.documentToText(file); documentContent = DocumentLoad.documentToText(file);
if(StringUtils.isBlank(documentContent)){ if (StringUtils.isBlank(documentContent)) {
return result; return result;
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -81,11 +81,11 @@ public class DocumentUnderstandIngFunction extends AbstractLargeModelFunction { ...@@ -81,11 +81,11 @@ public class DocumentUnderstandIngFunction extends AbstractLargeModelFunction {
Message message = new Message(); Message message = new Message();
message.setRole("user"); message.setRole("user");
message.setContent(question)); message.setContent(question);
LargeModelResponse largeModelResponse = new LargeModelResponse(); LargeModelResponse largeModelResponse = new LargeModelResponse();
largeModelResponse.setModel(MODEL); largeModelResponse.setModel(MODEL);
largeModelResponse.setMessages(new Message[]{systemMessage,fileContentMessage,message}); largeModelResponse.setMessages(new Message[]{systemMessage, fileContentMessage, message});
largeModelResponse.setStream(false); largeModelResponse.setStream(false);
largeModelResponse.setUser("Document_Understanding"); largeModelResponse.setUser("Document_Understanding");
LargeModelDemandResult largeModelDemandResult = llmService.chat(largeModelResponse); LargeModelDemandResult largeModelDemandResult = llmService.chat(largeModelResponse);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment