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

Commit

Permalink
Fix Known Issue for Custom Provider Lmao (#187)
Browse files Browse the repository at this point in the history
- [+] fix(openai.ts): fix condition in if statement for text moderation
- [+] fix(settings.tsx): remove unnecessary condition for checkbox onChange event
- [+] docs(constant.ts): add comment about future implementation of Custom service provider
  • Loading branch information
H0llyW00dzZ authored Dec 8, 2023
1 parent 22b63ad commit d31e6b1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/client/platforms/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class ChatGPTApi implements LLMApi {
const textmoderation = useAppConfig.getState().textmoderation;
const latest = OpenaiPath.TextModerationModels.latest;
const checkprovider = getProviderFromState();
if (textmoderation
if (textmoderation !== false // forgot to fix this, was focusing in backend lmao
&& DEFAULT_MODELS
&& options.whitelist !== true
// Skip text moderation for Azure provider since azure already have text-moderation, and its enabled by default on their service
Expand Down
7 changes: 1 addition & 6 deletions app/components/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1483,13 +1483,8 @@ export function Settings() {
>
<input
type="checkbox"
checked={accessStore.provider !== ServiceProvider.Custom && config.textmoderation}
checked={config.textmoderation}
onChange={(e) => {
// If the provider is Custom, prevent checking the box.
if (accessStore.provider === ServiceProvider.Custom) {
return;
}
// Otherwise, update the config based on the checkbox state.
updateConfig((config) => {
config.textmoderation = e.currentTarget.checked;
});
Expand Down
1 change: 1 addition & 0 deletions app/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export enum ServiceProvider {
OpenAI = "OpenAI",
Azure = "Azure",
// Custom Service Provider e.g. one-api by @songquanpeng or other (open source community)
// Currently unplemented, but will be implemented in the future
Custom = "Custom",
}

Expand Down

0 comments on commit d31e6b1

Please sign in to comment.