Skip to content

Commit

Permalink
feat: support close model provider display
Browse files Browse the repository at this point in the history
  • Loading branch information
Hk-Gosuto committed Nov 3, 2024
1 parent 4f93704 commit 52726d4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/api/config/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const DANGER_CONFIG = {
defaultModel: serverConfig.defaultModel,
edgeTTSVoiceName: serverConfig.edgeTTSVoiceName,
isUseOpenAIEndpointForAllModels: serverConfig.isUseOpenAIEndpointForAllModels,
disableModelProviderDisplay: serverConfig.disableModelProviderDisplay,
};

declare global {
Expand Down
7 changes: 6 additions & 1 deletion app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,11 @@ export function ChatActions(props: {
// eslint-disable-next-line react-hooks/exhaustive-deps
[],
);
const isDisableModelProviderDisplay = useMemo(
() => accessStore.isDisableModelProviderDisplay(),
// eslint-disable-next-line react-hooks/exhaustive-deps
[],
);

useEffect(() => {
const show = isVisionModel(currentModel);
Expand Down Expand Up @@ -690,7 +695,7 @@ export function ChatActions(props: {
defaultSelectedValue={`${currentModel}@${currentProviderName}`}
items={models.map((m) => ({
title: `${m.displayName}${
m?.provider?.providerName
m?.provider?.providerName && !isDisableModelProviderDisplay
? "(" + m?.provider?.providerName + ")"
: ""
}`,
Expand Down
2 changes: 2 additions & 0 deletions app/config/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,5 +231,7 @@ export const getServerSideConfig = () => {
edgeTTSVoiceName: process.env.EDGE_TTS_VOICE_NAME ?? "zh-CN-YunxiNeural",
isUseOpenAIEndpointForAllModels:
!!process.env.USE_OPENAI_ENDPOINT_FOR_ALL_MODELS,

disableModelProviderDisplay: !!process.env.DISABLE_MODEL_PROVIDER_DISPLAY,
};
};
8 changes: 8 additions & 0 deletions app/store/access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ const DEFAULT_ACCESS_STATE = {
edgeTTSVoiceName: "zh-CN-YunxiNeural",

isUseOpenAIEndpointForAllModels: false,

disableModelProviderDisplay: false,
};

export const useAccessStore = createPersistStore(
Expand All @@ -106,6 +108,12 @@ export const useAccessStore = createPersistStore(
return get().needCode;
},

isDisableModelProviderDisplay() {
this.fetch();

return get().disableModelProviderDisplay;
},

useOpenAIEndpointForAllModels() {
this.fetch();

Expand Down

0 comments on commit 52726d4

Please sign in to comment.