Skip to content
This repository was archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
Implement [Explicit] [Local Language] [Text Moderation] Error Handling (
Browse files Browse the repository at this point in the history
#298)

- [+] feat(locales): add TextModerationErr translation for cn, en, id
- [+] refactor(openai.ts): use locale TextModerationErr for error messages
  • Loading branch information
H0llyW00dzZ authored Feb 29, 2024
1 parent c03aa72 commit 8dd48bc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/client/platforms/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export class ChatGPTApi implements LLMApi {
}
}
// Format the error message for user-friendly display
const formattedError = `We encountered an issue while reviewing your message:\n${errorMessage}`;
const formattedError = Locale.Error.TextModerationErr + `\n${errorMessage}`;
// Use the onFinish callback or similar to display the error in the chat interface
options.onFinish(formattedError);
return;
Expand Down
1 change: 1 addition & 0 deletions app/locales/cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const cn = {
violence: "暴力",
},
},
TextModerationErr: "审核您的消息时遇到问题:",
},
Auth: {
Title: "需要密码",
Expand Down
1 change: 1 addition & 0 deletions app/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const en: LocaleType = {
violence: "Violence",
},
},
TextModerationErr: "We encountered an issue while reviewing your message:",
},
Auth: {
Title: "Need Access Code",
Expand Down
1 change: 1 addition & 0 deletions app/locales/id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const id: PartialLocaleType = {
violence: "Kekerasan",
},
},
TextModerationErr: "Kami menemui masalah saat meninjau pesan Anda:",
},
Auth: {
Title: "Diperlukan Kode Akses",
Expand Down

0 comments on commit 8dd48bc

Please sign in to comment.