[AC-INIT] 提交一个 稳定可和ai中台联调的版本 #16
|
|
@ -13,5 +13,7 @@ public class AiServiceConfig {
|
|||
|
||||
private int timeout = 5000;
|
||||
|
||||
private String tenantId = "szmp@ash@2026";
|
||||
private String tenantId = "default@ash@2026";
|
||||
|
||||
private String apiKey = "tDXu09--IZutcI2h06DCR5WkK9Oi9waTKyUxhaxl5oE";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class RestTemplateConfig {
|
|||
public RestTemplate restTemplate() {
|
||||
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
|
||||
factory.setConnectTimeout(5000);
|
||||
factory.setReadTimeout(30000);
|
||||
factory.setReadTimeout(60000);
|
||||
return new RestTemplate(factory);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import java.util.List;
|
|||
@ConfigurationProperties(prefix = "transfer")
|
||||
public class TransferConfig {
|
||||
|
||||
private boolean enabled = true;
|
||||
private List<String> keywords;
|
||||
private double confidenceThreshold;
|
||||
private int maxFailRounds;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,11 @@ public class TransferService {
|
|||
private final TransferConfig transferConfig;
|
||||
|
||||
public boolean shouldTransferToManual(String message, double confidence, int messageCount, LocalDateTime sessionCreatedAt) {
|
||||
if (!transferConfig.isEnabled()) {
|
||||
log.info("转人工功能已关闭,不转人工");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (containsKeywords(message)) {
|
||||
log.info("触发转人工: 关键词匹配");
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ public class AiServiceClientImpl implements AiServiceClient {
|
|||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
headers.set("X-Tenant-Id", aiServiceConfig.getTenantId());
|
||||
headers.set("X-API-Key", aiServiceConfig.getApiKey());
|
||||
|
||||
HttpEntity<ChatRequest> entity = new HttpEntity<>(request, headers);
|
||||
|
||||
ResponseEntity<ChatResponse> response = restTemplate.postForEntity(
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
server:
|
||||
port: 8080
|
||||
port: 8883
|
||||
|
||||
spring:
|
||||
application:
|
||||
|
|
@ -24,21 +24,23 @@ wecom:
|
|||
callback-url: /wecom/callback
|
||||
|
||||
transfer:
|
||||
enabled: false
|
||||
keywords:
|
||||
- 人工
|
||||
- 转人工
|
||||
- 投诉
|
||||
- 客服
|
||||
- 人工客服
|
||||
confidence-threshold: 0.6
|
||||
confidence-threshold: 0.35
|
||||
max-fail-rounds: 3
|
||||
max-session-duration: 180000000
|
||||
max-message-rounds: 50
|
||||
|
||||
ai-service:
|
||||
url: http://localhost:8000
|
||||
timeout: 5000
|
||||
url: http://ashai.com.cn:8182
|
||||
timeout: 30000
|
||||
tenantId: szmp@ash@2026
|
||||
apiKey: tDXu09--IZutcI2h06DCR5WkK9Oi9waTKyUxhaxl5oE
|
||||
|
||||
channel:
|
||||
default-channel: wechat
|
||||
|
|
|
|||
Loading…
Reference in New Issue