Commit 6c04f4ff authored by wangning's avatar wangning

fix 智能体知识库 问题

parent 2c8526bc
......@@ -4,29 +4,17 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="26f8285c-12a3-40dc-b957-23c37b8f3c67" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/src/main/java/pro/spss/server/agent/auth/AuthInterceptorConfiguration.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/promptwords/algo_suggest" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/promptwords/algo_suggest_bak260118" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/promptwords/algo_suggest_bak260119" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/testcases/algo_knowledge1.jsonl" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/testcases/algo_knowledge2.jsonl" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/testcases/algo_knowledge3.jsonl" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/testcases/default.jsonl" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/testcases/suggest_algorithm.jsonl" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/testcases/suggest_algorithm_bak.jsonl" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/testcases/test_result/res1.xlsx" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/testcases/test_result/result.xlsx" afterDir="false" />
<list default="true" id="26f8285c-12a3-40dc-b957-23c37b8f3c67" name="Changes" comment="fix">
<change afterPath="$PROJECT_DIR$/src/main/resources/testcases/algo_knowledge/algo_knowledge4.jsonl" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/pro/spss/server/agent/domain/response/ResponseMessage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/pro/spss/server/agent/domain/response/ResponseMessage.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/pro/spss/server/agent/service/chatService/ChatServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/pro/spss/server/agent/service/chatService/ChatServiceImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/pro/spss/server/agent/service/handler/IntentTool.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/pro/spss/server/agent/service/handler/IntentTool.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/pro/spss/server/agent/utils/DataSummaryUtil.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/pro/spss/server/agent/utils/DataSummaryUtil.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/pro/spss/server/agent/service/sessionService/ChatSessionManager.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/pro/spss/server/agent/service/sessionService/ChatSessionManager.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/application-wn.yml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/application-wn.yml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/mapper/DaAgentMessageMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/mybatis/mapper/DaAgentMessageMapper.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/mapper/DaAgentSessionMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/mybatis/mapper/DaAgentSessionMapper.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/mapper/ResultMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/mybatis/mapper/ResultMapper.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/promptwords/0_1.txt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/promptwords/0_1.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/testcases/algo_knowledge1.jsonl" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/testcases/algo_knowledge/algo_knowledge1.jsonl" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/testcases/algo_knowledge2.jsonl" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/testcases/algo_knowledge/algo_knowledge2.jsonl" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/testcases/algo_knowledge3.jsonl" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/testcases/algo_knowledge/algo_knowledge3.jsonl" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/testcases/suggest_algorithm.jsonl" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/testcases/algo_suggest_request/suggest_algorithm.jsonl" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/testcases/suggest_algorithm_bak.jsonl" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/testcases/algo_suggest_request/suggest_algorithm_bak.jsonl" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -52,10 +40,10 @@
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true",
"RunOnceActivity.git.unshallow": "true",
"Spring Boot.Application.executor": "Run",
"Spring Boot.Application.executor": "Debug",
"git-widget-placeholder": "master",
"kotlin-language-version-configured": "true",
"last_opened_file_path": "D:/projects/ciecc-agent/src/main/resources/testcases/test_result",
"last_opened_file_path": "D:/projects/ciecc-agent/src/main/resources/testcases/algo_suggest_request",
"project.structure.last.edited": "Project",
"project.structure.proportion": "0.15",
"project.structure.side.proportion": "0.21954022",
......@@ -64,13 +52,15 @@
}]]></component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="D:\projects\ciecc-agent\src\main\resources\testcases\test_result" />
<recent name="D:\projects\ciecc-agent\src\main\resources\testcases\algo_suggest_request" />
<recent name="D:\projects\ciecc-agent\src\main\resources\testcases" />
<recent name="D:\projects\ciecc-agent\src\main\resources\testcases\test_result" />
<recent name="D:\projects\ciecc-agent\src\main\resources\promptwords" />
<recent name="D:\projects\ciecc-agent\src\main\resources" />
<recent name="D:\projects\ciecc-agent\src\main\java\pro\spss\server\agent" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="D:\projects\ciecc-agent\src\main\resources\testcases\algo_suggest_request" />
<recent name="D:\projects\ciecc-agent\src\main\resources\testcases\algo_knowledge" />
<recent name="D:\projects\ciecc-agent\src\main\resources\testcases" />
<recent name="D:\projects\ciecc-agent\src\main\resources\mybatis" />
</key>
......@@ -111,8 +101,21 @@
<option name="presentableId" value="Default" />
<updated>1768553899700</updated>
</task>
<task id="LOCAL-00001" summary="fix">
<option name="closed" value="true" />
<created>1768958069929</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1768958069929</updated>
</task>
<option name="localTasksCounter" value="2" />
<servers />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="fix" />
<option name="LAST_COMMIT_MESSAGE" value="fix" />
</component>
<component name="XDebuggerManager">
<watches-manager>
<configuration name="SpringBootApplicationConfigurationType">
......
......@@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import pro.spss.server.agent.domain.constant.ChatConstants;
import pro.spss.server.agent.domain.enums.ChatStatusEnum;
import pro.spss.server.agent.domain.enums.ConversationStateEnum;
import pro.spss.server.agent.domain.enums.CreateWayEnum;
......@@ -81,6 +82,8 @@ public class ChatServiceImpl implements BaseChatService {
}
chatSessionManager.initSession(sessionId, CreateWayEnum.ALGO_FIRST);
JSONArray messages = chatSessionManager.getMessages(sessionId);
messages.add(ChatConstants.createMessage(ChatConstants.ROLE_SYSTEM, initPrompt));
sseService.sendMessage(ResponseMessageType.INIT.getType(), sessionId, userChatMessage.getToken(), initPrompt);
return true;
......@@ -127,7 +130,7 @@ public class ChatServiceImpl implements BaseChatService {
*/
private ResponseMessage executeTool(UserChatMessage userChatMessage, RequestParams requestParams, String toolName, long startTimestamp) {
String sessionId = userChatMessage.getUserId();
JSONArray historyCopy = new JSONArray(chatSessionManager.getMessages(sessionId));
JSONArray historyCopy = chatSessionManager.getMessages(sessionId);
String prompt = userChatMessage.getPrompt();
ResponseMessage responseMessage = conversationHandler.toolExecutor(requestParams, userChatMessage, toolName, historyCopy, prompt);
responseMessage.setStartTimestamp(startTimestamp);
......
......@@ -2,6 +2,7 @@ package pro.spss.server.agent.service.sessionService;
import com.alibaba.fastjson2.JSONArray;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import pro.spss.server.agent.domain.constant.ChatConstants;
import pro.spss.server.agent.domain.enums.ConversationStateEnum;
......@@ -25,7 +26,8 @@ public class ChatSessionManager {
}
public void initSession(String sessionId, CreateWayEnum createWay) {
JSONArray messages = new JSONArray(ChatConstants.SYSTEM_MESSAGES);
JSONArray messages = new JSONArray();
messages.add(ChatConstants.createMessage(ChatConstants.ROLE_SYSTEM, ChatConstants.WELCOME_MESSAGE));
chatSessions.put(sessionId, messages);
RequestParams params = new RequestParams();
......
[
{"name":"最小二乘回归","task":["回归","预测"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"简单","property":["可解释性强","对多重共线性敏感"]},
{"name":"岭回归","task":["回归","预测"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"简单","property":["抗多重共线性","模型稳定"]},
{"name":"套索回归","task":["回归","预测"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"简单","property":["特征选择","模型稀疏"]},
{"name":"多项式回归","task":["回归","预测"],"data":"非时间序列","relation":"非线性","sample":"不限","complexity":"复杂","property":["拟合弯曲关系","易过拟合"]},
{"name":"支持向量机回归","task":["回归","预测"],"data":"非时间序列","relation":"非线性","sample":"偏小样本","complexity":"复杂","property":["小样本表现好","对参数敏感"]},
{"name":"BP神经网络","task":["回归","预测"],"data":"非时间序列","relation":"非线性","sample":"不限","complexity":"复杂","property":["表达能力强","可解释性弱"]},
{"name":"梯度提升树","task":["回归","分类","预测"],"data":"非时间序列","relation":"非线性","sample":"不限","complexity":"复杂","property":["精度高","对噪声敏感"]},
{"name":"移动平均法","task":["预测"],"data":"时间序列","relation":"不限","sample":"偏小样本","complexity":"简单","property":["平滑波动","对突变反应慢"]},
{"name":"指数平滑法","task":["预测"],"data":"时间序列","relation":"不限","sample":"偏小样本","complexity":"简单","property":["重视近期数据","适合短期预测"]},
{"name":"自回归模型(AR)","task":["预测"],"data":"时间序列","relation":"线性","sample":"不限","complexity":"复杂","property":["依赖历史值","要求平稳"]},
{"name":"滑动平均模型(MA)","task":["预测"],"data":"时间序列","relation":"线性","sample":"不限","complexity":"复杂","property":["刻画随机扰动","短期效果好"]},
{"name":"自回归滑动平均模型","task":["预测"],"data":"时间序列","relation":"线性","sample":"不限","complexity":"复杂","property":["综合AR和MA","预测能力强"]},
{"name":"差分自回归移动平均模型","task":["预测"],"data":"时间序列","relation":"线性","sample":"不限","complexity":"复杂","property":["处理非平稳序列","建模步骤多"]},
{"name":"灰色模型","task":["预测"],"data":"时间序列","relation":"线性","sample":"小样本","complexity":"简单","property":["小样本适用","抗随机性弱"]},
{"name":"决策树","task":["分类","决策"],"data":"非时间序列","relation":"非线性","sample":"不限","complexity":"简单","property":["结构直观","易过拟合"]},
{"name":"随机森林","task":["分类","预测"],"data":"非时间序列","relation":"非线性","sample":"不限","complexity":"复杂","property":["稳定性高","计算量大"]},
{"name":"自适应增强算法","task":["分类","预测"],"data":"非时间序列","relation":"非线性","sample":"不限","complexity":"复杂","property":["关注难样本","对噪声敏感"]},
{"name":"判别分析","task":["分类"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"简单","property":["模型简洁","分布假设强"]},
{"name":"二分类逻辑回归","task":["分类","回归"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"简单","property":["概率输出","可解释性好"]},
{"name":"皮尔逊相关分析","task":["相关"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"简单","property":["衡量线性关系","对异常值敏感"]},
{"name":"斯皮尔曼相关分析","task":["相关"],"data":"非时间序列","relation":"不限","sample":"不限","complexity":"简单","property":["基于秩次","对异常值不敏感"]},
{"name":"独立样本t检验","task":["检验"],"data":"非时间序列","relation":"不限","sample":"不限","complexity":"简单","property":["比较均值差异","要求正态性"]},
{"name":"正态检验","task":["检验"],"data":"非时间序列","relation":"不限","sample":"不限","complexity":"简单","property":["检验分布形态","对样本量敏感"]},
{"name":"K-均值聚类","task":["聚类"],"data":"非时间序列","relation":"不限","sample":"不限","complexity":"简单","property":["速度快","对初始中心敏感"]},
{"name":"层次聚类","task":["聚类"],"data":"非时间序列","relation":"不限","sample":"小样本","complexity":"复杂","property":["结构直观","计算量大"]},
{"name":"因子分析","task":["降维","评价"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"复杂","property":["提取潜在因子","解释性强"]},
{"name":"主成分分析","task":["降维"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"复杂","property":["信息压缩","可解释性弱"]},
{"name":"优劣解距离法","task":["排序","评价"],"data":"非时间序列","relation":"不限","sample":"不限","complexity":"简单","property":["结果直观","依赖权重"]},
{"name":"秩和比评价法","task":["排序","评价"],"data":"非时间序列","relation":"不限","sample":"不限","complexity":"简单","property":["计算简单","信息损失多"]},
{"name":"模糊综合评价","task":["评价","排序"],"data":"非时间序列","relation":"不限","sample":"不限","complexity":"复杂","property":["处理模糊信息","主观性强"]},
{"name":"数据包络分析(CCR)","task":["效率","评价"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"复杂","property":["规模报酬不变","适合同规模对象"]},
{"name":"数据包络分析(BCC)","task":["效率","评价"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"复杂","property":["规模报酬可变","区分技术效率"]},
{"name":"柯布-道格拉斯生产函数","task":["效率","回归"],"data":"非时间序列","relation":"线性","sample":"不限","complexity":"简单","property":["形式简单","函数假设强"]}
]
算法标签体系简要说明
通过标签对算法的适用场景和特性进行结构化描述,用于支持算法自动推荐、条件筛选和规则匹配。
任务类型:说明算法能解决的问题,如预测、回归、分类、排序、聚类、相关、检验、降维、评价、效率等。
数据类型:区分是否为时间序列数据。
关系形式:描述模型刻画关系的方式,包括线性、非线性或不限。
样本规模:表示算法对样本数量的适应程度,如小样本或不限。
复杂度:表示算法实现和计算难度,分为简单或复杂。
通过这些标签,可以将用户需求与算法能力快速匹配,实现智能推荐与筛选。
样本很小、特征少 → 优先简单模型
特征多、关系明显非线性 → 偏向复杂模型
\ No newline at end of file
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