正则匹配输入的英文文本

This commit is contained in:
2024-07-22 09:46:11 +08:00
parent c46f65600f
commit 9a2d58d922

View File

@@ -3302,6 +3302,10 @@ public class PythonService {
}
public String promptTranslate(String text) throws BusinessException {
if (text.matches("^[a-zA-Z\\s,.!?'-]+$")){
return text;
}
OkHttpClient client = new OkHttpClient().newBuilder()
.connectTimeout(30, TimeUnit.SECONDS)
.pingInterval(5, TimeUnit.SECONDS)//websocket轮训间隔(单位:秒)