From a568128fa580901197149178a673ecfffc26d5dd Mon Sep 17 00:00:00 2001 From: H0llyW00dzZ Date: Sat, 14 Oct 2023 05:38:49 +0700 Subject: [PATCH] Feat OpenAI Path [Text Moderation] [+] feat(openai.ts): add support for text moderation configuration from app config state [+] feat(settings.tsx): add checkbox for enabling/disabling text moderation in settings [+] fix(constant.ts): remove unused TextModeration constant [+] feat(locales): add translations for TextModeration title and subtitle in multiple languages [+] feat(config.ts): add textmoderation property to DEFAULT_CONFIG and set it to true by default [+] fix(config.ts): update version to 3.9 and add migration to set textmoderation to true for older versions --- app/components/settings.tsx | 15 +++++++++++++++ app/locales/cn.ts | 4 ++++ app/locales/en.ts | 5 +++++ app/locales/id.ts | 4 ++++ 4 files changed, 28 insertions(+) diff --git a/app/components/settings.tsx b/app/components/settings.tsx index 6cac98cab58..7f875c6824a 100644 --- a/app/components/settings.tsx +++ b/app/components/settings.tsx @@ -1386,6 +1386,21 @@ export function Settings() { config.update((config) => (config.modelConfig = modelConfig)); }} /> + + + updateConfig( + (config) => + (config.textmoderation = e.currentTarget.checked), + ) + } + > + {shouldShowPromptModal && ( diff --git a/app/locales/cn.ts b/app/locales/cn.ts index f7726ab0c53..c48b54b4482 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -455,6 +455,10 @@ const cn = { Title: "频率惩罚度 (frequency_penalty)", SubTitle: "值越大,越有可能降低重复字词", }, + TextModeration: { + Title: "文本审核", + SubTitle: "通过文本审核来检查内容是否符合 OpenAI 的使用政策。", + }, NumberOfImages: { Title: "创建图片数量", SubTitle: diff --git a/app/locales/en.ts b/app/locales/en.ts index eb8b633fe8b..94c0e2fc110 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -462,6 +462,11 @@ const en: LocaleType = { SubTitle: "A larger value decreasing the likelihood to repeat the same line", }, + TextModeration: { + Title: "Text Moderation", + SubTitle: + "A Text Moderation to check whether content complies with OpenAI's usage policies.", + }, NumberOfImages: { Title: "Number Image Create", SubTitle: diff --git a/app/locales/id.ts b/app/locales/id.ts index d82c524a752..6b38267c440 100644 --- a/app/locales/id.ts +++ b/app/locales/id.ts @@ -394,6 +394,10 @@ const id: PartialLocaleType = { SubTitle: "Semakin tinggi nilai, semakin rendah kemungkinan penggunaan ulang baris yang sama", }, + TextModeration: { + Title: "Moderasi Teks", + SubTitle: "Moderasi Teks untuk memeriksa apakah konten sesuai dengan kebijakan penggunaan OpenAI.", + }, NumberOfImages: { Title: "Buat Jumlah Gambar", SubTitle: