|
|
|
@ -5,11 +5,13 @@ import com.pjilisense.flxai.base.service.impl.CrudServiceImpl;
|
|
|
|
|
import com.pjilisense.flxai.dao.AppAiModelDao;
|
|
|
|
|
import com.pjilisense.flxai.dto.AppAiModelDTO;
|
|
|
|
|
import com.pjilisense.flxai.entity.AppAiModelEntity;
|
|
|
|
|
import com.pjilisense.flxai.entity.AppAiPluginEntity;
|
|
|
|
|
import com.pjilisense.flxai.service.AppAiModelService;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.pjilisense.flxai.utils.MapUtils;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* AI模型表
|
|
|
|
@ -30,5 +32,78 @@ public class AppAiModelServiceImpl extends CrudServiceImpl<AppAiModelDao, AppAiM
|
|
|
|
|
return wrapper;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public QueryWrapper<AppAiModelEntity> getWrapperAll(Map<String, Object> params){
|
|
|
|
|
String userid = (String)params.get("userid");
|
|
|
|
|
|
|
|
|
|
QueryWrapper<AppAiModelEntity> wrapper = new QueryWrapper<>();
|
|
|
|
|
wrapper.eq(StrUtil.isNotBlank(userid), "userid", userid);
|
|
|
|
|
wrapper.orderByDesc("created_at");
|
|
|
|
|
return wrapper;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int deleteByIdentifier(String userid, String identifier) {
|
|
|
|
|
QueryWrapper<AppAiModelEntity> wrapper = new QueryWrapper<>();
|
|
|
|
|
wrapper.eq(StrUtil.isNotBlank(identifier), "identifier", identifier);
|
|
|
|
|
wrapper.eq(StrUtil.isNotBlank(userid), "userid", userid);
|
|
|
|
|
return baseDao.delete(wrapper);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Map<String, Object>> getAllAiModel(String userid) {
|
|
|
|
|
Map<String, Object> params =new HashMap<>();
|
|
|
|
|
params.put("userid",userid);
|
|
|
|
|
List<AppAiModelEntity> entityList = baseDao.selectList(getWrapperAll(params));
|
|
|
|
|
params.clear();
|
|
|
|
|
List<Map<String, Object>> retList = new ArrayList<>();
|
|
|
|
|
if(entityList!=null && entityList.size()>0) {
|
|
|
|
|
for (AppAiModelEntity entity : entityList) {
|
|
|
|
|
Map<String, Object> mapx = MapUtils.objectToMap(entity);
|
|
|
|
|
retList.add(mapx);
|
|
|
|
|
HashMap<String, Object> meta = new HashMap<>();
|
|
|
|
|
mapx.put("meta", meta);
|
|
|
|
|
meta.put("displayName", mapx.get("displayName"));
|
|
|
|
|
meta.put("description", mapx.get("description"));
|
|
|
|
|
meta.put("title", mapx.get("title"));
|
|
|
|
|
meta.put("enabled", mapx.get("enabled"));
|
|
|
|
|
meta.put("category", mapx.get("category"));
|
|
|
|
|
meta.put("metaId", mapx.get("metaId"));
|
|
|
|
|
meta.put("metaTokens", mapx.get("metaTokens"));
|
|
|
|
|
String tags = (String) mapx.get("tags");
|
|
|
|
|
if (tags!=null && tags.length() > 0) {
|
|
|
|
|
meta.put("tags", Arrays.asList(tags.split("\\,")));
|
|
|
|
|
} else {
|
|
|
|
|
meta.put("tags", new ArrayList<>());
|
|
|
|
|
}
|
|
|
|
|
mapx.remove("displayName");
|
|
|
|
|
mapx.remove("description");
|
|
|
|
|
mapx.remove("title");
|
|
|
|
|
mapx.remove("enabled");
|
|
|
|
|
mapx.remove("category");
|
|
|
|
|
mapx.remove("metaId");
|
|
|
|
|
mapx.remove("metaTokens");
|
|
|
|
|
String providers = (String) mapx.get("providers");
|
|
|
|
|
if (providers!=null && providers.length() > 0) {
|
|
|
|
|
meta.put("providers", Arrays.asList(providers.split("\\,")));
|
|
|
|
|
} else {
|
|
|
|
|
meta.put("providers", new ArrayList<>());
|
|
|
|
|
}
|
|
|
|
|
HashMap<String, Object> socialData = new HashMap<>();
|
|
|
|
|
mapx.put("socialData", socialData);
|
|
|
|
|
meta.put("conversations", mapx.get("conversations"));
|
|
|
|
|
meta.put("likes", mapx.get("likes"));
|
|
|
|
|
meta.put("tokens", mapx.get("tokens"));
|
|
|
|
|
mapx.remove("conversations");
|
|
|
|
|
mapx.remove("likes");
|
|
|
|
|
mapx.remove("tokens");
|
|
|
|
|
String suggestions = (String) mapx.get("suggestions");
|
|
|
|
|
if (suggestions!=null && suggestions.length() > 0) {
|
|
|
|
|
meta.put("suggestions", Arrays.asList(suggestions.split("\\,")));
|
|
|
|
|
} else {
|
|
|
|
|
meta.put("suggestions", new ArrayList<>());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return retList;
|
|
|
|
|
}
|
|
|
|
|
}
|