Skip to content

Commit

Permalink
更新
Browse files Browse the repository at this point in the history
  • Loading branch information
diyhi committed Dec 25, 2024
1 parent ce922ac commit 2298efa
Show file tree
Hide file tree
Showing 36 changed files with 790 additions and 33 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>bbs</groupId>
<artifactId>bbs</artifactId>
<version>6.4</version>
<version>6.5</version>
<packaging>war</packaging>
<name>bbs</name>
<description/>
Expand Down
73 changes: 73 additions & 0 deletions src/main/java/cms/bean/ai/AiInterface.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package cms.bean.ai;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;

/**
* AI大模型
* @author Gao
*
*/
@Entity
public class AiInterface implements Serializable{
private static final long serialVersionUID = -7340690365799696749L;

/** Id **/
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/** 名称 **/
@Column(length=100)
private String name;
/** 接口产品 10:阿里云百炼大模型 20.火山方舟大模型 **/
private Integer interfaceProduct;
/** 是否选择 true:启用 false: 禁用 **/
private boolean enable = true;
/** 接口动态参数 **/
@Lob
private String dynamicParameter;
/** 版本 **/
private Integer version = 0;

public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getInterfaceProduct() {
return interfaceProduct;
}
public void setInterfaceProduct(Integer interfaceProduct) {
this.interfaceProduct = interfaceProduct;
}
public boolean isEnable() {
return enable;
}
public void setEnable(boolean enable) {
this.enable = enable;
}
public String getDynamicParameter() {
return dynamicParameter;
}
public void setDynamicParameter(String dynamicParameter) {
this.dynamicParameter = dynamicParameter;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
}
33 changes: 33 additions & 0 deletions src/main/java/cms/bean/ai/AiProduct.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package cms.bean.ai;

import java.io.Serializable;

/**
* AI大模型产品
* @author Gao
*
*/
public class AiProduct implements Serializable{
private static final long serialVersionUID = -8649233994892624474L;

/** 接口产品 **/
private Integer interfaceProduct;
/** 名称 **/
private String name;


public Integer getInterfaceProduct() {
return interfaceProduct;
}
public void setInterfaceProduct(Integer interfaceProduct) {
this.interfaceProduct = interfaceProduct;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}


}
37 changes: 37 additions & 0 deletions src/main/java/cms/bean/ai/BaiLian.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package cms.bean.ai;

import java.io.Serializable;

/**
* 阿里云百炼大模型参数
*
*/
public class BaiLian implements Serializable{
private static final long serialVersionUID = -2282654527249181999L;

/** API密钥(API-KEY) **/
private String apiKey;
/** 应用Id **/
private String appId;
/** 业务空间Id **/
private String workspaceId;

public String getApiKey() {
return apiKey;
}
public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getWorkspaceId() {
return workspaceId;
}
public void setWorkspaceId(String workspaceId) {
this.workspaceId = workspaceId;
}
}
83 changes: 83 additions & 0 deletions src/main/java/cms/bean/ai/ChatInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package cms.bean.ai;

import java.io.Serializable;

/**
* 对话信息
* @author Gao
*
*/
public class ChatInfo implements Serializable{
private static final long serialVersionUID = 7432882984799611317L;

/** 系统生成的标识。请求ID **/
private String requestId;

/** 模型生成的回复内容(Markdown格式) **/
private String text;

/** 接口产品 10:阿里云百炼大模型 20.火山方舟大模型 **/
private Integer interfaceProduct;



/** 表示状态码,调用成功时为空值 **/
private Integer statusCode;
/** 表示错误码,调用成功时为空值 **/
private String errorCode;
/** 表示失败详细信息,成功忽略。 **/
private String errorMessage;



public String getRequestId() {
return requestId;
}

public void setRequestId(String requestId) {
this.requestId = requestId;
}

public String getText() {
return text;
}

public void setText(String text) {
this.text = text;
}

public Integer getInterfaceProduct() {
return interfaceProduct;
}

public void setInterfaceProduct(Integer interfaceProduct) {
this.interfaceProduct = interfaceProduct;
}

public String getErrorCode() {
return errorCode;
}

public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}

public String getErrorMessage() {
return errorMessage;
}

public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}

public Integer getStatusCode() {
return statusCode;
}

