num of newline characters

This commit is contained in:
Gabe Yuan
2023-09-01 11:21:06 +08:00
parent cde7a1d49f
commit 3e36ceb5b9
4 changed files with 25 additions and 3 deletions

View File

@@ -9,7 +9,7 @@ import Link from "@mui/material/Link";
import { useSetting } from "../../hooks/Setting";
import { limitNumber } from "../../libs/utils";
import { useI18n } from "../../hooks/I18n";
import { UI_LANGS, URL_KISS_WORKER } from "../../config";
import { UI_LANGS, URL_KISS_WORKER, TRANS_NEWLINE_LENGTH } from "../../config";
export default function Settings() {
const i18n = useI18n();
@@ -31,6 +31,9 @@ export default function Settings() {
case "maxLength":
value = limitNumber(value, 100, 10000);
break;
case "newlineLength":
value = limitNumber(value, 1, 1000);
break;
default:
}
updateSetting({
@@ -50,6 +53,7 @@ export default function Settings() {
openaiModel,
openaiPrompt,
clearCache,
newlineLength = TRANS_NEWLINE_LENGTH,
} = setting;
return (
@@ -107,6 +111,15 @@ export default function Settings() {
onChange={handleChange}
/>
<TextField
size="small"
label={i18n("num_of_newline_characters")}
type="number"
name="newlineLength"
value={newlineLength}
onChange={handleChange}
/>
<FormControl size="small">
<InputLabel>{i18n("clear_cache")}</InputLabel>
<Select