Commit 2c8526bc authored by wangning's avatar wangning

fix

parent 685caf9a
This diff is collapsed.
package pro.spss.server.agent.auth;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import pro.spss.server.common.interceptor.AuthInterceptor;
@Configuration
@Order(1)
public class AuthInterceptorConfiguration implements WebMvcConfigurer {
@Bean
public AuthInterceptor authInterceptor() {
return new AuthInterceptor();
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(authInterceptor())
.addPathPatterns("/**")
.excludePathPatterns("/swagger-ui/**", "/v3/api-docs/**", "/api-docs.yaml");;
}
}
......@@ -35,13 +35,4 @@ public class ResponseMessage {
public ResponseMessage() {
startTimestamp = System.currentTimeMillis();
}
public String toJSONString() {
ObjectMapper mapper = new ObjectMapper();
try {
return mapper.writeValueAsString(this);
} catch (JsonProcessingException e) {
throw new RuntimeException("JSON序列化失败", e);
}
}
}
......@@ -9,6 +9,7 @@ import org.springframework.stereotype.Service;
import pro.spss.server.agent.domain.enums.ChatStatusEnum;
import pro.spss.server.agent.domain.enums.ConversationStateEnum;
import pro.spss.server.agent.domain.enums.CreateWayEnum;
import pro.spss.server.agent.domain.enums.ResponseMessageType;
import pro.spss.server.agent.domain.request.RequestParams;
import pro.spss.server.agent.domain.request.UserChatMessage;
import pro.spss.server.agent.domain.response.ResponseMessage;
......@@ -79,10 +80,9 @@ public class ChatServiceImpl implements BaseChatService {
return false;
}
// 创建会话列表并写入默认系统消息与 RequestParams
chatSessionManager.initSession(sessionId, CreateWayEnum.ALGO_FIRST);
// 通过 SSE 推送初始提示给前端(保持方法返回 void 的行为)
sseService.sendMessage(sessionId, userChatMessage.getToken(), initPrompt);
sseService.sendMessage(ResponseMessageType.INIT.getType(), sessionId, userChatMessage.getToken(), initPrompt);
return true;
}
......
......@@ -3,6 +3,8 @@ package pro.spss.server.agent.service.handler;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
......@@ -39,6 +41,9 @@ public class IntentTool {
@Autowired
private PromptBuilderService promptBuilderService;
private static final Logger logger = LoggerFactory.getLogger(IntentTool.class);
/**
* 意图识别:聚合系统提示词模板、动态工具清单、最近历史与用户本轮输入,
* 调用大模型返回目标工具名称。默认回退为 "default"。
......@@ -83,6 +88,7 @@ public class IntentTool {
}
}
log.info("历史指令条数:{}(已截断为最近{}条或更少)", history.size(), intentHistoryLimit);
log.info(history.toJSONString());
JSONArray messages = new JSONArray();
messages.add(ChatConstants.createMessage(ChatConstants.ROLE_SYSTEM, intentPrompt));
......
......@@ -69,7 +69,7 @@ public class DataSummaryUtil {
sb.append("\n");
}
// 粗略算法方向建议
/* // 粗略算法方向建议
boolean hasNumeric = hasType(columnValues, "numeric");
boolean hasCategorical = hasType(columnValues, "categorical");
sb.append("可能适用的算法方向: ");
......@@ -81,7 +81,7 @@ public class DataSummaryUtil {
sb.append("聚类(K均值/层次), 关联规则挖掘, 编码转换(哑编码, 二值化)\n");
} else {
sb.append("文本/灰色模型或需进一步的数据预处理\n");
}
}*/
return sb.toString();
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"经济、管理数据预测": [
{"name": "最小二乘回归","description": "最小化残差平方和拟合线性关系,广泛用于连续值预测。","label":"回归模型"},
{"name": "岭回归","description": "L2 正则化缓解多重共线性,提升线性模型稳定性。","label":"回归模型"},
{"name": "套索回归","description": "L1 正则化实现特征选择,得到更简洁可解释的模型。","label":"回归模型"},
{"name": "多项式回归","description": "通过多项式项捕捉非线性趋势,用于曲线拟合与预测。","label":"回归模型"},
{"name": "支持向量机回归","description": "核方法处理非线性与高维数据,适合复杂趋势预测。","label":"回归模型"},
{"name": "BP神经网络","description": "拟合复杂非线性关系,适合多变量预测任务。","label":"回归模型"},
{"name": "梯度提升树","description": "集成学习提升预测精度,适合非线性与异质特征。","label":"分类模型"},
{"name": "移动平均法","description": "平滑时间序列短期波动,揭示长期趋势。","label":"时间序列分析"},
{"name": "指数平滑法","description": "近期数据权重更高,能刻画趋势与季节性。","label":"时间序列分析"},
{"name": "自回归模型(AR)","description": "基于历史自回归项的时间序列预测。","label":"时间序列分析"},
{"name": "滑动平均模型(MA)","description": "基于历史误差项的时间序列预测。","label":"时间序列分析"},
{"name": "自回归滑动平均模型","description": "平稳序列的组合模型,短期预测常用。","label":"时间序列分析"},
{"name": "差分自回归移动平均模型","description": "对非平稳序列差分后建模,适合长期趋势与季节性分析。","label":"时间序列分析"},
{"name": "灰色模型","description": "小样本、贫信息场景的预测与趋势分析。","label":"领域分析"}
],
"数据因果关系分析(统计学方法)": [
{"name": "最小二乘回归","description": "用于估计因变量与自变量的线性因果关系。","label":"回归模型"},
{"name": "岭回归","description": "在自变量相关性较强时稳健估计因果效应。","label":"回归模型"},
{"name": "套索回归","description": "特征选择识别显著自变量,辅助因果推断。","label":"回归模型"},
{"name": "多项式回归","description": "建模非线性因果关系的简便扩展。","label":"回归模型"},
{"name": "二分类逻辑回归","description": "估计事件发生概率,用于二分类因果效应分析的基础模型。","label":"回归模型"},
{"name": "支持向量机回归","description": "在高维下用于拟合与解释变量影响(需较多数据)。","label":"回归模型"}
],
"数据因果关系分析(机器学习方法)": [
{"name": "决策树","description": "可解释的树模型,揭示变量交互与影响路径。","label":"分类模型"},
{"name": "随机森林","description": "多树集成,稳健处理高维与共线性。","label":"分类模型"},
{"name": "自适应增强算法","description": "提升弱学习器性能,适合复杂非线性关系。","label":"分类模型"},
{"name": "梯度提升树","description": "迭代拟合残差,精确刻画非线性与相互作用。","label":"分类模型"}
],
"决策分析": [
{"name": "决策树","description": "直观的决策路径与规则提取。","label":"分类模型"},
{"name": "随机森林","description": "稳定且准确的多因素决策支持。","label":"分类模型"},
{"name": "自适应增强算法","description": "对不平衡样本的鲁棒决策提升。","label":"分类模型"},
{"name": "判别分析","description": "基于类别的线性/二次判别决策。","label":"分类模型"},
{"name": "优劣解距离法","description": "多属性决策的排序与方案优选。","label":"综合评价"},
{"name": "净现值法","description": "基于现金流现值评估投资可行性。","label":"综合评价"}
],
"风险评估分析": [
{"name": "自适应增强算法","description": "调整样本权重,适用于不平衡风险识别。","label":"分类模型"},
{"name": "决策树","description": "识别关键风险因子与规则路径。","label":"分类模型"},
{"name": "随机森林","description": "复杂多维特征下的稳健风险评估。","label":"分类模型"},
{"name": "判别分析","description": "风险等级识别与分类。","label":"分类模型"},
{"name": "优劣解距离法","description": "多方案风险控制措施优选。","label":"综合评价"},
{"name": "模糊综合评价","description": "处理不确定与模糊信息的风险量化。","label":"综合评价"},
{"name": "灰色模型","description": "信息不完全条件下的风险动态分析。","label":"综合评价"}
],
"数据相关性分析": [
{"name": "皮尔逊相关分析","description": "评估连续变量的线性相关性。","label":"关联分析"},
{"name": "斯皮尔曼相关分析","description": "基于秩的单调相关性,抗异常值。","label":"关联分析"}
],
"评价与排序分析": [
{"name": "秩和比评价法","description": "多指标综合评价与排序。","label":"综合评价"},
{"name": "模糊综合评价","description": "在模糊性场景下的综合评价。","label":"综合评价"},
{"name": "因子分析","description": "提取公共因子进行综合评分。","label":"综合评价"},
{"name": "主成分分析","description": "用主成分进行降维与综合衡量。","label":"综合评价"},
{"name": "优劣解距离法","description": "基于与理想解距离的排序。","label":"综合评价"},
{"name": "数据包络分析(BCC)","description": "规模报酬可变的效率评价。","label":"综合评价"},
{"name": "数据包络分析(CCR)","description": "规模报酬不变的效率评价。","label":"综合评价"}
],
"投入产出效率分析": [
{"name": "柯布-道格拉斯生产函数","description": "资本与劳动投入对产出的关系建模。","label":"领域分析"},
{"name": "数据包络分析(BCC)","description": "分解纯技术效率与规模效率。","label":"综合评价"},
{"name": "数据包络分析(CCR)","description": "评估技术效率的基础DEA模型。","label":"综合评价"}
],
"数据分群归类": [
{"name": "K-均值聚类","description": "相似样本聚为一类,适合大规模数据。","label":"聚类算法"},
{"name": "层次聚类","description": "树状层级结构便于小规模分群分析。","label":"聚类算法"}
],
"指标权重关系分析": [
{"name": "主成分分析","description": "提取关键指标,衡量权重贡献。","label":"降维方法"}
],
"数据降维及可视化": [
{"name": "因子分析","description": "潜在因子提取,简化多变量关系。","label":"降维方法"},
{"name": "主成分分析","description": "将相关变量转化为不相关主成分。","label":"降维方法"}
],
"数据差异关系分析": [
{"name": "独立样本t检验","description": "比较两组均值差异的显著性。","label":"统计检验"}
],
"数据特征分析": [
{"name": "正态检验","description": "检验数据是否符合正态分布。","label":"统计检验"}
]
}
\ No newline at end of file
This diff is collapsed.
[
{"name":"最小二乘回归","task":["回归","预测"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"简单"},
{"name":"岭回归","task":["回归","预测"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"简单"},
{"name":"套索回归","task":["回归","预测"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"简单"},
{"name":"多项式回归","task":["回归","预测"],"data":"非时间序列","relation":"非线性","sample":"不限","complexity":"复杂"},
{"name":"支持向量机回归","task":["回归","预测"],"data":"非时间序列","relation":"非线性","sample":"偏小样本","complexity":"复杂"},
{"name":"BP神经网络","task":["回归","预测"],"data":"非时间序列","relation":"非线性","sample":"不限","complexity":"复杂"},
{"name":"梯度提升树","task":["回归","分类","预测"],"data":"非时间序列","relation":"非线性","sample":"不限","complexity":"复杂"},
{"name":"移动平均法","task":["预测"],"data":"时间序列","relation":"不限","sample":"偏小样本","complexity":"简单"},
{"name":"指数平滑法","task":["预测"],"data":"时间序列","relation":"不限","sample":"偏小样本","complexity":"简单"},
{"name":"自回归模型(AR)","task":["预测"],"data":"时间序列","relation":"线性","sample":"不限","complexity":"复杂"},
{"name":"滑动平均模型(MA)","task":["预测"],"data":"时间序列","relation":"线性","sample":"不限","complexity":"复杂"},
{"name":"自回归滑动平均模型","task":["预测"],"data":"时间序列","relation":"线性","sample":"不限","complexity":"复杂"},
{"name":"差分自回归移动平均模型","task":["预测"],"data":"时间序列","relation":"线性","sample":"不限","complexity":"复杂"},
{"name":"灰色模型","task":["预测"],"data":"时间序列","relation":"线性","sample":"小样本","complexity":"简单"},
{"name":"决策树","task":["分类","决策"],"data":"非时间序列","relation":"非线性","sample":"不限","complexity":"简单"},
{"name":"随机森林","task":["分类","预测"],"data":"非时间序列","relation":"非线性","sample":"不限","complexity":"复杂"},
{"name":"自适应增强算法","task":["分类","预测"],"data":"非时间序列","relation":"非线性","sample":"不限","complexity":"复杂"},
{"name":"判别分析","task":["分类"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"简单"},
{"name":"二分类逻辑回归","task":["分类","回归"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"简单"},
{"name":"皮尔逊相关分析","task":["相关"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"简单"},
{"name":"斯皮尔曼相关分析","task":["相关"],"data":"非时间序列","relation":"不限","sample":"不限","complexity":"简单"},
{"name":"独立样本t检验","task":["检验"],"data":"非时间序列","relation":"不限","sample":"不限","complexity":"简单"},
{"name":"正态检验","task":["检验"],"data":"非时间序列","relation":"不限","sample":"不限","complexity":"简单"},
{"name":"K-均值聚类","task":["聚类"],"data":"非时间序列","relation":"不限","sample":"不限","complexity":"简单"},
{"name":"层次聚类","task":["聚类"],"data":"非时间序列","relation":"不限","sample":"小样本","complexity":"复杂"},
{"name":"因子分析","task":["降维","评价"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"复杂"},
{"name":"主成分分析","task":["降维"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"复杂"},
{"name":"优劣解距离法","task":["排序","评价"],"data":"非时间序列","relation":"不限","sample":"不限","complexity":"简单"},
{"name":"秩和比评价法","task":["排序","评价"],"data":"非时间序列","relation":"不限","sample":"不限","complexity":"简单"},
{"name":"模糊综合评价","task":["评价","排序"],"data":"非时间序列","relation":"不限","sample":"不限","complexity":"复杂"},
{"name":"数据包络分析(CCR)","task":["效率","评价"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"复杂"},
{"name":"数据包络分析(BCC)","task":["效率","评价"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"复杂"},
{"name":"柯布-道格拉斯生产函数","task":["效率","回归"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"简单"}
]
算法标签体系简要说明
通过标签描述算法的适用场景与特性,用于支持算法自动推荐、条件筛选和规则匹配。
任务类型:说明算法能解决的问题,如预测、回归、分类、排序、聚类、相关、检验、降维、评价、效率等。
数据类型:区分是否为时间序列数据。
关系形式:描述模型刻画关系的方式,包括线性、非线性或不限。
样本规模:表示算法对样本数量的适应程度,如小样本或中大样本。
复杂度:表示算法实现和计算难度,分为简单或复杂。
通过这些标签,可以把用户需求与算法能力进行快速匹配,实现智能推荐与筛选。
{"prompt":"你好,系统都能做什么?","token":"t-001","sessionId":"1001","userId":"u-alice"}
{"prompt":"请简单介绍一下你是什么系统","token":"t-002","sessionId":"1001","userId":"u-alice"}
{"prompt":"没有上传数据时,我可以做什么?","token":"t-003","sessionId":"1002","userId":"u-bob"}
{"prompt":"我上传了一个房价数据集,适合用什么算法?","token":"t-004","sessionId":"1003","userId":"u-carol"}
{"prompt":"我选择了随机森林,能推荐一下参数吗?","token":"t-005","sessionId":"1003","userId":"u-carol"}
{"prompt":"确认执行算法并返回结果","token":"t-006","sessionId":"1003","userId":"u-carol"}
{"prompt":"能介绍一下分类算法和回归算法的区别吗?","token":"t-007","sessionId":"1004","userId":"u-dave"}
{"prompt":"默认处理一下我的问题","token":"t-008","sessionId":"1005","userId":"u-erin"}
{"prompt":"","dataId":"6bd5727bcefd420ebad01a349b1b6028","confirm":false,"sessionId":"S1001","expected":"数据包络分析(BCC)"}
{"prompt":"能不能根据这些数据帮我建一个模型,用促销支出来预测销售量?","dataId":"1.xlsx","confirm":false,"sessionId":"S1001","expected":"最小二乘回归"}
{"prompt":"我想根据促销支出来预测销售量?","dataId":"1.xlsx","confirm":false,"sessionId":"S1002","expected":"最小二乘回归"}
{"prompt":"我想根据历史数据,估算以后大概能卖多少。","dataId":"1.xlsx","confirm":false,"sessionId":"S1003","expected":"最小二乘回归"}
{"prompt":"这三项增长一起看,能不能算出今年 GDP 大概涨多少?","dataId":"2.xlsx","confirm":false,"sessionId":"S1003","expected":"岭回归"}
{"prompt":"我想根据这三项指标,预测一下 GDP 增长。","dataId":"2.xlsx","confirm":false,"sessionId":"S1004","expected":"岭回归"}
{"prompt":"根据这些数据,能不能帮我建一个模型,预测一下房价?","dataId":"3.xlsx","confirm":false,"sessionId":"S1005","expected":"Lasso 回归"}
{"prompt":"我想根据这些特征,预测一下房价。","dataId":"3.xlsx","confirm":false,"sessionId":"S1006","expected":"Lasso 回归"}
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