提交修改
This commit is contained in:
parent
ad8ed71ff7
commit
5eee491234
@ -20,8 +20,46 @@ public class TranslationController {
|
||||
|
||||
// http://localhost:8888/general/translation/language?content=我是一只小猫&language=英语
|
||||
@EbAuthentication(tencent = ApiConstants.TENCENT_AUTH)
|
||||
@RequestMapping("/language")
|
||||
@RequestMapping("/language1000")
|
||||
public R language1000(@RequestBody TranslationRequest translationRequest) throws Exception {
|
||||
if(translationRequest.getContent().length() > 1000){
|
||||
return R.ok("字符长度不能超过1000");
|
||||
}
|
||||
return doTranslation(translationRequest);
|
||||
|
||||
}
|
||||
|
||||
// http://localhost:8888/general/translation/language?content=我是一只小猫&language=英语
|
||||
@EbAuthentication(tencent = ApiConstants.TENCENT_AUTH)
|
||||
@RequestMapping("/language2000")
|
||||
public R language2000(@RequestBody TranslationRequest translationRequest) throws Exception {
|
||||
if(translationRequest.getContent().length() > 2000){
|
||||
return R.ok("字符长度不能超过2000");
|
||||
}
|
||||
return doTranslation(translationRequest);
|
||||
}
|
||||
|
||||
// http://localhost:8888/general/translation/language?content=我是一只小猫&language=英语
|
||||
@EbAuthentication(tencent = ApiConstants.TENCENT_AUTH)
|
||||
@RequestMapping("/language5000")
|
||||
public R language(@RequestBody TranslationRequest translationRequest) throws Exception {
|
||||
if(translationRequest.getContent().length() > 5000){
|
||||
return R.ok("字符长度不能超过5000");
|
||||
}
|
||||
return doTranslation(translationRequest);
|
||||
}
|
||||
|
||||
// http://localhost:8888/general/translation/language?content=我是一只小猫&language=英语
|
||||
@EbAuthentication(tencent = ApiConstants.TENCENT_AUTH)
|
||||
@RequestMapping("/language8000")
|
||||
public R language8000(@RequestBody TranslationRequest translationRequest) throws Exception {
|
||||
if(translationRequest.getContent().length() > 8000){
|
||||
return R.ok("字符长度不能超过8000");
|
||||
}
|
||||
return doTranslation(translationRequest);
|
||||
}
|
||||
|
||||
public R doTranslation(@RequestBody TranslationRequest translationRequest) {
|
||||
String prompt = LLMUtils.prompt + translationRequest.getLanguage();
|
||||
|
||||
ModelResult modelResult = LLMUtils.callBaiLian(translationRequest.getContent(), prompt);
|
||||
@ -37,4 +75,7 @@ public class TranslationController {
|
||||
return R.ok().setData(resp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user