feat(LLM任务):总结任务添加超时时间 防止llm死循环任务一直不结束
parent
ec8bb466da
commit
93900308e0
|
|
@ -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_SUBMIT_REQUEST_TIMEOUT = Duration.ofSeconds(30);
|
||||||
private static final Duration ASR_QUERY_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_PARALLEL = "PARALLEL";
|
||||||
private static final String DISPATCH_MODE_SERIAL = "SERIAL";
|
private static final String DISPATCH_MODE_SERIAL = "SERIAL";
|
||||||
private static final String TENCENT_PROVIDER = "tencent";
|
private static final String TENCENT_PROVIDER = "tencent";
|
||||||
|
|
@ -1273,6 +1274,7 @@ public class AiTaskServiceImpl extends ServiceImpl<AiTaskMapper, AiTask> impleme
|
||||||
.header("Accept", "application/json")
|
.header("Accept", "application/json")
|
||||||
.header("Authorization", "Bearer " + llmModel.getApiKey())
|
.header("Authorization", "Bearer " + llmModel.getApiKey())
|
||||||
.POST(HttpRequest.BodyPublishers.ofString(requestBody, StandardCharsets.UTF_8))
|
.POST(HttpRequest.BodyPublishers.ofString(requestBody, StandardCharsets.UTF_8))
|
||||||
|
.timeout(LLM_REQUEST_TIMEOUT)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
|
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ import java.util.stream.Collectors;
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class MeetingTranscriptChapterServiceImpl implements MeetingTranscriptChapterService {
|
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_CHAPTER_VERSION = "CHAPTER_VERSION";
|
||||||
private static final String SOURCE_TYPE_RAW_FALLBACK = "RAW_FALLBACK";
|
private static final String SOURCE_TYPE_RAW_FALLBACK = "RAW_FALLBACK";
|
||||||
private static final String GENERATION_MODE_INTERNAL = "INTERNAL_LLM";
|
private static final String GENERATION_MODE_INTERNAL = "INTERNAL_LLM";
|
||||||
|
|
@ -240,6 +241,7 @@ public class MeetingTranscriptChapterServiceImpl implements MeetingTranscriptCha
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public MeetingTranscriptChapterVersion getCurrentVersion(Long meetingId) {
|
public MeetingTranscriptChapterVersion getCurrentVersion(Long meetingId) {
|
||||||
return findCurrentVersion(meetingId);
|
return findCurrentVersion(meetingId);
|
||||||
}
|
}
|
||||||
|
|
@ -346,6 +348,7 @@ public class MeetingTranscriptChapterServiceImpl implements MeetingTranscriptCha
|
||||||
.header("Accept", "application/json")
|
.header("Accept", "application/json")
|
||||||
.header("Authorization", "Bearer " + llmModel.getApiKey())
|
.header("Authorization", "Bearer " + llmModel.getApiKey())
|
||||||
.POST(HttpRequest.BodyPublishers.ofString(payload, StandardCharsets.UTF_8))
|
.POST(HttpRequest.BodyPublishers.ofString(payload, StandardCharsets.UTF_8))
|
||||||
|
.timeout(Duration.ofSeconds(TIME_OUT_SECOND))
|
||||||
.build();
|
.build();
|
||||||
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
|
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
|
||||||
if (response.statusCode() != 200) {
|
if (response.statusCode() != 200) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue