Преглед изворни кода

增加与ai大模型对话

wwh пре 3 недеља
родитељ
комит
7f309f46a6

+ 1 - 19
huimv-employment/fe-api/src/main/java/com/huimv/employment/controller/mp/ConversationController.java

@@ -7,14 +7,12 @@ import com.huimv.employment.integration.kb.SseStreamSupport;
7 7
 import com.huimv.employment.security.LoginUser;
8 8
 import com.huimv.employment.security.LoginUserHolder;
9 9
 import com.huimv.employment.service.conversation.ConversationChatService;
10
-import com.huimv.employment.service.conversation.ConversationDraftQueryService;
11 10
 import com.huimv.employment.service.conversation.ConversationMessageService;
12 11
 import com.huimv.employment.service.conversation.ConversationService;
13 12
 import com.huimv.employment.service.conversation.dto.ConversationChatRequest;
14 13
 import com.huimv.employment.service.conversation.dto.ConversationCreateRequest;
15 14
 import com.huimv.employment.service.conversation.dto.ConversationMessagePageResponse;
16 15
 import com.huimv.employment.service.conversation.dto.ConversationSummaryResponse;
17
-import com.huimv.employment.service.draft.dto.DraftDetailResponse;
18 16
 import io.swagger.v3.oas.annotations.Operation;
19 17
 import io.swagger.v3.oas.annotations.security.SecurityRequirement;
20 18
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -56,16 +54,13 @@ public class ConversationController {
56 54
     private final ConversationService conversationService;
57 55
     private final ConversationChatService conversationChatService;
58 56
     private final ConversationMessageService conversationMessageService;
59
-    private final ConversationDraftQueryService conversationDraftQueryService;
60 57
 
61 58
     public ConversationController(ConversationService conversationService,
62 59
                                   ConversationChatService conversationChatService,
63
-                                  ConversationMessageService conversationMessageService,
64
-                                  ConversationDraftQueryService conversationDraftQueryService) {
60
+                                  ConversationMessageService conversationMessageService) {
65 61
         this.conversationService = conversationService;
66 62
         this.conversationChatService = conversationChatService;
67 63
         this.conversationMessageService = conversationMessageService;
68
-        this.conversationDraftQueryService = conversationDraftQueryService;
69 64
     }
70 65
 
71 66
     /**
@@ -111,19 +106,6 @@ public class ConversationController {
111 106
                 loginUser.getUserId(), conversationId, page, size));
112 107
     }
113 108
 
114
-    /**
115
-     * 查询当前会话关联的最新草稿(兜底:消息未带 draft_id 时使用)。
116
-     */
117
-    @GetMapping("/{id}/draft")
118
-    @Operation(summary = "查询会话当前草稿",
119
-            description = "返回该会话下最新一条 fe_employment_draft 详情(含 fields)。"
120
-                    + "Agent 回复未携带 card_draft 时,前端可在对话结束后调用此接口拉取草稿。")
121
-    public R<DraftDetailResponse> getConversationDraft(@PathVariable("id") Long conversationId) {
122
-        LoginUser loginUser = requireEnterprise();
123
-        return R.ok(conversationDraftQueryService.getDraftByConversation(
124
-                loginUser.getUserId(), conversationId));
125
-    }
126
-
127 109
     /**
128 110
      * 在已有会话内发起 AI 对话(SSE 流式,流结束后落库)。
129 111
      */

+ 0 - 44
huimv-employment/fe-service/src/main/java/com/huimv/employment/service/conversation/ConversationDraftQueryService.java

@@ -1,44 +0,0 @@
1
-package com.huimv.employment.service.conversation;
2
-
3
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4
-import com.huimv.employment.common.exception.BizException;
5
-import com.huimv.employment.common.exception.ErrorCode;
6
-import com.huimv.employment.dao.entity.FeEmploymentDraft;
7
-import com.huimv.employment.dao.mapper.FeEmploymentDraftMapper;
8
-import com.huimv.employment.service.draft.DraftService;
9
-import com.huimv.employment.service.draft.dto.DraftDetailResponse;
10
-import org.springframework.stereotype.Service;
11
-
12
-/**
13
- * 按会话查询当前关联草稿(小程序兜底,无需 draft_id)。
14
- */
15
-@Service
16
-public class ConversationDraftQueryService {
17
-
18
-    private final ConversationService conversationService;
19
-    private final FeEmploymentDraftMapper feEmploymentDraftMapper;
20
-    private final DraftService draftService;
21
-
22
-    public ConversationDraftQueryService(ConversationService conversationService,
23
-                                         FeEmploymentDraftMapper feEmploymentDraftMapper,
24
-                                         DraftService draftService) {
25
-        this.conversationService = conversationService;
26
-        this.feEmploymentDraftMapper = feEmploymentDraftMapper;
27
-        this.draftService = draftService;
28
-    }
29
-
30
-    /**
31
-     * 返回会话下最新一条草稿详情(含 pending / confirmed)。
32
-     */
33
-    public DraftDetailResponse getDraftByConversation(Long userId, Long conversationId) {
34
-        conversationService.requireOwned(userId, conversationId);
35
-        FeEmploymentDraft draft = feEmploymentDraftMapper.selectOne(new LambdaQueryWrapper<FeEmploymentDraft>()
36
-                .eq(FeEmploymentDraft::getConversationId, conversationId)
37
-                .orderByDesc(FeEmploymentDraft::getCreateTime)
38
-                .last("LIMIT 1"));
39
-        if (draft == null) {
40
-            throw new BizException(ErrorCode.NOT_FOUND, "当前会话暂无草稿");
41
-        }
42
-        return draftService.getDetail(userId, draft.getId());
43
-    }
44
-}