Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
event
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
陈世强
event
Commits
25b0bb27
提交
25b0bb27
authored
8月 08, 2025
作者:
925993793@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
模型逻辑优化、增加驱动因素和相关指标接口
上级
3880a65a
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
206 行增加
和
78 行删除
+206
-78
LlmProperties.java
.../java/com/zzsn/event/config/properties/LlmProperties.java
+53
-0
EventAnalysisController.java
...va/com/zzsn/event/controller/EventAnalysisController.java
+50
-0
EventManageController.java
...java/com/zzsn/event/controller/EventManageController.java
+3
-1
LLmConfigController.java
...com/zzsn/event/controller/common/LLmConfigController.java
+8
-5
AnalysisColumnEnum.java
src/main/java/com/zzsn/event/enums/AnalysisColumnEnum.java
+6
-1
LlmServiceImpl.java
src/main/java/com/zzsn/event/llm/LlmServiceImpl.java
+54
-52
AnalysisService.java
src/main/java/com/zzsn/event/service/AnalysisService.java
+2
-2
AnalysisServiceImpl.java
...java/com/zzsn/event/service/impl/AnalysisServiceImpl.java
+12
-8
application-test.yml
src/main/resources/application-test.yml
+18
-9
没有找到文件。
src/main/java/com/zzsn/event/config/properties/LlmProperties.java
0 → 100644
浏览文件 @
25b0bb27
package
com
.
zzsn
.
event
.
config
.
properties
;
import
lombok.Data
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.Map
;
/**
* 大模型配置参数
* @author wangFeng
* @date 2025/1/9 17:57
*/
@Data
@Component
@ConfigurationProperties
(
prefix
=
"model"
)
public
class
LlmProperties
{
private
String
defaultModelType
;
private
List
<
ModelConfig
>
configs
;
@Data
public
static
class
ModelConfig
{
//模型类型
private
String
modelType
;
//模型类型中文名称
private
String
modelTypeName
;
//模型url
private
String
url
;
//模型apiKey
private
String
apiKey
;
//默认模型
private
String
defaultModel
;
//是否开启网络搜索
private
Boolean
webSearch
;
}
/**
* 根据模型类型获取模型配置
*
* @param modelType 模型类型
* @author lkg
* @date 2025/8/6
*/
public
ModelConfig
getModelConfig
(
String
modelType
){
for
(
ModelConfig
config
:
configs
)
{
if
(
config
.
getModelType
().
equals
(
modelType
)){
return
config
;
}
}
return
null
;
}
}
src/main/java/com/zzsn/event/controller/EventAnalysisController.java
浏览文件 @
25b0bb27
...
...
@@ -454,6 +454,56 @@ public class EventAnalysisController {
}
/**
* 驱动因素
*
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2024/4/12
*/
@GetMapping
(
"/drivingFactors"
)
public
Result
<?>
drivingFactors
(
@RequestParam
String
eventId
,
@RequestParam
(
required
=
false
)
String
startTime
,
@RequestParam
(
required
=
false
)
String
endTime
,
@RequestParam
(
required
=
false
)
String
versionId
)
{
if
(
StringUtils
.
isEmpty
(
versionId
))
{
EventAnalysisVersion
eventAnalysisVersion
=
eventAnalysisVersionService
.
latestVersion
(
eventId
);
if
(
eventAnalysisVersion
!=
null
)
{
versionId
=
eventAnalysisVersion
.
getId
();
}
}
String
versionData
=
eventAnalysisVersionRecordService
.
getVersionData
(
versionId
,
AnalysisColumnEnum
.
DRIVING_FACTORS
.
getCode
());
//String result = analysisService.llmResult(eventId, startTime, endTime, AnalysisColumnEnum.DRIVING_FACTORS.getCode());
return
Result
.
OK
(
versionData
);
}
/**
* 相关指标
*
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2024/4/12
*/
@GetMapping
(
"/relatedIndicator"
)
public
Result
<?>
relatedIndicator
(
@RequestParam
String
eventId
,
@RequestParam
(
required
=
false
)
String
startTime
,
@RequestParam
(
required
=
false
)
String
endTime
,
@RequestParam
(
required
=
false
)
String
versionId
)
{
if
(
StringUtils
.
isEmpty
(
versionId
))
{
EventAnalysisVersion
eventAnalysisVersion
=
eventAnalysisVersionService
.
latestVersion
(
eventId
);
if
(
eventAnalysisVersion
!=
null
)
{
versionId
=
eventAnalysisVersion
.
getId
();
}
}
String
versionData
=
eventAnalysisVersionRecordService
.
getVersionData
(
versionId
,
AnalysisColumnEnum
.
RELATED_INDICATOR
.
getCode
());
//String result = analysisService.llmResult(eventId, startTime, endTime, AnalysisColumnEnum.RELATED_INDICATOR.getCode());
return
Result
.
OK
(
versionData
);
}
/**
* 举措建议
*
* @param eventId 事件id
...
...
src/main/java/com/zzsn/event/controller/EventManageController.java
浏览文件 @
25b0bb27
...
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.zzsn.event.constant.Constants
;
import
com.zzsn.event.constant.Result
;
import
com.zzsn.event.entity.*
;
import
com.zzsn.event.enums.AnalysisColumnEnum
;
...
...
@@ -181,7 +182,8 @@ public class EventManageController {
//事件分析
log
.
info
(
"新增事件,事件分析,事件id:{}"
,
event
.
getId
());
kafkaTemplate
.
send
(
EVENT_MODEL_KAFKA_CHANNEL
,
event
.
getEventCode
());
});
CompletableFuture
.
runAsync
(()
->
{
//立马执行一次事件分析
analysisService
.
regenerate
(
event
.
getId
());
});
...
...
src/main/java/com/zzsn/event/controller/common/LLmConfigController.java
浏览文件 @
25b0bb27
...
...
@@ -5,11 +5,9 @@ import com.zzsn.event.entity.EventAnalysisVersion;
import
com.zzsn.event.entity.EventAnalysisVersionRecord
;
import
com.zzsn.event.entity.EventLlmConfig
;
import
com.zzsn.event.enums.AnalysisColumnEnum
;
import
com.zzsn.event.service.AnalysisService
;
import
com.zzsn.event.service.EventAnalysisVersionRecordService
;
import
com.zzsn.event.service.EventAnalysisVersionService
;
import
com.zzsn.event.service.EventLlmConfigService
;
import
com.zzsn.event.service.*
;
import
com.zzsn.event.util.DateUtil
;
import
com.zzsn.event.vo.EventVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -35,6 +33,8 @@ public class LLmConfigController {
private
EventAnalysisVersionService
eventAnalysisVersionService
;
@Autowired
private
EventAnalysisVersionRecordService
eventAnalysisVersionRecordService
;
@Autowired
private
IEventService
eventService
;
/**
* 事件下大模型配置信息
...
...
@@ -73,8 +73,11 @@ public class LLmConfigController {
llmConfigService
.
modifySingle
(
eventLlmConfig
);
CompletableFuture
.
runAsync
(()
->{
String
eventId
=
eventLlmConfig
.
getEventId
();
EventVO
event
=
eventService
.
queryInfo
(
eventId
);
String
eventName
=
event
.
getEventName
();
String
content
=
"事件标题;"
+
eventName
+
"\n采集关键词:"
+
event
.
getKeywordsVO
().
getKeyword
();
//调用大模型更细结果
String
llmResult
=
analysisService
.
llmResult
(
eventId
,
null
,
null
,
eventLlmConfig
.
getColumnCode
());
String
llmResult
=
analysisService
.
llmResult
(
eventId
,
content
,
null
,
null
,
eventLlmConfig
.
getColumnCode
());
EventAnalysisVersion
eventAnalysisVersion
=
eventAnalysisVersionService
.
latestVersion
(
eventId
);
String
versionId
;
if
(
eventAnalysisVersion
==
null
)
{
...
...
src/main/java/com/zzsn/event/enums/AnalysisColumnEnum.java
浏览文件 @
25b0bb27
...
...
@@ -31,7 +31,12 @@ public enum AnalysisColumnEnum {
DOMESTIC_SIMILAR_EVENT
(
10
,
"中国类似事件"
,
"array"
,
1
),
FOREIGN_SIMILAR_EVENT
(
11
,
"各国类似事件"
,
"array"
,
1
);
FOREIGN_SIMILAR_EVENT
(
11
,
"各国类似事件"
,
"array"
,
1
),
DRIVING_FACTORS
(
12
,
"事件核心驱动因素"
,
"string"
,
1
),
RELATED_INDICATOR
(
13
,
"事件相关指标"
,
"string"
,
1
)
;
//栏目编码
private
final
Integer
code
;
...
...
src/main/java/com/zzsn/event/llm/LlmServiceImpl.java
浏览文件 @
25b0bb27
...
...
@@ -13,12 +13,16 @@ import com.alibaba.dashscope.common.Role;
import
com.alibaba.fastjson2.JSON
;
import
com.alibaba.fastjson2.JSONArray
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.zzsn.event.config.properties.LlmProperties
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.io.BufferedReader
;
import
java.io.InputStreamReader
;
import
java.io.OutputStream
;
...
...
@@ -33,59 +37,42 @@ import java.util.*;
* @author lkg
* @date 2025/7/4
*/
@Slf4j
@Service
public
class
LlmServiceImpl
implements
LlmService
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
LlmServiceImpl
.
class
);
@Value
(
"${model.aichain.url:}"
)
private
String
AICHAIN_URL
;
@Value
(
"${model.aichain.authorization:}"
)
private
String
AICHAIN_AUTHOR
;
@Value
(
"${model.aichain.cookie:}"
)
private
String
AICHAIN_COOKIE
;
@Value
(
"${model.qwen.apiKey:}"
)
private
String
QWEN_APIKEY
;
@Value
(
"${model.deepseek.url:}"
)
private
String
DEEP_SEEK_URL
;
@Value
(
"${model.deepseek.api-key:}"
)
private
String
DEEP_SEEK_APIKEY
;
@Value
(
"${model.doubao.url:}"
)
private
String
DOU_BAO_URL
;
@Value
(
"${model.doubao.api-key:}"
)
private
String
DOU_BAO_APIKEY
;
@Value
(
"${model.doubao.default-model:}"
)
private
String
DOU_BAO_MODEL
;
@Resource
private
LlmProperties
llmProperties
;
@Override
public
String
model
(
String
model
,
String
system
,
String
content
)
{
if
(
StringUtils
.
isNotEmpty
(
model
))
{
if
(
model
.
startsWith
(
"glm"
))
{
return
glmModel
(
model
.
replace
(
"glm:"
,
""
),
system
,
content
);
}
else
if
(
model
.
startsWith
(
"qwen"
))
{
return
qwenModel
(
model
.
replace
(
"qwen:"
,
""
),
system
,
content
);
}
else
if
(
model
.
startsWith
(
"deepseek"
))
{
return
deepSeekModel
(
system
,
content
);
}
else
if
(
model
.
startsWith
(
"doubao"
))
{
return
douBaoModel
(
system
,
content
);
public
String
model
(
String
modelType
,
String
system
,
String
content
)
{
if
(
StringUtils
.
isEmpty
(
modelType
))
{
modelType
=
llmProperties
.
getDefaultModelType
();
}
LlmProperties
.
ModelConfig
modelConfig
=
llmProperties
.
getModelConfig
(
modelType
);
if
(
modelType
.
equalsIgnoreCase
(
"zhipu"
))
{
return
glmModel
(
modelConfig
,
system
,
content
);
}
else
if
(
modelType
.
equalsIgnoreCase
(
"qwen"
))
{
return
qwenModel
(
modelConfig
,
system
,
content
);
}
else
if
(
modelType
.
equalsIgnoreCase
(
"deepseek"
))
{
return
deepSeekModel
(
modelConfig
,
system
,
content
);
}
else
if
(
modelType
.
equalsIgnoreCase
(
"doubao"
))
{
return
douBaoModel
(
modelConfig
,
system
,
content
);
}
//默认调用模型
return
glmModel
(
"glm-4-flash"
,
system
,
content
);
return
null
;
}
/**
* glm模型调用
*
* @param model
模型
* @param model
Config 模型配置信息
* @param system 提示词
* @param content 引用内容
* @return 大模型响应结果
*/
public
String
glmModel
(
String
model
,
String
system
,
String
content
)
{
public
String
glmModel
(
LlmProperties
.
ModelConfig
modelConfig
,
String
system
,
String
content
)
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"model"
,
model
);
params
.
put
(
"model"
,
model
Config
.
getDefaultModel
()
);
List
<
Map
<
String
,
Object
>>
messageList
=
new
ArrayList
<>();
Map
<
String
,
Object
>
systemMap
=
new
HashMap
<>();
systemMap
.
put
(
"role"
,
"system"
);
...
...
@@ -98,8 +85,21 @@ public class LlmServiceImpl implements LlmService {
params
.
put
(
"messages"
,
messageList
);
params
.
put
(
"history"
,
"[]"
);
params
.
put
(
"top_p"
,
0.7
);
params
.
put
(
"temperature"
,
0.01
);
String
responseStr
=
glmPost
(
AICHAIN_URL
,
new
JSONObject
(
params
));
//params.put("temperature", 0.75);\
//是否开启联网搜索
Boolean
webSearchFlag
=
modelConfig
.
getWebSearch
();
if
(
webSearchFlag
!=
null
&&
webSearchFlag
)
{
Map
<
String
,
Object
>
webSearch
=
new
HashMap
<>();
webSearch
.
put
(
"enable"
,
true
);
webSearch
.
put
(
"search_result"
,
true
);
Map
<
String
,
Object
>
chatTool
=
new
HashMap
<>();
chatTool
.
put
(
"web_search"
,
webSearch
);
chatTool
.
put
(
"type"
,
"web_search"
);
List
<
Map
<
String
,
Object
>>
tools
=
new
ArrayList
<>();
tools
.
add
(
chatTool
);
params
.
put
(
"tools"
,
tools
);
}
String
responseStr
=
glmPost
(
modelConfig
.
getUrl
(),
modelConfig
.
getApiKey
(),
new
JSONObject
(
params
));
String
choices
=
JSONObject
.
parseObject
(
responseStr
).
getString
(
"choices"
);
JSONObject
choicesObject
=
(
JSONObject
)
JSON
.
parseArray
(
choices
).
get
(
0
);
String
messageStr
=
choicesObject
.
getString
(
"message"
);
...
...
@@ -109,12 +109,12 @@ public class LlmServiceImpl implements LlmService {
/**
* 千问模型调用
*
* @param model
模型
* @param model
Config
模型
* @param system 提示词
* @param content 引用内容
* @return 大模型响应结果
*/
public
String
qwenModel
(
String
model
,
String
system
,
String
content
)
{
public
String
qwenModel
(
LlmProperties
.
ModelConfig
modelConfig
,
String
system
,
String
content
)
{
try
{
Generation
gen
=
new
Generation
();
Message
systemMsg
=
Message
.
builder
()
...
...
@@ -127,9 +127,9 @@ public class LlmServiceImpl implements LlmService {
.
build
();
GenerationParam
param
=
GenerationParam
.
builder
()
// 若没有配置环境变量,请用阿里云百炼API Key将下行替换为:.apiKey("sk-xxx")
.
apiKey
(
QWEN_APIKEY
)
.
apiKey
(
modelConfig
.
getApiKey
()
)
// 模型列表:https://help.aliyun.com/zh/model-studio/getting-started/models
.
model
(
model
)
.
model
(
model
Config
.
getDefaultModel
()
)
.
messages
(
Arrays
.
asList
(
systemMsg
,
userMsg
))
.
resultFormat
(
GenerationParam
.
ResultFormat
.
MESSAGE
)
.
build
();
...
...
@@ -141,7 +141,7 @@ public class LlmServiceImpl implements LlmService {
return
""
;
}
public
String
deepSeekModel
(
String
system
,
String
content
)
{
public
String
deepSeekModel
(
LlmProperties
.
ModelConfig
modelConfig
,
String
system
,
String
content
)
{
try
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"model"
,
"deepseek-chat"
);
...
...
@@ -156,9 +156,9 @@ public class LlmServiceImpl implements LlmService {
.
build
();
List
<
Message
>
messages
=
Arrays
.
asList
(
systemMsg
,
userMsg
);
params
.
put
(
"messages"
,
messages
);
HttpResponse
execute
=
HttpUtil
.
createPost
(
DEEP_SEEK_URL
)
HttpResponse
execute
=
HttpUtil
.
createPost
(
modelConfig
.
getUrl
()
)
.
header
(
"Content-Type"
,
"application/json"
)
.
header
(
"Authorization"
,
"Bearer "
+
DEEP_SEEK_APIKEY
)
.
header
(
"Authorization"
,
"Bearer "
+
modelConfig
.
getApiKey
()
)
.
body
(
JSONUtil
.
toJsonStr
(
params
))
.
execute
();
return
execute
.
body
();
...
...
@@ -168,10 +168,10 @@ public class LlmServiceImpl implements LlmService {
return
null
;
}
public
String
douBaoModel
(
String
system
,
String
content
)
{
public
String
douBaoModel
(
LlmProperties
.
ModelConfig
modelConfig
,
String
system
,
String
content
)
{
try
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"model"
,
DOU_BAO_MODEL
);
params
.
put
(
"model"
,
modelConfig
.
getDefaultModel
()
);
Message
systemMsg
=
Message
.
builder
()
.
role
(
Role
.
SYSTEM
.
getValue
())
.
content
(
system
)
...
...
@@ -182,9 +182,9 @@ public class LlmServiceImpl implements LlmService {
.
build
();
List
<
Message
>
messages
=
Arrays
.
asList
(
systemMsg
,
userMsg
);
params
.
put
(
"messages"
,
messages
);
HttpResponse
execute
=
HttpUtil
.
createPost
(
DOU_BAO_URL
)
HttpResponse
execute
=
HttpUtil
.
createPost
(
modelConfig
.
getUrl
()
)
.
header
(
"Content-Type"
,
"application/json"
)
.
header
(
"Authorization"
,
"Bearer "
+
DOU_BAO_APIKEY
)
.
header
(
"Authorization"
,
"Bearer "
+
modelConfig
.
getApiKey
()
)
.
body
(
JSONUtil
.
toJsonStr
(
params
))
.
execute
();
String
body
=
execute
.
body
();
...
...
@@ -199,7 +199,8 @@ public class LlmServiceImpl implements LlmService {
return
null
;
}
private
String
glmPost
(
String
urlstr
,
JSONObject
jsonObject
)
{
private
String
glmPost
(
String
urlstr
,
String
apiKey
,
JSONObject
jsonObject
)
{
String
responseStr
=
null
;
try
{
URL
url
=
new
URL
(
urlstr
);
...
...
@@ -207,8 +208,9 @@ public class LlmServiceImpl implements LlmService {
conn
.
setRequestMethod
(
"POST"
);
conn
.
setRequestProperty
(
"Content-Type"
,
"application/json; utf-8"
);
conn
.
setRequestProperty
(
"Accept"
,
"application/json"
);
conn
.
setRequestProperty
(
"Authorization"
,
AICHAIN_AUTHOR
);
conn
.
setRequestProperty
(
"Cookie"
,
AICHAIN_COOKIE
);
conn
.
setRequestProperty
(
"Authorization"
,
apiKey
);
//conn.setRequestProperty("Authorization", AICHAIN_AUTHOR);
//conn.setRequestProperty("Cookie", AICHAIN_COOKIE);
conn
.
setDoOutput
(
true
);
String
jsonInputString
=
jsonObject
.
toJSONString
();
try
(
OutputStream
os
=
conn
.
getOutputStream
())
{
...
...
src/main/java/com/zzsn/event/service/AnalysisService.java
浏览文件 @
25b0bb27
...
...
@@ -92,8 +92,8 @@ public interface AnalysisService {
* @author lkg
* @date 2025/7/17
*/
String
llmResult
(
String
eventName
,
String
startTime
,
String
endTime
,
EventLlmConfig
llmConfig
);
String
llmResult
(
String
eventId
,
String
startTime
,
String
endTime
,
Integer
columnCode
);
String
llmResult
(
String
eventName
,
String
content
,
String
startTime
,
String
endTime
,
EventLlmConfig
llmConfig
);
String
llmResult
(
String
eventId
,
String
content
,
String
startTime
,
String
endTime
,
Integer
columnCode
);
/**
* 重新生成
...
...
src/main/java/com/zzsn/event/service/impl/AnalysisServiceImpl.java
浏览文件 @
25b0bb27
...
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON;
import
com.alibaba.fastjson2.JSONArray
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.obs.services.model.PutObjectResult
;
...
...
@@ -302,11 +303,11 @@ public class AnalysisServiceImpl implements AnalysisService {
}
@Override
public
String
llmResult
(
String
eventName
,
String
startTime
,
String
endTime
,
EventLlmConfig
llmConfig
)
{
public
String
llmResult
(
String
eventName
,
String
content
,
String
startTime
,
String
endTime
,
EventLlmConfig
llmConfig
)
{
if
(
llmConfig
==
null
)
{
return
null
;
}
String
result
=
llmService
.
model
(
llmConfig
.
getLlmName
(),
llmConfig
.
getLlmPrompt
(),
eventName
);
String
result
=
llmService
.
model
(
llmConfig
.
getLlmName
(),
llmConfig
.
getLlmPrompt
(),
content
);
AnalysisColumnEnum
analysisColumnEnum
=
AnalysisColumnEnum
.
getByCode
(
llmConfig
.
getColumnCode
());
String
startHeader
=
null
;
if
(
analysisColumnEnum
!=
null
)
{
...
...
@@ -343,10 +344,10 @@ public class AnalysisServiceImpl implements AnalysisService {
}
@Override
public
String
llmResult
(
String
eventId
,
String
startTime
,
String
endTime
,
Integer
columnCode
)
{
public
String
llmResult
(
String
eventId
,
String
content
,
String
startTime
,
String
endTime
,
Integer
columnCode
)
{
Event
event
=
eventService
.
getById
(
eventId
);
EventLlmConfig
llmConfig
=
eventLlmConfigService
.
getConfig
(
eventId
,
columnCode
);
return
llmResult
(
event
.
getEventName
(),
startTime
,
endTime
,
llmConfig
);
return
llmResult
(
event
.
getEventName
(),
content
,
startTime
,
endTime
,
llmConfig
);
}
@Override
...
...
@@ -356,8 +357,9 @@ public class AnalysisServiceImpl implements AnalysisService {
String
today
=
DateUtil
.
dateToString
(
new
Date
());
//保存版本信息
String
versionId
=
saveVersion
(
eventId
,
today
);
Event
event
=
eventService
.
getById
(
eventId
);
Event
VO
event
=
eventService
.
queryInfo
(
eventId
);
String
eventName
=
event
.
getEventName
();
String
content
=
"事件标题;"
+
eventName
+
"\n采集关键词:"
+
event
.
getKeywordsVO
().
getKeyword
();
log
.
info
(
"{}-事件分析重新生成逻辑开始。。。"
,
eventName
);
String
eventDescribe
=
event
.
getEventDescribe
();
//核心摘要
...
...
@@ -366,10 +368,12 @@ public class AnalysisServiceImpl implements AnalysisService {
//历史核心摘要是否为空
boolean
empty
=
StringUtils
.
isEmpty
(
eventDescribe
);
EventLlmConfig
config
=
configList
.
stream
().
filter
(
e
->
e
.
getColumnCode
().
equals
(
AnalysisColumnEnum
.
CORE_SUMMARY
.
getCode
())).
findFirst
().
orElse
(
new
EventLlmConfig
());
eventDescribe
=
this
.
llmResult
(
eventName
,
null
,
null
,
config
);
eventDescribe
=
this
.
llmResult
(
eventName
,
content
,
null
,
null
,
config
);
if
(
empty
)
{
event
.
setEventDescribe
(
eventDescribe
);
eventService
.
updateById
(
event
);
LambdaUpdateWrapper
<
Event
>
update
=
Wrappers
.
lambdaUpdate
();
update
.
set
(
Event:
:
getEventDescribe
,
eventDescribe
).
eq
(
Event:
:
getId
,
eventId
);
eventService
.
update
(
update
);
}
}
EventAnalysisVersionRecord
coreSummaryRecord
=
EventAnalysisVersionRecord
.
of
(
versionId
,
AnalysisColumnEnum
.
CORE_SUMMARY
,
eventDescribe
);
...
...
@@ -399,7 +403,7 @@ public class AnalysisServiceImpl implements AnalysisService {
//大模型相关逻辑生成的结果(影响评估,举措建议等)
List
<
EventLlmConfig
>
collect
=
configList
.
stream
().
filter
(
e
->
!
e
.
getColumnCode
().
equals
(
AnalysisColumnEnum
.
CORE_SUMMARY
.
getCode
())).
collect
(
Collectors
.
toList
());
for
(
EventLlmConfig
config
:
collect
)
{
String
llmResult
=
this
.
llmResult
(
eventName
,
null
,
null
,
config
);
String
llmResult
=
this
.
llmResult
(
eventName
,
content
,
null
,
null
,
config
);
EventAnalysisVersionRecord
record
=
EventAnalysisVersionRecord
.
of
(
versionId
,
Objects
.
requireNonNull
(
AnalysisColumnEnum
.
getByCode
(
config
.
getColumnCode
())),
llmResult
);
records
.
add
(
record
);
log
.
info
(
"{}-事件分析【{}】重新生成逻辑完成。"
,
eventName
,
config
.
getColumnName
());
...
...
src/main/resources/application-test.yml
浏览文件 @
25b0bb27
...
...
@@ -180,18 +180,27 @@ infoSource:
columnListByWait
:
http://1.95.79.85:8823/baseSourceInfo/api/infoSource/columnListByWait
columnDetail
:
http://1.95.79.85:8823/baseSourceInfo/api/infoSource/columnDetail
model
:
aichain
:
default-modelType
:
zhipu
configs
:
-
modelType
:
zhipu
modelTypeName
:
智谱
url
:
https://open.bigmodel.cn/api/paas/v4/chat/completions
authorization
:
Bearer 3262d41a17a9490a8528eaf52a2be6a0.LNbHPCRmnzFgPHRp
cookie
:
acw_tc=2760822c17247248406261468e6c541507ba9035f95078363549469047ee74
qwen
:
apiKey
:
sk-01ee9a6efa394178993a950b768e3753
deepseek
:
api-key
:
c5a53bd5f95a4e37a8997deb5d0c6031.orXyRRPNvZiqRaxF
default-model
:
glm-4-flash
#免费
web-search
:
true
-
modelType
:
qwen
modelTypeName
:
千问
url
:
https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
api-key
:
sk-01ee9a6efa394178993a950b768e3753
default-model
:
qwen-plus
#收费
-
modelType
:
deepseek
modelTypeName
:
deepseek
url
:
https://api.deepseek.com/v1/chat/completions
# api-key: sk-0e374c2ff9a147a2822c36d1c971fda1
api-key
:
sk-656a8ec451dc47aaad3dacf24fe36f20
doubao
:
default-model
:
deepseek-chat
#收费
-
modelType
:
doubao
modelTypeName
:
豆包
url
:
https://ark.cn-beijing.volces.com/api/v3/chat/completions
api-key
:
ab54c534-4f3c-41b9-9b27-132cb7954b6f
default-model
:
doubao-1-5-pro-32k-250115
# Doubao-1.5-pro-32k #
收费
default-model
:
doubao-1-5-pro-32k-250115
# Doubao-1.5-pro-32k #
收费
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论