feat(LLM任务):总结任务添加超时时间 防止llm死循环任务一直不结束

dev_na
chenhao 2026-07-06 10:44:33 +08:00
parent ec8bb466da
commit 93900308e0
2 changed files with 5 additions and 0 deletions

View File

@ -79,6 +79,7 @@ public class AiTaskServiceImpl extends ServiceImpl<AiTaskMapper, AiTask> impleme
private static final Duration ASR_SUBMIT_REQUEST_TIMEOUT = Duration.ofSeconds(30);
private static final Duration ASR_QUERY_REQUEST_TIMEOUT = Duration.ofSeconds(30);
private static final Duration LLM_REQUEST_TIMEOUT = Duration.ofSeconds(1800);
private static final String DISPATCH_MODE_PARALLEL = "PARALLEL";
private static final String DISPATCH_MODE_SERIAL = "SERIAL";
private static final String TENCENT_PROVIDER = "tencent";
@ -1273,6 +1274,7 @@ public class AiTaskServiceImpl extends ServiceImpl<AiTaskMapper, AiTask> impleme
.header("Accept", "application/json")
.header("Authorization", "Bearer " + llmModel.getApiKey())
.POST(HttpRequest.BodyPublishers.ofString(requestBody, StandardCharsets.UTF_8))
.timeout(LLM_REQUEST_TIMEOUT)
.build();
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());

View File

@ -61,6 +61,7 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
public class MeetingTranscriptChapterServiceImpl implements MeetingTranscriptChapterService {
private static final Long TIME_OUT_SECOND = 1800L;
private static final String SOURCE_TYPE_CHAPTER_VERSION = "CHAPTER_VERSION";
private static final String SOURCE_TYPE_RAW_FALLBACK = "RAW_FALLBACK";
private static final String GENERATION_MODE_INTERNAL = "INTERNAL_LLM";
@ -240,6 +241,7 @@ public class MeetingTranscriptChapterServiceImpl implements MeetingTranscriptCha
return source;
}
@Override
public MeetingTranscriptChapterVersion getCurrentVersion(Long meetingId) {
return findCurrentVersion(meetingId);
}
@ -346,6 +348,7 @@ public class MeetingTranscriptChapterServiceImpl implements MeetingTranscriptCha
.header("Accept", "application/json")
.header("Authorization", "Bearer " + llmModel.getApiKey())
.POST(HttpRequest.BodyPublishers.ofString(payload, StandardCharsets.UTF_8))
.timeout(Duration.ofSeconds(TIME_OUT_SECOND))
.build();
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() != 200) {