public void setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
}



}
10 changes: 10 additions & 0 deletions src/main/java/cms/bean/setting/SystemSetting.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public class SystemSetting implements Serializable{
private Integer privateMessage_submitQuantity = 5;
/** 提交问题最多可选择标签数量 **/
private Integer maxQuestionTagQuantity = 5;
/** AI助手每分钟提交超过N次出现验证码 **/
private Integer aiAssistant_submitQuantity = 5;
/** 举报每分钟提交超过N次出现验证码 **/
private Integer report_submitQuantity = 5;
/** 举报图片允许最大上传数量 0为不允许上传图片 **/
Expand Down Expand Up @@ -784,6 +786,14 @@ public void setAllowMentionMaxNumber(Integer allowMentionMaxNumber) {
this.allowMentionMaxNumber = allowMentionMaxNumber;
}

public Integer getAiAssistant_submitQuantity() {
return aiAssistant_submitQuantity;
}

public void setAiAssistant_submitQuantity(Integer aiAssistant_submitQuantity) {
this.aiAssistant_submitQuantity = aiAssistant_submitQuantity;
}




Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cms/web/action/common/HomeManageAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ public String replyListUI(ModelMap model,PageForm pageForm,
List<Long> topicIdList = new ArrayList<Long>();
for(Reply o :qr.getResultlist()){
o.setIp(null);//IP地址不显示

o.setContent(textFilterManage.filterText(textFilterManage.specifyHtmlTagToText(o.getContent())));
if(!topicIdList.contains(o.getTopicId())){
topicIdList.add(o.getTopicId());
}
Expand Down Expand Up @@ -5765,7 +5765,7 @@ public String answerReplyListUI(ModelMap model,PageForm pageForm,
List<Long> questionIdList = new ArrayList<Long>();
for(AnswerReply o :qr.getResultlist()){
o.setIp(null);//IP地址不显示

o.setContent(textFilterManage.filterText(textFilterManage.specifyHtmlTagToText(o.getContent())));
if(!questionIdList.contains(o.getQuestionId())){
questionIdList.add(o.getQuestionId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ public List<ForumCodeNode> forumCodeNodeList(String dirName){
List<ForumCodeNode> childNode18 = new ArrayList<ForumCodeNode>();//添加二级节点
childNode18.add(new ForumCodeNode(18001,"热门搜索词","systemRelated_searchWord_",Arrays.asList(new String[]{"集合"})));
childNode18.add(new ForumCodeNode(18010,"第三方登录","systemRelated_thirdPartyLogin_",Arrays.asList(new String[]{"集合"})));
childNode18.add(new ForumCodeNode(18020,"AI助手","systemRelated_aiAssistant_",Arrays.asList(new String[]{"集合"})));
forumCodeNodeList.add(new ForumCodeNode(118,"系统",childNode18));//添加一级节点

List<ForumCodeFile> forumCodeFileList = this.readForumCodeFile(dirName);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cms/web/action/question/QuestionAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ public String allAuditAnswer(PageForm pageForm,ModelMap model,
if(qr != null && qr.getResultlist() != null && qr.getResultlist().size() >0){
List<Long> questionIdList = new ArrayList<Long>();
for(Answer o :qr.getResultlist()){
o.setContent(textFilterManage.filterText(o.getContent()));
o.setContent(textFilterManage.filterText(textFilterManage.specifyHtmlTagToText(o.getContent())));
if(!questionIdList.contains(o.getQuestionId())){
questionIdList.add(o.getQuestionId());
}
Expand Down Expand Up @@ -627,7 +627,7 @@ public String allAuditAnswerReply(PageForm pageForm,ModelMap model,
List<Long> questionIdList = new ArrayList<Long>();
for(AnswerReply o :qr.getResultlist()){

o.setContent(textFilterManage.filterText(o.getContent()));
o.setContent(textFilterManage.filterText(textFilterManage.specifyHtmlTagToText(o.getContent())));
if(!questionIdList.contains(o.getQuestionId())){
questionIdList.add(o.getQuestionId());
}
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/cms/web/action/setting/SystemSettingValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,30 @@ public void validate(Object obj, Errors errors) {//对目标类对象进行校
}else{
errors.rejectValue("privateMessage_submitQuantity","errors.required", new String[]{"不能为空"},"");
}
//AI助手每分钟提交超过
if(systemSetting.getAiAssistant_submitQuantity() != null){
if(systemSetting.getAiAssistant_submitQuantity() <0){
errors.rejectValue("aiAssistant_submitQuantity","errors.required", new String[]{"不能小于0"},"");
}
}else{
errors.rejectValue("aiAssistant_submitQuantity","errors.required", new String[]{"不能为空"},"");
}
//举报每分钟提交超过
if(systemSetting.getReport_submitQuantity() != null){
if(systemSetting.getReport_submitQuantity() <0){
errors.rejectValue("report_submitQuantity","errors.required", new String[]{"不能小于0"},"");
}
}else{
errors.rejectValue("report_submitQuantity","errors.required", new String[]{"不能为空"},"");
}
//举报图片允许最大上传数量
if(systemSetting.getReportMaxImageUpload() != null){
if(systemSetting.getReportMaxImageUpload() <0){
errors.rejectValue("reportMaxImageUpload","errors.required", new String[]{"不能小于0"},"");
}
}else{
errors.rejectValue("reportMaxImageUpload","errors.required", new String[]{"不能为空"},"");
}

//提交问题最多可选择标签数量
if(systemSetting.getMaxQuestionTagQuantity() != null){
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/cms/web/action/template/TemplateMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,11 @@ else if(forum.getForumChildType().equals("添加在线留言")){
List<SupportLoginInterface> value = system_TemplateManage.thirdPartyLogin_collection(forum, submitParameter,runtimeParameter);
return value;
}
}else if(forum.getForumChildType().equals("AI助手")){
if(forum.getDisplayType().equals("collection")){//集合
Map<String,Object> value = system_TemplateManage.aiAssistant_collection(forum, submitParameter,runtimeParameter);
return value;
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,12 @@ public List<HelpType> type_collection(Forum forum,Map<String,Object> parameter,M
List<HelpType> helpTypeList = new ArrayList<HelpType>();

List<HelpType> allHelpType = helpTypeService.findAllHelpType();

HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();

for(HelpType helpType : allHelpType){
if(helpType.getImage() != null && !"".equals(helpType.getImage().trim())){
helpType.setImage(fileManage.fileServerAddress(request)+helpType.getImage());
}
if(helpType.getChildNodeNumber() >0){//有子节点
List<HelpType> childHelpType = this.queryType(allHelpType,helpType.getId());
if(childHelpType != null && childHelpType.size() >0){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cms.web.action.template.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -105,5 +106,13 @@ public List<SupportLoginInterface> thirdPartyLogin_collection(Forum forum,Map<St
return supportLoginInterfaceList;
}

/**
* AI助手(未实现)
* @param forum
*/
public Map<String,Object> aiAssistant_collection(Forum forum,Map<String,Object> parameter,Map<String,Object> runtimeParameter){
Map<String,Object> returnValue = new HashMap<String,Object>();//返回值
return returnValue;
}
}

Loading

0 comments on commit 2298efa

Please sign in to comment.