提交 d9b8f8e9 作者: 刘凯歌

合并分支 'dev_0710' 到 'event_fusion'

逻辑调整,优化

查看合并请求 !10
...@@ -10,13 +10,10 @@ import org.apache.commons.collections4.CollectionUtils; ...@@ -10,13 +10,10 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author lkg * @author lkg
......
...@@ -166,8 +166,8 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -166,8 +166,8 @@ public interface EventMapper extends BaseMapper<Event> {
* @author lkg * @author lkg
* @date 2025/7/12 * @date 2025/7/12
*/ */
Page<EventFrontVO> frontCollectPageList(@Param("projectId") String projectId, @Param("userId") String userId, @Param("eventName") String eventName, Page<EventFrontVO> frontCollectPageList(@Param("projectId") String projectId, @Param("userId") String userId, @Param("createBy") String createBy,
@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField, @Param("eventName") String eventName,@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type, @Param("labelName") String labelName, @Param("type") Integer type,
@Param("order") String order, @Param("orderType") String orderType, @Param("order") String order, @Param("orderType") String orderType,
@Param("tenant") String tenant, Page<EventFrontVO> page); @Param("tenant") String tenant, Page<EventFrontVO> page);
......
...@@ -356,7 +356,7 @@ ...@@ -356,7 +356,7 @@
inner join event_collect_map ecm on t1.id = ecm.event_id inner join event_collect_map ecm on t1.id = ecm.event_id
inner join project_subject_map m on t1.id = m.subject_id inner join project_subject_map m on t1.id = m.subject_id
left join event_tag t3 on t1.id=t3.event_id left join event_tag t3 on t1.id=t3.event_id
where t1.publish_status = 1 and t1.face_public = 1 where t1.publish_status = 1 and (t1.face_public = 1 or t1.create_by = #{createBy})
and ecm.user_id = #{userId} and m.project_id = #{projectId} and ecm.user_id = #{userId} and m.project_id = #{projectId}
<if test="tenant != null and tenant != ''"> <if test="tenant != null and tenant != ''">
and t1.tenant = #{tenant} and t1.tenant = #{tenant}
......
...@@ -276,7 +276,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements ...@@ -276,7 +276,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
List<Node> nodes = eventCategoryService.categoryList(); List<Node> nodes = eventCategoryService.categoryList();
eventTypes = TreeUtil.belowList(nodes, eventType, true); eventTypes = TreeUtil.belowList(nodes, eventType, true);
} }
Page<EventFrontVO> pageList = baseMapper.frontCollectPageList(projectId,currentUser.getId(), eventName, eventTypes, labelField, labelName, type, order, orderType, currentUser.getTenant(),page); Page<EventFrontVO> pageList = baseMapper.frontCollectPageList(projectId,currentUser.getId(), currentUser.getUsername(), eventName, eventTypes, labelField, labelName, type, order, orderType, currentUser.getTenant(),page);
List<EventFrontVO> records = pageList.getRecords(); List<EventFrontVO> records = pageList.getRecords();
if (CollectionUtils.isNotEmpty(records)) { if (CollectionUtils.isNotEmpty(records)) {
Map<String, String> map = getFirstMap(records); Map<String, String> map = getFirstMap(records);
......
...@@ -42,7 +42,18 @@ public class NetWorkEventTask { ...@@ -42,7 +42,18 @@ public class NetWorkEventTask {
@Value("${python.hot-crawler:}") @Value("${python.hot-crawler:}")
private String hotCrawlerPath; private String hotCrawlerPath;
final static String PROMPT = "根据提供的网络事件对象集合json字符串中事件标题-【title】字段,判断是否为政治经济领域相关的事件,并按以下格式返回符合条件的网络事件集合:[{\"title\": \"政治\"}]"; //final static String PROMPT = "根据提供的网络事件对象集合json字符串中事件标题-【title】字段,判断是否为政治经济领域相关的事件,并按以下格式返回符合条件的网络事件集合:[{\"title\": \"政治\"}]";
final static String PROMPT = "你是一个网络舆情政治经济事件筛选专员。擅长从网络事件对象集合中精准筛选出政治经济领域相关事件。\n" +
"1. 依据提供的网络事件对象集合json字符串中的事件标题-【title】字段,精准判断事件是否属于政治经济领域相关。\n" +
"2. 按照指定格式返回符合政治经济领域条件的网络事件集合,且无需额外解释。\n" +
"3. 必须严格依据事件标题-【title】字段进行判断。\n" +
"4. 禁止返回不符合政治经济领域条件的事件。\n" +
"5. 严格按照以下json格式返回数据:\n" +
"[\n" +
" {\n" +
" \"title\": \"政治\"\n" +
" }\n" +
"]";
/** /**
* 定时拉取热榜数据 (1小时一次) * 定时拉取热榜数据 (1小时一次)
...@@ -58,6 +69,16 @@ public class NetWorkEventTask { ...@@ -58,6 +69,16 @@ public class NetWorkEventTask {
} }
} }
public void test(Integer type) {
List<EventNetwork> networkList = getNetWordEventList(type);
String response = llmService.model(null, PROMPT, JSONObject.toJSONString(networkList));
if (response.contains("```json")) {
response = response.substring(response.indexOf("```json") + 7, response.lastIndexOf("```"));
}
List<EventNetwork> hitList = JSON.parseArray(response, EventNetwork.class);
System.out.println(JSON.toJSONString(hitList));
}
private void handler(Integer type) { private void handler(Integer type) {
List<EventNetwork> networkList = getNetWordEventList(type); List<EventNetwork> networkList = getNetWordEventList(type);
......
...@@ -162,6 +162,7 @@ kafka: ...@@ -162,6 +162,7 @@ kafka:
run: subjectModelTest run: subjectModelTest
event: event:
run: eventSubjectModelTest run: eventSubjectModelTest
eventContext: eventContexTopicTest
clb: clb:
subject: subject:
default: default:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论