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

Commit

Permalink
Refactor ChatGPT LLM Api [Text Moderation] (#103)
Browse files Browse the repository at this point in the history
[+] fix(openai.ts): add comment explaining the purpose of the text moderation check
[+] chore(openai.ts): refactor text moderation check to include DEFAULT_MODELS condition
  • Loading branch information
H0llyW00dzZ authored Nov 14, 2023
1 parent f7f2793 commit 243538d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/client/platforms/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,13 @@ export class ChatGPTApi implements LLMApi {
async chat(options: ChatOptions) {
const textmoderation = useAppConfig.getState().textmoderation;
const latest = OpenaiPath.TextModerationModels.latest;

if (textmoderation && options.whitelist !== true) {
if (textmoderation
/**
* This A Text Moderation OpenAI, default is enabled
* you can disabled it in settings
**/
&& DEFAULT_MODELS
&& options.whitelist !== true) {
const messages = options.messages.map((v) => ({
role: v.role,
content: v.content,
Expand Down

0 comments on commit 243538d

Please sign in to comment.